1 Intro to Queueing Theory Little s Law M/G/1 queue Conservation Law 1/31/017 M/G/1 queue (Simon S. Lam) 1
Little s Law No assumptions applicable to any system whose arrivals and departures are observable Average population = (average delay) (throughput rate) average delay = 1 N delay N i1 = i where N is number of departures throughput rate = N/ τ τ where is duration of eperiment average population (to be defined) 1/6/017 M/G/1 queue (Simon S. Lam)
3 n(t) mber in system n Num Time t 1 τ average population = ntdt () )d τ where τ is duration of the eperiment 0 M/G/1 queue (Simon S. Lam) 3
4 Eercise - check Little s Law for the following eample Consider 6 jobs that have gone through a system during the time interval [0, 15], where time is in seconds, as shown in the table: Job Arrival Time Departure Time 1 0.5 4.5 1.5 3.0 3 6.0 11.0 4 7.0 14.0 5 8.5 10.0 For the time duration [0, 15]: 6 1.0 13.0 (a) calculate throughput rate; (b) plot number of jobs in the system as a function of time from 0 to 15 and calculate the average number over the duration [0, 15]; (c) calculate the average delay of the 6 jobs. Verify that Little's Law is satisfied by the results in (a), (b), and (c). M/G/1 queue (Simon S. Lam) 4
5 Random variable with discrete values Random variable X with discrete values 1,,, m Let P i = probability [X = i ] for i = 1,,, m Its epected value (mean) is X m = i = 1 i P i m Its second moment is X = P ( X ) i i i = 1 M/G/1 queue (Simon S. Lam) 5
6 Random Variable with continuous values Random variable X with probability distribution function (PDF), F ( ) = P[ X ], 0 X Its probability density function (pdf) is f X df X ( ) ( ) = d Its epected value is X = fx ( ) d 0 Its second moment is = X ( ) ( ) 0 X f d X What if F X () is discontinuous? M/G/1 queue (Simon S. Lam) 6
7 Poisson arrival process at rate λ It is a counting process with independent increments. Let X(s, s+t) be the number of arrivals in the time interval (s, s+t). For any time s, ( λtλ t ) k λt P[ X ( ss, + t) = k] = e k 0, t 0 k! The above can be derived from the binomial distribution by dividing t into n small intervals and let n go to infinity: n λt k λt n k P[ X ( s, s + t ) = k ] = lim 1 k 0, t 0 n k n n M/G/1 queue (Simon S. Lam) 7
8 Time between consecutive arrivals in a Poisson process has the eponential distribution Consider the random variable T which is the time between een consecutive arrivals Probability distribution function of T is At () = PT [ t ] = 1 PT [ > t ] t = 1 P [ X ( s, s+ t ) = 0] = 1 e λ, t 0 Probability density function of T is da() t t at () = = λe λ t 0 dt memoryless property M/G/1 queue (Simon S. Lam) 8
Topics Average delay of M/G/1 queue with FCFS (FIFO) scheduling Pollaczek-Khinchin formula motivation for packet switching Residual life of a random variable Conservation Law (M/G/1) 1/31/017 M/G/1 queue (Simon S. Lam) 9 9
10 Single-Server Queue λ μ μ λ ρ average service time, in seconds queue server (work conserving) service rate, in packets/second ( μ = 1/ ) arrival rate, in packets/second utilization of server (Note: For packets, service time is transmission time) Conservation of fflow ( λ < μ, unbounded buffer) λ = ρμ ρ = μ λ = λ 1/31/017 M/G/1 queue (Simon S. Lam) 10
11 M/G/1 queue Single server work-conserving it does not idle when there is work, also no overhead, i.e., it performs 1 second of work per second FCFS service Arrivals according to a Poisson process at rate λ jobs/second Service times of arrivals are 1,,, i which are independent, identically distributed (with a general distribution) Average service time is, average wait is W, average delay is T = W + M/G/1 queue (Simon S. Lam) 11
1 Ut () Let Ut () be the unfinished work at time t 0 w 3w3 1 1 1 1 3 1 3 1 3 4 5 arrivals and departures time 1/31/017 M/G/1 queue (Simon S. Lam) 1
13 Derivation of W Time average of unfinished work is U 1 τ = 0 τ Utdt () 1 = + n 1 = + w 1 n n τ i i wi i= 1 i= 1 where i and w i are independent i i i w = w τ i i i i For Poisson arrivals, the average wait is equal to U from the Poisson arrivals see time average (PASTA) Theorem M/G/1 queue (Simon S. Lam) 13
14 Derivation of W (cont.) The average wait is 1 λ λ = λ + = + λ = + ρ W W W W W W (1 ρ ) = λ λ = (1 ρ) Pollaczek-Khinchin (P-K) mean value formula 1/31/017 M/G/1 queue (Simon S. Lam) 14
M/G/1 queue Markovian T Poisson General Average delay is T = + W = + λ (1 ρ) 0 1.0 ρ Also called Pollaczek-Khinchin (P-K) mean value formula 1/31/017 M/G/1 queue (Simon S. Lam) 15 15
16 Special Cases 1. Service times have an eponential distribution (M/M/1). We then have = ( ) ()( ) ( ) W = λ = λ = ρ (1 ρ) 1 ρ 1 ρ T = W + ρ ρ + ρ = + = 1 ρ 1 ρ T decreases as λ increases λ 10λ μ 10μ ρ = μ λ = 10 10 μ λ T 10μ ρ 1 0.1 = = 1 ρ 1 ρ λ 0 10 1.0 ρ μ 1/31/017 M/G/1 queue (Simon S. Lam) 16
17. Service times are constant (deterministic) = ( ) W = λ ( ) = ρ (1 ρ ) (1 ρ ) M/D/1 T= ρ + = ( ρ+ ρ) (1 ρ ) (1 ρ ) T = ρ ( ρ ) 1 (1 ρ) λ T decreases as increases λ 1/31/017 M/G/1 queue (Simon S. Lam) 17
18 Two Servers and Two Queues: 60 jobs/sec 100 jobs/sec 60 jobs/sec 100 jobs/sec Single Higher Speed Server: 10 jobs/sec 00 jobs/sec 1/31/017 M/G/1 queue (Simon S. Lam) 18
19 Delay performance of packet switching over circuit it switching Consider how to share a 10 Gbps channel 1. Circuit switching : Divide 10 Gbps of bandwidth into 10,000 channels of 1 Mbps each and allocate them to 10,000000 sources. Packet switching: Packets from 10,000 sources queue to share the 10 Gbps channel Packet switching delay is 10-4 of circuit switching delay Contribution of queueing theory! 1/31/017 M/G/1 queue (Simon S. Lam) 19
0 Residual life of a random variable residual life n i= 1 area = i / duration = n i= 1 Average residual life found by a random arrival = area/duration i 1 1 1 1 3 1 4 0 random arrival 1 5 1 6 time M/G/1 queue (Simon S. Lam) 0
1 Mean residual life for eamples Recall that the eponential distribution is memoryless X X mean residual life = X Eample 1: X is a constant X = ( X ) mean residual life = X / Eample : X is eponentially distributed with density function f ( ) = μe μ f X X = 1/ μ and X = / μ mean residual life = X = 1/ μ M/G/1 queue (Simon S. Lam) 1
Conservation Law 1/31/017 M/G/1 queue (Simon S. Lam)
3 For a work conserving server, work gets done at one second per second. U(t) depends on the arrivals only. U(t) () is independent of order of service Ut () 0 w w 3 3 1 1 1 1 3 1 3 1 3 4 5 arrivals and departures (FCFS) time M/G/1 queue (Simon S. Lam) 3
4 R classes of packets with arrival rates, mean service times, and second moments, Define 1 λ1, λ,..., λr 1,,...,, R 1,,..., R ρr = λr r for r = 1,,..., R ρ = ρ + ρ +... + ρ R U S λ λ λ λ = = = = = R R R r r r r r ρr ρ r= 1 r r= 1 r= 1 λ where U is mean residual service, ρ is the fraction of time a class r packet is S r r in service, and is ave. residual service of the class r pac ket found by arrival r M/G/1 queue (Simon S. Lam) 4
5 M/G/1 Conservation Law Non-preemptive, work-conserving server Let W r be the average wait of class r packets, r = 1,,, R Let N qr, be the average number of class r packets in queue The time average of unfinished work, Ut ( ), is R R R U = U + N = U + λw = U + ρ W S q, r r S r r r S r r r= 1 r= 1 r= 1 We already have from P-K formula (for ρ<1) λ ρ 1 U S U = W FCFS = = = (1 ρ) (1 ρ) 1 ρ M/G/1 queue (Simon S. Lam) 5
6 M/G/1 Conservation Law (cont.) R U S Therefore, U + ρw = for ρ < 1 ρ S r r r = 1 1 R U S ρ U S ρrw = r US ρwfcfs = = r= 1 1 ρ 1 ρ which is the Conservation Law. It holds for any non-preemptive work-conserving queueing discipline Any preferential treatment for one class/customer is afforded at the epense of other classes/customers M/G/1 queue (Simon S. Lam) 6
7 The end M/G/1 queue (Simon S. Lam) 7