Queueing theory primer
Lecturer: Massimo Tornatore
Original material prepared by: Professor James S. Meditch Typesetter: Dr. Anpeng Huang Courtesy of: Prof. Biswanath Mukherjee
1
primer Lecturer: Massimo Tornatore Original material prepared by: - - PowerPoint PPT Presentation
Queueing theory primer Lecturer: Massimo Tornatore Original material prepared by: Professor James S. Meditch Typesetter: Dr. Anpeng Huang Courtesy of: Prof. Biswanath Mukherjee 1 A change of focus So far we have investigated static
Original material prepared by: Professor James S. Meditch Typesetter: Dr. Anpeng Huang Courtesy of: Prof. Biswanath Mukherjee
1
– Traffic requests are given and constant in time
theory, heuristics…
– Random or stochastic flow problems – The times at which the demands arrive are uncertain and also the size of the demands are unpredictable
2
– L. Kleinrock, Queueing Systems (Vol 1: Theory)
– L. Kleinrock, Queueing Systems (Vol. 2: Computer Applications)
3
– Arrivals (i.e., interarrival times) – Services (i.e., service times)
R C
If R>C, we expect congestion (intuitive) If R<C, there might still be congestion (why?)
4
5
n
n
1 n
*Note that these distributions do not depend by n (same distribution for all arrivals/services) 6
k
k
k
k
7
CDF pdf mean kth moment
k k s k k k x s t s st
* ) ( * ~ * ~ *
8
HP: (statistical equilibrium,
9
k k k N k N
z P z Q z E N N E k N P P k N P k F
) ( ] [ ] [ ] [ ] [ ) (
* ~
w s
* ~
s s
10
11
Er r-stage Erlangian G general Hr R-stage hyperexponential
12
13
14
15
16
q
The average number of customers in a queueing system is equal to the average arrival time of customers to that system, times the average time spent in that system
17
t) (0, interval the during system in the customers
no. avg. t) (0, during arrived who customers all
averaged customer per time system ) area! grey the (i.e, t time to up system in the spent have customers all time total sec)
) ( ) (
t t t
N T ds s N t
(t)
N(t) t) (0, in departures no. ) ( t) (0, in arrivals no. ) ( t t
18
N ) ( ) ( ) ( N can But we t) (0, in system in customers no. Avg. ) ( N t) (0, in customer per time system Avg. ers sec/custom ) ( ) ( t) (0, in rate arrival Avg. sec ) ( ) (
t t t t t t
T t t t t t t t t T customers t t t
19
q q s s q t t
t t
20
] ) ( in arrivals [ Pr , 1 , , ! ) ( ) ( 1 , , 1 ] ~ [ d, distribute lly exponentia t independen : times al Interarriv ,t k k e k t t P t t e t t P t
t k k t i
Pure birth system (see p. 60-63, 65,Vol. 1)
21
rate) (arrival intensity process t)
t 1 ] in arrival 1 Pr[ 1 ] in arrival Pr[ t)
t ] in arrival 1 Pr[ Δt Δt Δt
) ( ) ( ) ( ) ( ) ( ) ( ) ( ] 1 )[ ( ) (
1 1
t
t P t t P t P t t P t
t P t t P t t P
k k k k k k k
22
1 ) ( that note ) ( ) ( ) 2 ( ) ( ] 1 )[ ( ) ( , 2 , 1 ) ( ) ( ) ( ) 1 (
1
P t P dt t dP t
t P t t P k t P t P dt t dP
k k k
If I divide by «dt», I obtain: Similarly for P0: Solving the the first-order differential equation (2): then inserting P0(t) in (1) for k=1: then continuing by induction:
t
, , ! ) ( ) (
t k e k t t P
t k k
t
1
] ~ [ 1 ) ( ) !
distributi neg. exp. with (relation note Final * t t P e t P
t
23
2 2 1 ) 1 ( 1 ) 1 ( ) ( 2 ) (
1 1 ) s! (memoryles d distribute lly exponentia are times al Interarriv ) ( 1 ] ~ [ iv. ) , ( ] [ ) ( iii. ii. rate arrival avg. ) ( ) ( i.
t e t a e t t P A(t) t e t dz t z dQ e z E z t P Q(z,t) t t t kP t N
t t z z t z z t k t N k k t N k k
24
25
S1(t), S2(t) S3(t)…. are
random variables
X(t) is random process X(t,w) = Number of servers
busy at time t of realization w of the process= one realization of the process
Assumptions
= A (w)= A(w)
S1 S2 S3 S4 X(t) 4 3 2 1
´ ´ ´ ´ ´ ´ ´ ´
H
1
H
2
H
3
H
3
H
6
H
1
H
5
H
4
H
5
H
2
H
4
H
8
H
7
t H
7
H
3
H
4
H
7
H
6
H
5
H
6
H
7
H
8
H
8
t + t
26
is discrete (i.e., if X(t) can assume only discrete values) – Note: S = {0, 1, . . ., K} finite state S = {0, 1, . . .} infinite state (countable)
– Discrete-time
discrete instants in time
– Continuous-time
27
1 1 1 1 1 1
n n n n n n
28
1) It’s a chain since: 3) It’s a Markov Chain since: 2) It’s a discrete-time chain since the time («x-axis») is slotted
i (n) i ) ( 1 ) ( ) ( ) (
n n n n n i
j n ij n ij n n n n ij
) ( ) 1 ( ) 1 ( 1 ) 1 (
29
) ( ) 1 ( ) 1 ( ) (
n n
j ij ij n n ij ij n ij
1 ) (
30
) ( i ) ( i ) ( ) ( ) ( ) 1 ( ) (
i i n n n n n n
n
31
32
2 1 ) 1 ( ) 1 ( 2 ) 1 ( 1 ) 1 ( ) 1 ( 2 ) 1 ( 2 1 ) 1 ( 1 ) 1 ( ) ( si i i i n s n n n si n s i n i n i n n i
i-th column of P
33
Discrete-time birth-death (arrival-departure) process with no waiting room. P(1 arrival at any time n) = a P(1 departure at any time n) = d s = {0,1} π = [π0 π1]
34
1 1 1 ) 1 ( ) (
n n
35
1 1 1 1
36
37
1) It’s a chain since: 3) It’s a Markov Chain since: 2) It’s a continuos-time chain since the times t can assume any real value
] ) ( ) ( [ ] ) ( ..., , ) ( ) ( [ ... .
1 1 1 1 1 2 1 n n n n n n n n
i t X j t X P i t X i t X j t X P t t t t any and n all For Def
t1 t2 t3….. Finite or countable Real
t i i
i
38
39
t T e e e e t T t T t t T t T t t T t t T t t T
t t t t t
Pr 1 1 1 1 1 Pr Pr Pr Pr Pr Pr
Pr T t t 0 T t0
Pr T t
t
e t e
t t0
i each for t q j i t t t t p t q t t t t p t q matrix rate transition t I t P t Q t t t p t P s t i s X j t X P t s p
j ij ij ij ii ii ij ij
) ( ) , ( lim ) ( 1 ) , ( lim ) ( ) ( lim ) ( )] , ( [ ) ( ] ) ( ) ( [ ) , (
If these limits do not exist, we do not have a continuous-time Markov chain
Δt→0 Δt→0 Δt→0
40
t j j N j
ds s Q t t given t Q t dt t d N t t t t S j j t X P t
1
] ) ( exp[ ) ( ) ( 1 ) ( ) ( ) ( ) ( ) ( )], ( ... ) ( ) ( [ ) ( ] ) ( [ ) (
41
t Q ij ij ij ij ij
42
j j j
t→∞
43
to model queues in telecom equipment
– When a packet arrives (birth) – When a packet leaves (death)
– State k State k+1 (birth) – State k State k-1 (death)
– Packet arrive and depart at any time!
44
aka arrival-departure processes (1) Continuous-time Markov chain dealing with a population
L L S S k k t N P t P
k
} ..., , 1 , { ] ) ( [ ) (
(2) System state changes by at most one (up or down, or no change) in Δt
45
, , 1 , 1
j k k k k k k
(3) Births and deaths independent
– Follows from Markovianity
(4) Transitions
k k k k k k
46
10 1 00 , 1 1 , 1 1 ,
L k k k k k k k k k k k k
47
1 1 1 1 1 1
k k k k k k k k
48
*Similar derivation as seen in the Poisson process
1 1 1 1 1 1
k k k k k k k k
49
*Solving these equations is quite complex, so, in practice, the approach used is the one shown in the next slide (inspection over a state diagram)
k k k k k 1 1 1 1
k k k k
k 1 1 k 1 1
k k
k k k k k
Note: a simple «inspection» technique to find the same equations
50
1 1 1 1 k k
k k k k k k k k k
51
... , 1 , ) ( , sec / sec / k dt t dP t behavior Equilibrum jobs rate service jobs rate arrival
k k k
52
System Representation
1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1
k k i i i k i i i k k k k k k k k k k k k k k
53
1
k k k k k k
54 k k+1 k-1 1 2
1
k k k k k k k k
55
2 2 2 2 2 1
) 1 ( ) ( 1 ) 1 ( 1 1 ) ( ) 1 (
N k k N k k k k k k k k k k k k
p N k N d d d d d d k k k p k N
56
1 1 T T N
57
2
k k i i k i i q q
58
1 m
m k m m k k
k
Equivalently,
59
Use state-dependent birth-death model to determine
, k pk
3 2 3 1 3 2 1 2 1 2 1 1 1
3 ! 3 2 2 p p p p p p p p p
2 2 1 2 1 1 1 1
! ! ! p m m p p m m p p m p
m m m m m m
1 1 1 1 1 1
1 1 ) ( ) ( 1 1 1 1
m k m k m k m k
ρ m! mρ k! mρ /m ρ ρ /m ρ m! ρ k! ρ p m k p m m m k p k m p
k m k k
! ! ) (
60
m k p m m m k p k mp p
k m k k
! ! ) (
1
1 1 ) ( ) ( 1
m k m k
ρ m! mρ k! mρ p
m k k
p queueing p ] [ ) 1 ( ! ) ( ] [ p m m m p
m
m N p N p m N
s m q m
1 1 1
s q
N x N W N T
Where
m
p
61
62
M/G/1 Queue Poisson arrival process: customers/sec General service process:
k
x x x B , ), (
queueing discipline is FCFS
) 1 ( 2 ) 1 ( 2 1 ] [ ] [
2 2 2 2 2
x N W x N W x T x W x x E x x E x
63
Ex.
sec 33 . 6 33 . 4 2 53 . 2 ) 3 13 ( 4 . 8 . sec 33 . 4 3 13 ) 2 . ( 2 ) 3 13 )( 4 . ( ) 1 ( 2 8 . ) 2 )( 4 . ( sec 3 13 2 1 sec 2 sec / 4 .
2 2 3 1 2 2
T W x T N W N W x W x dx x x x cust
64
a.
z s sx k k k k
s B z B where z z B z z B z Q dx e x b x b L s B z Q Z p z p z Q
| ) ( ) ( ) ( ) 1 )( 1 ( ) ( ) ( ) ( )] ( [ ) ( )] ( [ , ) (
* * * * * 1
b.
) (y w
)], ( [ ) ( ) ( ) 1 ( ) ( )] ( [ ) (
* 1 * * *
y s W L y w s B s s s W y w L s W ) (y s
)] ( [ ) ( ) ( ) ( ) 1 ( ) ( )] ( [ ) (
* 1 * * *
s S L y s s B s B s s s S y s L s S
65
y
e y s s s s s s s s s s s S
) ( 2 *
) ( ) ( ) 1 ( ) ( ) 1 ( ) /( ) 1 ( ) (
66
n
q
n
C
n
v
n
x
,... 1 , , 1
1 1 1
n q q v q v q q
n n n n n n n
) 1 /( ) 1 ( ) ( ) ( R W R W W R W x R W R x W R W
Residual work (residual life time)
67
Residual Life - R x z Random Arrival Service process: b x
x x ( ), ,
2
F x P Z x
Z ( )
[ | system busy at time of arrival] r = E[Z | system busy] Intuition: r = x 2 ? Wrong!
68
Chances are higher that x arrives during longer periods
f x density fn. for length of service period during which arrival occurs, given system busy f x x) Kx b(x) (x) f (x) d(x) K x b(x) dx = kx = 1, K = 1 x f (x) = x b(x) x r = x 2 x b(x) x d(x) = x 2x
Z Z Z Z 2
( ) ( ) (
Residual Life - Cont’d
69
R = E[Z | system busy] E[system busy] = x x . x = 1 2 x W = 1 2 x x
2 2 2 2
2 1 2 1 ( ) ( )
Markovian queueing Networks
Residual Life - Cont’d
70
1 3 4 2
r
11
r
12
r21 r31 r32 r22 r23 r44 r43 r34 1 1
43 44
( ) r r 1
31 32 34
( ) r r r 3
1. Open Networks N nodes Each node – single queue, servers Exponential service time
mi xi
i
1 sec
71
to node ]
the network]
nodes (including itself)
i rij
i
j
1
1
r
ij j N
i
i
i
rii r i
1
r i
2
rNi
i
i
1 2 i N
i i j ji j N
r
1
Flow Equations: = [
1 2 N
....... ] [ ....... ] [ ]
1 2 N ji
R r R
72
Jackson’s theorem (1957)
Let p(k k k p[k jobs at node 1, k jobs at node 2, ....., k jobs at node N] and p k p[k jobs at node i] Then p(k k k p k p k p k Each node in the network can be treated as an M / M / m queue, m 1
1 2 N 1 2 N i i i 1 2 N 1 1 2 2 N N i i
, ....., ) ( ) , ....., ) ( ) ( )........... ( )
73
1 2 N-1 N
……………
N = Ni
i=1 N
=
i i=1 N
T = N
74
Example:
1 2 3
r
12
r23
I/O I/O CPU
r
11
r22 r
11
02 . r
12
08 . r22 04 . r23 06 . 1 01
1
. sec 1 005
2
. sec 1 09
3
. sec 1 job / sec
75
Node 1
1 11 1 1 1 1 1 1 1 1
1 02 125 0125 1 01429 r . . . . N1
Node 2
2 12 1 22 2 2 2 2 2 2 2 2
08 125 04 16667 00833 1 00909 r r . ( . ) . . . . N2
Node 2
3 22 2 3 3 3 3 3
06 16667 1 09 1 09 9 2338 9 23 r . ( . ) . . . . sec N N = N + N + N T = N
3 1 2 3
76
1 4 3 2
r
12
r21 r
14
r42 r22 r23 r33 r43
N nodes; K jobs circulating through the network No external arrivals or departures Each node – single queue, servers Exponential service time
mi xi
i
1 sec r24 r32
i ij N
r
1
1 2
for each i K K R = [r (flow vector) R
j=1 N i i=1 N ij]
[ .......... ]
77
Gorjon and Newell (1967)
p(k k k 1 G(K) x k {x satisfy x x i = 1,2,....., N G(K) = x k with k = (k ,k ,.......,k ) and A = set of all k vectors for which k + k +.....+k = k (3) k k
1 2 N i k i i i i i j i k i i k 1 2 N 1 2 N i i
i i
, ....., ) ( ) ( ) } ( ) ( ) ( )
i N j ji j N i N A
where r
1 1 1
1 2
i i i i i k m i i i i i
, k m m m , k m Utilization at node i: x m i = 1,2, ..... , N
i i
! !
78
Example: (Application-interactive computing) Multi-Processor
Node 1 Nodes 2,3, …….N K terminals k jobs
N = avg. "think" time at each terminal (exp. distribution think times) T = K seconds T = avg. responce time
1
79
k k
1 k 1 k
k k
k 2 1 2 1
1 P subject to P P to leads This
k k k
P P P P P
80