Lecure 4 Noes (Lile s Theorem) This lecure concerns one of he mos imporan (and simples) heorems in Queuing Theory, Lile s Theorem. More informaion can be found in he course book, Bersekas & Gallagher, secion 3.2 (noe ha here are some minor errors and noaional inconsisencies in heir version) and in Kleinrock I, secion 2.. Lile s Theorem is, in some ways, obvious. Firs we will inroduce he heorem in a handwaving manner and hen make he deails of he definiion more precise. Lile s Theorem saes: N = λt () Where N is he average number of cusomers in a queue, T is he average ime a cusomer spends queuing and λ is he average rae of arrivals o he queue. In many ways his heorem represens an obvious ruh if a lo of people are in a queue (N is large) hen hey will have long delays (T is large); if few people arrive in a queue (λ is small) hen he average number of people in he queue is small (N is small). This lecure will be spen making his inuiive idea more rigorous. Le us firs make precise he definiions of N, λ and T and hen make clear he assumpions on which he heorem ress. Le us firs make some definiions: N(τ) is he number of cusomers in he sysem a ime τ. α(τ) is he number of cusomers who arrived in he inerval [, τ]. β(τ) is he number of cusomers who have depared in he inerval [, τ]. i is he ime a which he ih cusomer arrived. T (i) is he ime spen queuing by he ih cusomer. If N is he mean value of N(τ) aken over he inerval [, ] hen i is clear ha: N = N(τ)dτ (2) Le us assume: N = lim N (3) (Noe ha his limi is no guaraneed o exis imagine, for example, a queue which keeps growing.) If he limi exiss, N is he seady sae ime average of N(τ). We nex define he average arrival rae over he ime period [, ]. λ = α() and, again, we assume ha he following limi exiss: (4) λ = lim λ (5) Finally, he average delay experienced by hose cusomers who ener he sysem a imes in [, ] is given by: T = α() i= T (i) α() (6)
And, for a hird ime, we assume ha he following limi exiss: T = lim T (7) Lile s Theorem Proof assuming FIFO 8 7 6 5 arrivals α(τ) deparures β(τ) 4 3 2 T () α(τ) T (2) β(τ) N(τ) ime τ 2 3 4 5 6 7 8 Figure : Lile s Theorem in a FIFO Sysem A firs, we will prove Lile s Theorem wih he resricive condiions ha, in addiion o he limis above exising, he queue is empy a ime (N() = ), ha queuing is FIFO and ha he queue becomes empy infiniely ofen beyond any given ime τ. Figure shows a FIFO queue which is iniially empy. We noe ha a any ime τ: N(τ) = α(τ) β(τ) (8) I is clear ha if we choose a ime when he sysem again becomes empy hen we can calculae he area of he shaded area A(): A() = N(τ)dτ (9) 2
However, equally, we can consider he shaded area o be composed of horizonal srips of heigh and widh T (i) (for he ih cusomer). In his case, we have: Seing hese equaions equal and dividing each side by gives us: α() A() = T (i) () i= N(τ)dτ = α() i= T (i) = α() α() i= T (i) α() () Therefore we have: N = λ T (2) which, if we ake he limi as ( ) becomes Lile s Theorem as required. Noe ha some of he assumpions made here are, in fac, unnecessary as we shall see. In fac, Lile s Theorem only requires he following:. The limi λ = lim α()/ exiss 2. The limi δ = lim β()/ exiss 3. The limi T = lim T exiss 4. δ = λ Lile s Theorem Proof no assuming FIFO Figure 2 shows he siuaion if we don assume FIFO. Now, i is sill clear ha he shaded area in he inerval [, ] is given by: A() = N(τ)dτ (3) even hough, in he diagram, N(τ) is no longer necessarily a coninuous verical slice of he area (consider, for example, he siuaion a ime 4 in he diagram). Now, we define he following: D() is he se of cusomers who have depared he sysem by ime. D() is he se of cusomers who are sill in he sysem a ime. The delay experienced up o ime by a cusomer sill in he sysem a ime is i. Therefore we can say: A() = i D() T (i) + i D() ( i ) (4) 3
arrivals α(τ) 5 4 3 α(τ) 2 T (2) T () ime τ 2 3 4 5 Figure 2: Lile s Theorem in a non FIFO Sysem Therefore, equaing hese and dividing by we ge N(τ)dτ = i D() T (i) + i D() ( i ) (5) Up o ime, he average arrival rae λ is given by: λ = D() + D() (6) Up o ime, he average waiing ime T is given by he oal waiing ime of all he cusomers so far over he oal number of cusomers enering he sysem so far (up o ime ): T = i D() T (i) + i D() ( i) D() + D() (7) Subsiuing hese wo equaions and our previous equaion (2) ino (5) we herefore have: N = λ T (8) which, in he limi as gives us Lile s Theorem again. 4
Probabalisic Form of Lile s Theorem Throughou his secion we will assume ha all relevan sysems are ergodic. Le us define ha a a ime he probabiliy ha here are exacly n cusomers in he sysem is p n (). (Typically, in a probabalisic siuaion we would be given, or assume, he saring condiions he disribuion given by p n () for all n). From his, we can say ha he mean number of cusomers in he sysem a ime is given by: N() = np n () (9) n= Noe ha N() and p n () depend on boh and he iniial disribuion of p() = {p (), p (), p 2 ()... }. If we assume ha he sysem converges o some seady sae disribuion hen we have: lim p n() = p n n =,,... (2) And herefore we can say ha he average number of cusomers in he sysem is: N = Now, if we assume (as before) ha his converges o a limi, we have: np n (2) n= N = lim N() (22) Similarly, le us assume ha he average delay for he kh cusomer T (k) also converges as k o a seady sae value: T = lim T (k) (23) k Now, since we assumed ergodiciy, we can say ha he ime average of he number of cusomers N is (wih probabiliy ) equal o he seady sae sae-space average N: N = lim N = lim N() = N (24) Similarly, we can say ha he ime average of cusomer delay T is equal o he seady sae sae-space average T. T = lim k k k i= Lile s heorem hen holds wih λ given by: T (i) = lim T (k) = T (25) k λ = lim E{Arrivals in inerval [, ]} (26) 5
A Simple Example Using Lile s Theorem Take, as an example, he very simple model of an eherne sysem shown in figure. Assume ha he eherne can (as is ofen he case) only ransmi a single packe a a ime (oher packes o be sen mus queue). Oupu Queue Oupu packes (rae λ) Eherne ransmis packes Res of inerne Figure 3: A very simple view of an eherne sysem. Noe ha we can apply Lile s heorem wice even in his simple siuaion. Firs, if N Q is he average number of packes queuing o leave he sysem and W is he average ime a packe spends in he queue waiing o be ransmied hen we have: N Q = λw Now, assuming no packes are ever dropped a his poin (his would ypically be he case unless he sysem is misconfigured) and he mean ransmission ime aken for he packe along his secion of eherne is X hen we have: ρ = λx where ρ is he average number of packes on he ougoing eherne secion. Since, his mus be eiher zero or one a any given ime, ρ is also he uilisaion facor he proporion of he ime which we expec he line o be busy. Anoher Simple Lile s Theorem Example Consider a windowed flow conrol sysem such as TCP. A any given ime, a mos W packes (and ACKs) can be ousanding where W is he window size. Le us assume now ha W has reached some consan maximum (in TCP, users adverise a maximum window size) W m (his is he maximum size he window will reach if no packes are los). Since he number of packes under ransmission is less han or equal o W m we can say ha if packes depar a an average rae λ and, on average, have a round rip ime of T hen W m λt This gives us an insigh ino he flow-conrol behaviour of TCP since, i is obvious from his equaion ha if delay increases (T goes up) hen λ he sending rae will come down (or he window size will be decreased). 6
If he sysem is congesed hen λ canno increase (he sysem is ransmiing a is maximum rae). If no packes are los hen he window size W will become W m and W m λt Therefore, in a congesed sae, if packe loss does no ye occur, increasing he window size simply serves o increase delay wih no advanages o hroughpu which shows he reason for seing a maximum window size. 7