Prof. Krishna R. Pattipati Dept. of Electrical and ...

40
Copyright ©2004 by K. Pattipati Prof. Krishna R. Pattipati Dept. of Electrical and Computer Engineering University of Connecticut Contact: [email protected] (860) 486-2890 Lecture 3 ECE 336 Stochastic Models for the Analysis of Computer Systems and Communication Networks

Transcript of Prof. Krishna R. Pattipati Dept. of Electrical and ...

Copyright ©2004 by K. Pattipati

Prof. Krishna R. Pattipati

Dept. of Electrical and Computer Engineering

University of Connecticut Contact: [email protected] (860) 486-2890

Lecture 3

ECE 336

Stochastic Models for the Analysis of Computer Systems

and Communication Networks

Copyright ©2004 by K. Pattipati

2

Summary of Lecture 2

Properties of Exponential and Geometric Distributions

Properties of the Poisson Process

Steady-state solutions to DTMC and CTMC

State Transition Rate Diagrams

Applications to M/M/1,M/M/1/N,M/M/m,M/M/∞,M/M/m/m Queues

Performance measures for M/M/1, M/M/∞, and M/M/m Queues

Outline of Lecture 3

Copyright ©2004 by K. Pattipati

3

DTMC:

• Specified by

CTMC:

• Specified by

ijPi)

nX/j

nP(X

1

noffunction

pmfGeometricn

iiiii

N

ii

nT

n

T

N

jij

T

PPnPipmf

ppppPpPp

NiPnpPnp

1

0

0

)1()(:stategivenainspentstagesof# ofThe

1 also;]...[)(lim&,statesteadytheIn

,.......,1,01);()1(

Independent of n

non-homogeneous

homogeneous

iiiiiτ

T

i

T

ijii

N

jij

iiij

qt(t)hi

pQop

tQitXtppQp

oeQ(t)qtqtq

tottqitXittXPjitottqitXjttXP

i

)),(exp( : stategiven ain spent timeofdensity The

state,staedy In the

chain Markov shomogeneou invariant time)(};)(Prob{)(,

0 since0)(0)(

)()(1))(/)((;),()())(/)((

0

• Unconditional probabilities

Summary of Lecture 2

Copyright ©2004 by K. Pattipati

4

Questions:

• What are the properties of exponential density & Geometric pmf ?

• Since inter arrival times of a Poisson distribution are exponentially

distributed, what are the properties of Poisson process ?

• Is there a general way of looking at arrival and departure processes?

…. Renewal processes

• When does steady-state solutions exist for DTMC and CTMC?

• Are there simple ways of visualizing state transitions?

• How to analyze simple queues ?

Issues Addressed in Lecture 3

Copyright ©2004 by K. Pattipati

5

Properties of Exponential pdf and Geometric pmf

a) Memory-less Property:

Suppose that we have already spent in state i for r time units (k steps).

want:

)(

)(

)(

)(

),(

)|()|(

tP

e

rP

trP

rP

rtrP

rtrPrtYP

i

t

i

i

i

ii

iiii

i

)(

)(

)(

)(

),(

)|(

,...2,1)|(

nTP

PkTP

knTP

kTP

kTknTP

kTknTP

nkTnYP

i

n

ii

i

i

i

ii

ii

ii

i

ri

Yi

Ti

Yk

Unconditional pdf

CTMC

Unconditional pmf

Exponential Density and Geometric pmf -1

DTMC

Copyright ©2004 by K. Pattipati

6

Implication: Suppose denotes the time to failure of a component. Result says

that if the component has lasted until time r, the distribution of the remaining

(residual) time Y= -r is the same as the time to failure of a new component.

If the time to failure is exponentially distributed, then a used component is “as

good as new”.

b) Hazard Rate:

Hazard rate is a constant

iiP

ni

TP

ni

TP

ni

TP

ni

TP

nZ

itie

tie

i

t

i

H

t

i

h

ti

Z

1

)1(1

)(

)(1

)(;

)(1

)(

)(

Markovian property (e.g., Poisson)

Exponential density Constant hazard rate

Exponential Density and Geometric pmf -2

Copyright ©2004 by K. Pattipati

7

c) Among all the densities having the same mean, exponential density has

the largest entropy.

)(ln)(:pmf geometricfor result similar showCan

1)( so, .

11e :yields constraintMean

)(1 :sconstraintmean &ion normalizat From

)(0)1()(ln

)(1)()(ln)(

:Lagrangian Define

)(ln)()(ln

0

/

0

)1(

)1(

)1(

000

0

nPnPH

ehd

ehee

ehh

dhdhdhhL

dhhhEH

nii

Exponential Density and Geometric pmf - 3

Copyright ©2004 by K. Pattipati

8

d) Suppose have n independent random variables with parameters

, respectively. Thenm ,...,,

21

m ,...,,

21

m

iim

(τ1

21parameter with lexponentia is ),...,,min

Proof:

Exponential Density and Geometric pmf - 4

rate relative

)()|()(:

)1( )()( parameter with geometric is

)()( Then,

parameter with GeometricT where),...,,min(

:pmf geometricfor Similarly

parameter with lexponentia

)(...)()()(

00

1

1

1121

ii21

1

)(

21

1

ji

i

tt

iijiji

nm

iii

nm

iii

m

i

n

iim

im

m

ii

t

m

dteedtthtPPAside

PPnTPPPT

PPn)n)....P(Tn)P(T P(Tn) P(T

PTTTT

etPtPtPtP

ij

i

m

i

i

Copyright ©2004 by K. Pattipati

9

e) Suppose have n independent random variables with the same

parameter . Thenm ,...,,

21

)),((or is

1

ondistributimGammaErlang-mSm

iim

Proof:

Exponential Density and Geometric pmf - 5

masm

Cm

mmSE

mSE

tem

tth

ssL

ssL

mmS

mm

i

S

mm

t

m

S

m

S

01

)1()(;)(

0;)!1(

)()()(

)()(:MGF Recall

2

2

2

2

1

Aside: Suppose have different parameters, jim ;,...,,

21m ,...,,

21

0;)()(111

teths

sLm

ijj

ij

jtm

iiS

m

ii

i

S

i

mm

Application:

Pdf of the time until mth

arrival.

X(t) Poission X(t)=

max{m: Sm t} & S0= 0..

Copyright ©2004 by K. Pattipati

10

a) Merging of Poisson Processes results in a Poisson Process

Poisson Stream

With rate

X

{X

X X

X X

XX X X X

Individual

streams

Merged

stream

m

ii

1

11),( tN

22),( tN

mmtN ),(

Proof:

...2,1,0;!

)()(),(

MGFs ofproduct nconvolutio i.i.d. of sum

)(.....)()(

)1()1()(

1

1

nen

ttpeetzG

tNtNtN

t

n

n

ztzt

N

m

m

i

i

Properties of Poisson Process - 1

Copyright ©2004 by K. Pattipati

11

b) Splitting or Decomposition of a Poisson Process

)(tN

mp

1p

2p

)(11

tNp

)(22

tNp

)(tNpmm

Poisson stream

with rate

rates,th poisson wi andt independen are streams Individual

!

)(

!

)(

!!...!

...!

)()|,...,,();,...,,(

...!!...!

!)|,...,,(

)(...)()()(

1

...

21

21)(

2121

21

21

21

21

2121

21

i

m

ii

N

i

tp

NNN

m

N

m

NNtp

mm

N

m

NN

m

m

m

p

N

tpe

N

t

NNN

pppNe

NPNNNNPNNNNP

pppNNN

NNNNNP

tNtNtNtN

ii

mm

i

m

Properties of Poisson Process - 2

Splitter

Copyright ©2004 by K. Pattipati

12

c) Conditional Distribution of the Arrival Times

tsst

n

nte

eeee

ntNP

nssshnsssP

SSS

,t

SSSnntN

t

s

te

eλse

tNP

PsP

tNP

sP

tNP

tNsPtNsP

tuniform

t

nn

nt

stsssss

n

n

ii

n

t

sts

nnn

....0;!

!/)(

...

))((

),,....,,()|,....,,(

0; : timesarrival-Inter

]0[ interval in the ddistributeuniformly and

i.i.d. are ,....,, timesarrival the,)( Given that :Aside

uniform

)1)((

}t)[s,in events 0{)}[0,in event 1{

)1)((

}t)[s,in events 0),[0,in event 1{

)1)((

)1)(,()1)(|(

.],0[in is occurredevent which the

at time theofon distributi then,informatio Given this

. by time, place taken has processPoisson a ofevent one Suppose

1

)()()(

21

21

01i

21

)(

1

1

1121

Properties of Poisson Process - 3

Copyright ©2004 by K. Pattipati

13

d) Poisson pmf is a Special Case of Binomial pmf

,...2,1,0;!

)()( As

)(!

)1)...(1(

)1()(!

)1)...(1(

)1()(

!!

!)1()(

!!

!)(

lim

Let

)1()(

)(.

0

nen

tnpN

etNn

nNNN

N

tt

Nn

nNNN

N

t

N

t

nnN

Ntt

nnN

Nnp

tNp

t

tN

tp

ppn

Nnp

t

n

N

nNt

n

n

N

nNt

t

N

n

n

nN

n

n

nNn

t

nNn

Properties of Poisson Process - 4

Copyright ©2004 by K. Pattipati

14

Suppose are i.i.d. nonnegative random variables (not

necessarily exponential).

],,,2,1,0:{ ii

Let 1

n

iin

S

Digression: Renewal Processes

timerenewal-inter

1renewals of rate termlong

][

1|

)(

)()(

)(lim

)(lim)(lim)(1

)( :domain LaplaceIn

)()()()()()(

)(,

)()()()(

)()()()()()()(

)()()()]([)()())((

)()()()(}{))((

process counting ~)(

)()()(*)()(

0

0

01

0

011

0

1 1

11

011

1

1

1

E

ds

sdLds

sdLssL

tm

ssLtmsL

sL(s)L

dhtmthtmthdt

tdMtmrenewalsofRateLet

dhtMtHtM

dhtHtHdhtHtHtM

tHtHtHtXEtMtHntXP

tHtHtSPtSPStSPntXP

tX

dhththththSS

st

mst

m

t

nS

t

t

nS

n

t

S

n nSSS

SSnnnn

t

SSSnnn

n

nn

nnn

nn

nnn

Equation Renewal

Equation Renewal lFundamenta

Copyright ©2004 by K. Pattipati

15

Suppose are i.i.d. exponential random variables],,,2,1,0:{ ii

Let 1

n

iin

S

Poisson Process is a Renewal Process

,..2,1,0;!

)()()())((

!

)(1)()(

)!1(

)(),()()]([)(,

t][0,in renewals ofnumber Expected )(

)()(

)()(

1

1

00

1

nn

ettHtHntXP

ek

tdhtH

n

etnErlangthsLsLAlso

PoissonofmeanttM

tms

sL

ssLlExponentia

tn

SS

tn

k

kt

SS

tn

S

n

S

m

nn

nn

nn

Copyright ©2004 by K. Pattipati

16

When does steady-state solution to pQpPp TT 0&

We need n-step transition probabilities. Let

theorycontrolin matrix transition-state oSimilar t )()1()(

)1(

.)(

MC shomogeneou- time)(

0

010

1

0

n

N

kkjik

n

N

knnij

nmnmij

PnPnn

Pn

ikPkjPn

ijPijPn

exist?

Two states i and j communicate if

• state i communicates with itself

• if i and j communicate, then j and i communicate

• if i and j communicate, and j and k communicate, then i and k

communicate (transitive)

• communicating states define a class comm. divides states into classes

0)()'( and 0)()( ', ji

n

jiij

n

ijPnPnnn

If all states communicate (i.e., one class) Markov chain is irreducible

Steady-state Probabilities -1

Copyright ©2004 by K. Pattipati

17

First Passage Probabilities and Recurrence Times

recurrent) (Positive nonnullrecurrent

recurrent )(

:Re

1;)(1

state toreturningever Prob)(

)(1

1)()()(1)(,For

.0)0(,1)0(;)1(;0)0(:I

1;)()()()(y probabilit

withsteps remaining in theagain and )(y probabilit

with step at the first time for the reached becan State

})0(|)({

state leaving of stepsn after occurs state return to )(

1

1

1

i

in

iii

iiii

niiii

ii

iiiiiiii

ijjjijijij

jj

n

kijijjj

ij

th

ij

M

nullMnnfM

TimecurrenceMean

transientfrecurrentpersistentf

inff

zFzzzFzji

Pffconditionsnitial

nknkfnkn

rnkf

kj

iXjnXtimefirstP

ijfirstPnf

First Passage Probabilities

Null Recurrent

recurrent transient

1ii

f 1ii

f

Positive

Recurrent

(irreducible)

States

Copyright ©2004 by K. Pattipati

18

Further classification of Markov-chain states

• If the return to state j occurs only at γ,2γ,3γ,… (γ >1),

then state j is periodic

• If γ =1 for state i, then it is said to be aperiodic

Steady-state Probabilities - 2

Null Recurrent

recurrent transient

1ii

f 1ii

f

Positive

Recurrent

periodicaperiodic

States

If one state in a class is aperiodic, all states in that class are

If one state in a class is transient, all states in that class are

If one state in a class is recurrent, all states in that class are

If one state in a class is periodic, all states in that class are

Irreducible aperiodic (i.e., ergodic) Markov chains have:

ondistributi stationary unique theis 1

002)

capacity) servicerate arrival on(e.g.,distributi state-steady no 00)1

M

pipi p

ip

i

iii

i

Absorbing state: Pii=1 Mi =1 pi =1

Irreducible recurrent non-null (positive recurrent) and aperiodic

}, unless 0)({ knnii

}, 0)({ nnii

Copyright ©2004 by K. Pattipati

19

Examples:

Examples of State Classification - 1

0.5

0.5

0.3

0.3

0.4

1

1

0.5

0.5

(4) state Absorbing :3 Class

(2,3) statesRecurrent :2 Class

(0,1) statesTransient :1 Class

0 1 2 3

4

(2,3) states of classin trappedgetting ofy probabilit finite

0.2434] 0.5044 0.2522 0 [0

4 statein trappedischain 1] 0 0 0 [0

classesrecurrent twosince eseigen valuunity Two

: two theseof one becan iesprobabilit stateSteady

Copyright ©2004 by K. Pattipati

20

Examples:

odd 01

10

even 10

01

)(01

10

n

n

PnP n

starting in state 0, we return to state 0

in even # of steps

γ =2 periodic

}0)()({2/12/1

3/23/1nPnP

ii

n

ii

aperiodic Markov chain

01

011

0 1

1

State 0: absorbing

State 1: transient

We will consider irreducible, aperiodic Markov chains

Examples of State Classification - 2

]01[:yprobabilitstatesteady

Copyright ©2004 by K. Pattipati

21

Examples

• Poisson Process

0 1 2 3

n+1nn-1

210

)(t )(t

t

n

n

nnn

en

ttp

tptpp

!

)()(

)()(1

• Non-homogeneous Poisson process

n-1 n n+!

)(t)(t

t

d

nt

n

nnn

en

d

tp

tpttptp

0

)(0

1

!

)(

)(

)()()()(

ii

i

N

jij

iij

i

j

N

jij

ji

iii

N

jij

jjij

N

jjii

qtpqtpq

tptqtpqtptqp

know toneed No)()(

)()()()()(

NODE OF OUTFLOW

0

NODE INTOFLOW

0

00

State Transition Rate Diagrams - 1

Copyright ©2004 by K. Pattipati

22

• State-dependent birth process

0 21

0

1

n-1 n+1n

1n

n

t

nnn

t

n

n

nn

n

nnnnn

pdepetps

spsp

tptptp

nn

0

11

11

11

)0()()()(

)(

)()()(

• Birth-death processes: Forms the basis of all Markovian Queuing systems

Server

A(t)

Buffer space N

Assume N= for now

Q(t)=A(t)-D(t)

Infinite server

Single Server

Multiple servers

State-dependent

Any type

D(t)

State Transition Rate Diagrams - 2

Copyright ©2004 by K. Pattipati

23

occurcan departureor arrival oneonly t timeof intervalan in that assume We

tat timelength system )( t timeupto deaths total)(

t timeupto births total)(

tQ

tD

tA

n+1

n

n-1

.

.

.

.

.

.

.

.

.

t tt

)(1

totn

)()(1

)1)(1(

tot

tt

nn

nn

We assume S=1 (service demand=1)

0P

1P 2

P

1nP n

P 1nP

0

1

1n

n

1 2

n

)(1

totn

n

1n

State Transition Rate Diagrams - 3

)()()(

1);()()()()(

11000

1111

tptptp

ntptptptpnnnnnnnn

Copyright ©2004 by K. Pattipati

24

B-D processes model a wide variety of Markovian (exponential) queues

1) M/M/1 Queue M ~ Poisson arrivals or exponential inter-arrival pdf

M ~ exponential service demands

1 ~ single server

n

n0P

1P 2

P 1nP n

P 1nP

1

n

2) M/M/∞ queue Infinite server case No waiting

nn

n 0P1

P 2P 1n

P nP 1n

P

2n )1( n

Application to Simple Queues - 1

….

Copyright ©2004 by K. Pattipati

25

3) M/M/m queue m server case Model of a circuit

switch-Queued mode

1

2

m

mnm

mnnn

n

1mP

mP 1m

P

m m)1( m

0P

1P 2

P

2

At most

N

4) M/M/1/N queue Model of a single machine with a finite buffer

Nn

Nn

Nn

Nn

n

n

0

0

1

2

P

0P1

P

1NP

NP

Application to Simple Queues - 2

….

….

Copyright ©2004 by K. Pattipati

26

5) M/M/m/m modelBlocked call loss system or Blocked calls cleared (BCC)

mn

mnn

mn

n

n

0

10

1mP

mP

m

0P1

P

2

Application to Simple Queues - 3

….

Copyright ©2004 by K. Pattipati

27

6) Engset model (M>N) M/M/N/N/M queue

Nnn

MN

NnnM

n

n

1;

0;)(

Poisson

arrivals

)( nMn

nn

n calls in progress

NP

N

)1( NM

0P1

P

M

)1( M

2

Application to Simple Queues - 4

Copyright ©2004 by K. Pattipati

28

7) Machine Repairman model….forms the basis of closed networks

M/M/1/N/N queue

1

N

1

)1(

n

n1

n

n

NnnN

otherwise 0

0)(

8) M/M/1 queue with feedback …. A simple open network

0P1

P

N

)1( N

1NP

NP

Application to Simple Queues - 5

Copyright ©2004 by K. Pattipati

29

)(lim

only.solution state-steadyth content wi be will Wefunctions. Bessel

involvessolution queue), M/M/1 (i.e., , If methods. numerical viaSolution

asknown

)()()(

1);()()()()(

)()(])(1[)()(

n

1100

0

1111

1111

tpp

tptpdt

tdp

ntptptpdt

tdp

ttptptttpttp

nt

n

n

nnnnnnn

n

nnnnnnnn

equations balance global

Coming back to birth-death model

11

nnnnpp

nnnnpp

11

1nP

nP

1n

n

nnnnpp

11Local balance

n detailed Balance Equations

Solution of Birth-Death Model - 1

Copyright ©2004 by K. Pattipati

30

1

1

1

01

00

0

1

01

0

21

110

1

1

]1[1 Since

)(...

...

n

n

ii

i

nn

n

ii

i

n

n

n

n

n

n

pp

pppp

Once the distribution is known, we can obtain a variety of performance

measures

1) Throughput: n

nnpX

1

2) System (or Queue) length

1n

nnpQ

3) Utilizationn

n

nnn

pU

max

1

4) Average Response time:X

QR

Solution of Birth-Death Model - 2

Little’s law

Copyright ©2004 by K. Pattipati

31

1. M/M/1 Queue

)1( versus note pmf... Geometric Modified ,...2,1,0)1(

1or;111

intensity traffic;,

1

10

0

nnnp

Needp

pp

n

n

n

n

n

nnn

0 1 2 3 4

n

1n

p)1(

)1(2

)1(3

)1(4

Application to M|M|1 Queue - 1

Copyright ©2004 by K. Pattipati

32

11

1)1(11)1(

2

)1(

2

)1(

)1(2)()(

1)1(

)1()()(

1

)1()(

2

2

2

2

2

2

2

3

2

1

2

2

2

1

2

1

0

QC

dz

zGdQnE

zdz

zdGQnE

zzpzG

n

n

nn

z

Zz

n

n

n

• Throughput

)1)((1 1n n

n

nnpX

• Average response time)1(

1

X

QR

Higher moments of response time requires analysis… later

Application to M|M|1 Queue - 2

Copyright ©2004 by K. Pattipati

33

• Utilization

U

• Average waiting time

1

11RW

• Average waiting queue length

)11

:(1

22

QQcheckXWQ

WW

QQ , Q

Q

1

Application to M|M|1 Queue - 3

Copyright ©2004 by K. Pattipati

34

2. M/M/∞ Queue nnn ,

0lim

0

01

1

shouldit as )!1(!

. Throughput

1

,...2,1,0;!

:result The

!1;

!

1

1

11

1

1001

nU

Q

RW

R

en

en

npX

CQ

nen

p

en

ppn

ppn

p

n

W

n

n

n

n

nn

n

n

n

n

n

n

nn

nnn

POISSON DISTRIBUTION WITH MEAN

Application to M|M| Queue

Results valid for M|G| queue

Copyright ©2004 by K. Pattipati

35

1. M/M/m Queue

1

1

00

0

1

00n

0

0

1

00

1

01

1

1

!!

1p !!

, 1 From

!

0!

:Result

;.:For

1!

1

)1(1for

m

n

mn

m

n mn

mn

mn

n

mn

m

n

n

m

mn

nnn

nn

innn

m

mnp

mmnp

mnpmm

mnpn

p

mnpm

ppm

pmn

mnpn

pi

pmnpn

p

Application to M|M|m Queue -1

Copyright ©2004 by K. Pattipati

36

formula) second sErlang'or formula-C sErlang'or formuladelay s(Erlang'

;1

1!

0

m

p

m

p

mp

mpP mm

mn

mn

m

mnnQ

Application to M|M|m Queue - 2

Probability of Queuing, PQ

Average Number of Customers Waiting (not in service)

mP

Q

Ppnpp

mnnpQ

Q

W

Q

mn

n

m

n

n

m

nmnW

;1

)1()1(

p

-1

1

d

d.

! 2

m

00

00

Throughput

shouldit as ..!

2

010

1

11

mn

m

nnn

m

n

n

mnnn

nn

pppnn

pmpX

Copyright ©2004 by K. Pattipati

37

Average Waiting Time

1

1 QWPQ

W

Average Response Time ]1

1[11

QP

WR

Average Queue Length ]1

1[.

QP

RQ

Average number of busy servers

WQQ

An alternative expression for system length … a trick that will be useful

for state-dependent nodes of networks

1

)(

nn

pn

p

)()....1()(

nodedependent -State serverMulti

mmnm

mnnn

Application to M|M|m Queue - 3

1 bemust but 1 becan Note

m

Copyright ©2004 by K. Pattipati

38

Queue Length

1

11

1

11

1

1

1 )()()()( n

nm

n

nn

n

n

nn

m

np

m

np

n

np

n

npnpQ

1

1

1

1)(

)(1

)(n

m

n

pn

mnQ

mQ

or

1

1Q

for multi-server nodes

= 0 for single server nodes

1

1

1

)(

n

m

n

pnm useful for numerical computations

m ; Note: need p0, p1,…., pm-2 only

Utilization

mU

Application to M|M|m Queue - 4

Copyright ©2004 by K. Pattipati

39

Higher Moments of Queue Length

)1(

)(

)1(

)1(])[(

)1(

)41()](331[

1)(3

1

)1()1()1(

)1()21(

1)(2

11

]}[{1

)(

][

)1()11()(

2

3

3

3

2

23

2

2

2

2

1

0

0

11

011

11

1

nEQnEskewness

nEQnEk

QC

QQnEk

Qk

nEr

knE

nEr

k

pnr

kpnpnpnnE

n

n

rk

r

k

rk

r

nn

rk

rnn

k

nn

k

nn

kk

n

Higher Moments for M|M|1 Queue

Copyright ©2004 by K. Pattipati

40

Properties of Exponential and Geometric Distributions

Properties of the Poisson Process

Steady-state solutions to DTMC and CTMC

State Transition Rate Diagrams

Applications to M/M/1,M/M/1/N,M/M/m,M/M/∞,M/M/m/m Queues

Performance measures for M/M/1, M/M/∞, and M/M/m Queues

Summary of Lecture 3