Intro to Queueing Theory Little’s Law M/G/1 queue Conservation Law M/G/1 queue (Simon S. Lam) 1 1/31/2017 1
Little’s Law No assumptions – applicable to any system L ttle s Law No assumptions – applicable to any system whose arrivals and departures are observable Average population N 1 average delay delayi = = (average delay) x N i 1 = (throughput rate) (throughput rate) where N is number of departures where N is number of departures throughput rate N/ τ = where where is duration of experiment is duration of experiment τ τ average population (to be defined) (to be defined) 1/6/2017 M/G/1 queue (Simon S. Lam) 2 2
n ( t ) system n mber in Num Time t 1 1 τ τ average population l i ( ) ( ) d = 0 n t dt τ where is duration of the experiment p τ M/G/1 queue (Simon S. Lam) 3 3
Exercise - check Little’s Law for the following example g p 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: shown in the table: Job Job Arrival Time Arrival Time Departure Time Departure Time 1 0.5 4.5 2 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 12.0 13.0 (a) calculate throughput rate; ( ) g p (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) Verify that Little s Law is satisfied by the results in (a), (b), and (c). M/G/1 queue (Simon S. Lam) 4 4
Random variable with discrete values Random variable with discrete values Random variable X with discrete values x Random variable X with discrete values x 1 , x 2 , … , x m x x Let P i = probability [ X = x i ] for i = 1, 2, …, m = m x Its expected value (mean) is X P i i 1 1 i = = i m 2 2 = 2 2 2 2 Its second moment is I d i ( ( ) ) ≥ ≥ X X x P P X X i i 1 = i M/G/1 queue (Simon S. Lam) 5 5
Random Variable with continuous values Random variable with probability distribution X function (PDF), ( ), ( ) ( ) P[ [ ], ], 0 = ≤ ≥ F x X x x X X Its probability density function (pdf) is ( ) ( ) dF dF x x ( ) ( ) = X X f f x X dx = = 0 ∞ Its expected value is Its expected value is ( ) ( ) X X x f x f x dx x dx X Its second moment is ∞ 2 2 2 ( ) ( ) = ≥ X x f x dx X X 0 What if F X ( x ) is discontinuous? M/G/1 queue (Simon S. Lam) 6 6
Po sson arr val process at rate 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 L t X ( t ) b th b f i l i th ti interval ( s , s+t ). For any time s , ( ( ) k ) λ λ t t P[ ( , ) ] − λ 0, 0 t + = = ≥ ≥ X s s t k e k t ! k The above can be derived from the binomial distribution by dividing t into n small intervals and let n go to infinity: f − k n k n λ λ t t P[ P[ ( , ( , ) ) ] ] 1 1 0, 0, 0 0 + + = = − ≥ ≥ ≥ ≥ lim lim X s s X s s t t k k k k t t k n n →∞ n M/G/1 queue (Simon S. Lam) 7 7
Time between consecutive arrivals in a Poisson process has the exponential distribution process has the exponential distribution Consider the random variable T which is the time bet een c nsecutive arrivals between consecutive arrivals Probability distribution function of T is ( ) ( ) [ [ ] ] 1 1 [ [ ] ] = ≤ ≤ = − > > A t A t P T P T t t P T P T t t 1 [ [ ( , ( , ) ) 0] ] 1 − λ , , 0 t = − + = = − ≥ P X s s t e t Probability density function of T is ( ) dA t ( ) − λ 0 t = = λ ≥ a t e t dt dt memoryless property M/G/1 queue (Simon S. Lam) 8 8
T Topics i 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) ons r at on Law (M/G/ ) M/G/1 queue (Simon S. Lam) 1/31/2017 9 9
Single-Server Queue µ λ queue server (work conserving) (Note: For packets, service average service time, in seconds g , x time is transmission time) time is transmission time) service rate, in packets/second ( = 1/ ) µ µ x arrival rate, in packets/second λ utilization of server ρ Conservation of flow ( , unbounded buffer) w ( , f f ff ) λ < µ µ λ = ρµ λ ρ = = λ x µ µ 1/31/2017 10 M/G/1 queue (Simon S. Lam) 10
M/G/1 queue M/G/ queue Single server work-conserving – it does not idle when there is work also 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 A i l di t P i t rate λ jobs/second Service times of arrivals are x Service times of arrivals are x 1 , x 2 , …, x i … x x which are independent , identically distributed (with a general distribution) distributed (with a general distribution) Average service time is , average wait is W, x average delay is T = W + x average delay is T = W + x M/G/1 queue (Simon S. Lam) 11 11
Let be the unfinished work at time t ( ) U t ( ) ( ) U t x w 3 3 x w 2 2 1 1 1 2 2 x 2 2 2 x 2 x 1 2 3 time 0 1 2 3 1 2 3 4 5 arrivals and departures arrivals and departures 1/31/2017 M/G/1 queue (Simon S. Lam) 12 12
Derivation of W Time average of unfinished work is 1 τ = = ( ) ( ) U t dt U t dt U U τ 0 1 1 n n 2 x i and w i are x i and w i are = = + + x x x w x w τ i i i independent 2 1 1 = = i i 1 1 n 2 2 where = + × x x w = x w x w τ × i i i 2 i i i i For Poisson arrivals, the average wait is equal to from the Poisson arrivals see time U f m n rr m U average (PASTA) Theorem M/G/1 queue (Simon S. Lam) 13 13
Derivation of W (cont.) The average wait is 2 2 1 λ λ x x 2 = λ + = + λ = + ρ W x xW xW W 2 2 2 2 2 2 2 λ x (1 (1 ) ) − ρ = ρ = W W 2 Pollaczek-Khinchin (P-K) 2 2 λ λ mean value formula l f l x = W 2(1 ) − ρ 1/31/2017 M/G/1 queue (Simon S. Lam) 14 14
M/G/1 queue Markovian T General Poisson x Average delay is ρ ρ 0 0 1 0 1.0 2 λ x = + = + T x W x 2(1 ( ) ) − ρ ρ Also called Pollaczek-Khinchin (P-K) mean value formula ( ) f 1/31/2017 M/G/1 queue (Simon S. Lam) 15 15
Special Cases T decreases as λ i increases 1. Service times have an exponential distribution 10 λ → λ (M/M/1). We then have (M/M/1) W th h 10 10 µ → → µ 10 λ λ 2 2 2( ) = ρ = = x x µ 10 µ 2 2 2 2 (2)( ) ( ) λ λ λ λ ρ x x x = = = W T 2(1 ) 1 1 − ρ − ρ − ρ = + T T W W x ρ ρ + − ρ x x x x = + = x µ x x 1 1 1 1 − ρ − ρ 10 µ 0.1 x 1 ρ x = = ρ → ρ → 0 0 1.0 1 0 1 1 1 1 − ρ ρ − ρ λ ρ λ 1/31/2017 M/G/1 queue (Simon S. Lam) 16 16
2. Service times are constant (deterministic) 2 2 ( ) ( ) = x x M/D/1 2 ( ) λ ρ x x = = W 2(1 2(1 ) ) 2(1 2(1 ) ) − ρ ρ − ρ ρ ( 2 2 ) ρ ρ + − ρ x x = + = T x 2(1 2(1 ) ) 2(1 2(1 ) ) − ρ − ρ T decreases as λ (2 (2 ) 1 ) 1 ρ ρ − ρ ρ i increases = T 2(1 ) − ρ λ 1/31/2017 M/G/1 queue (Simon S. Lam) 17 17
Two Servers and Two Queues: 60 jobs/sec 100 jobs/sec 60 jobs/sec j 100 jobs/sec Single Higher Speed Server: 120 jobs/sec 200 jobs/sec 1/31/2017 M/G/1 queue (Simon S. Lam) 18 18
Delay performance of packet switching over circuit switching it hi i it it hi Consider how to share a 10 Gbps channel 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,000 sources 10 000 2. Packet switching: Packets from 10,000 sources queue to share the 10 Gbps channel queue to share the 10 Gbps channel Packet switching delay is 10 -4 of circuit switching delay sw tch ng delay Contribution of queueing theory! Contribution of queueing theory! 1/31/2017 M/G/1 queue (Simon S. Lam) 19 19
Residual life of a random variable x n n 2 / 2 area = duration = x residual x i i 1 1 life life = = i i Average residual life found by a random arrival = area/duration 1 2 1 2 x 1 1 1 6 2 1 2 2 2 x 2 2 x 2 2 x 2 x 5 2 x 2 1 2 3 2 4 2 2 time 0 random arrival random arrival M/G/1 queue (Simon S. Lam) 20 20
Recommend
More recommend