Queueing Theory
Queueing Theory
Queueing Theory
Kuo-Hao Chang
Dept. of Industrial Engineering and Engineering
Management
National Tsing Hua University
The basic queueing process
1 / 60
2. Queue (customers wait before being served)
2 / 60
An Elementary Queueing Process
Most models assume that all interarrival times are i.i.d and
that all service times are i.i.d
where
M = exponential distribution (Markovian)
D = degenerate distribution (constant times)
Ek = Erlang distribution (shape parameter = k)
G = general distribution (any arbitrary distribution)
3 / 60
Example:
M/M/K
(1) both interarrival times and service times have an
exponential distribution
(2) # of servers = s
M/G/1
(1) interarrival times have an exponential distribution and
service times have general distribution
(2) # of servers = 1
4 / 60
Terminology and Notation
state of system = number of customers in queueing system.
queue length = number of customers waiting for service to begin.
= state of system minus numbers of customers being
served.
N (t) = number of customers in queueing system at time
t (t ≥ 0).
Pn (t) = probability of exactly n customers in queueing
system at time t, given number at time 0.
s = numbers of servers (parallel service channels)
in queueing system.
5 / 60
λn = mean arrival rate when n customers are in system.
µn = mean service rate for overall system when n
customers are in system.
λ, µ, ρ = see the following paragraph.
6 / 60
If λn is constant for all n, λn = λ and if the mean service rate
per busy server is a constant for all n, µn = µ, So λ1 and µ1 are
the expected interarrival time and expected service time.
λ
ρ = sµ is the utilization factor for the service facility
7 / 60
In a steady-state condition, we use the following notation
Pn = probability of exactly n customers in queueing system
L = expected number of customers in queueing system
X∞
= nPn
n=0
Lq = expected queue length (excludes customers being served)
X∞
= (n − s)Pn
n=s
W = waiting time in system (includes service time) for each
individual customer
8 / 60
W = E(W).
Wq = waiting time in queue (excludes service time) for each
individual customer.
Wq = E(Wq ).
Relationships between L, W , Lq , and Wq
1. Assume λn = λ, we have Little’s formula
L = λW
Lq = λWq
If the λn are not equal, λ can be replaced by λ, the average
arrival rate over the long run.
1
2. Assume the mean service time is constant, µ, for n ≥ 1.
We have
1
W = Wq +
µ
9 / 60
Exponential Distribution
T (interarrival or service times) ∼ Exp(α), α ≥ 0
αe−αT t ≥ 0
fT (t) =
0 t<0
Pr{T ≤ t} = 1 − e−αt ⇒ Pr{T > t} = e−αt (t ≥ 0)
E(T ) = α1 , Var(T ) = 1
α2
Some properties about Exponential Distribution
1. fT (t) is a strictly decreasing function of t (t ≥ 0)
10 / 60
So Pr{0 ≤ T ≤ ∆t} > Pr{t ≤ T ≤ t + ∆t} for ∆t, t > 0
Is it reasonable to use exponential distribution to modal
service and interarrival times?
2. Lack of memory, i.e.,
Pr{T > t + ∆t | T > t} = Pr{T > ∆t}
i.e., the probability distribution of the remaining time until
the event(arrival or service completion)occurs always is the
same, regardless of how much time (∆t) already has passed.
Pr{T > t, T > t + ∆t}
Pr{T > t + ∆t | T > t} =
Pr{T > t}
e−α(t+∆t)
=
e−αt
= e(−α∆t)
= Pr{T > ∆t}
11 / 60
If interarrival times are exponentially-distributed, the time
until the next arrival is completely uninfluenced by when
the last arrival occurred.
3. The minimum of several independent exponential r.v.’s has
an exponential distribution.
i.i.d.
Let T1 , T2 , . . . , Tn ∼ Exp with α1 , α2 , . . . , αn
U = min{T1 , T2 , . . . , Tn }
Pr{U > t} = Pr{T1 > t, T2 > t, . . . , Tn > t}
= Pr{T1 > t} Pr{T2 > t} · · · Pr{Tn > t}
n
!
X
= exp − αi t
i=1
12 / 60
So U ∼ Exp( ni=1 αi )
P
13 / 60
5. For all t > 0, Pr{T ≤ t + ∆t|T > t} ≈ α∆t, for small ∆t
14 / 60
6. Unaffected by aggregation or disaggregationP
Poi (λ1 ) + Poi (λ2 ) +· · · + Poi (λn ) ∼ Poi( ni=1 λi )
birth → arrival
death → departure
N (t): the number of customers in the queueing system at time t
15 / 60
Assumption 1.
Given N (t) = n, the current probability distribution of the
remaining time until the next birth (arrival) is exponential with
parameter λn (n = 0, 1, 2 . . .).
Assumption 2.
Given N (t) = n, the current probability distribution of the
remaining time until the next death (service completion) is
exponential with parameter µn (n = 0, 1, 2 . . .).
Assumption 3.
The remaining time until the next birth and the remaining time
until the next death are mutually independent.
16 / 60
When there are n customers in the system, let λn and µn
respectively represent the mean arrival rate and the mean rate
of service completions.
17 / 60
Let
En (t)
lim : mean rate at which process enters state n
t→∞ t
Ln (t)
lim : mean rate at which process leaves state n
t→∞ t
18 / 60
Rate In = Rate Out
For any state of the system n (n = 0, 1, 2, . . .),
mean entering rate = mean leaving rate
Balance equations
State Rate In = Rate Out
0 µ1 P 1 = λ 0 P 0
1 λ0 P0 + µ2 P2 = (λ1 + µ1 )P1
2 λ1 P1 + µ3 P3 = (λ2 + µ2 )P2
.. ..
. .
n−1 λn−2 Pn−2 + µn Pn = (λn−1 + µn−1 )Pn−1
n λn−1 Pn−1 + µn+1 Pn+1 = (λn + µn )Pn
λn−2 ···λ0 simplif y
⇒ Pn = λµn−1
n µn−1 ···µ1
P0 = Cn P0 , for n = 1, 2, . . .
Let C0 = 1
19 / 60
where Pn is proportion of time that the system is in state n
∞ ∞
! ∞
!−1
X X X
Pn = 1 ⇒ Cn P0 = 1 ⇒ P0 = Cn
n=0 n=0 n=0
20 / 60
Note:
These are steady-state results under the assumption that the λn
and µn have values such that the process actually can reach a
λ
steady-state condition. This assumption holds when ρ = sµ <1
P∞
for the case of M/M/s. It does not hold when n=1 Cn = ∞.
21 / 60
µn = nµ when n ≤ s
µn = sµ when n ≥ s
22 / 60
where !−1
∞ −1
X
n 1
P0 = ρ = =1−ρ
1−ρ
n=0
Thus,
Pn = (1 − ρ)ρn , for n = 0, 1, 2, . . .
Consequently,
∞ ∞
X X d n
L= n(1 − ρ)ρn = (1 − ρ)ρ (ρ )
dρ
n=0 n=0
∞
!
d X
n d 1
= (1 − ρ)ρ ρ = (1 − ρ)ρ
dρ dρ 1 − ρ
n=0
ρ λ
= =
1−ρ µ−λ
23 / 60
Similarly,
∞
X λ2
Lq = (n − 1)Pn = L − 1(1 − P0 ) =
µ(µ − λ)
n=1
24 / 60
Pr{W > t} = ∞ −µ(1−ρ)t , t ≥ 0
P
n=0 Pn Pr{Sn+1 > t} = e
(PASTA, also see ex.17.6-17), i.e., W have an exponential
distribution with parameter µ(1 − ρ)
Therefore,
1 1
W = E(W) = =
µ(1 − ρ) µ−λ
Let Wq be the waiting time in the queue
Pr{Wq = 0} = P0 = 1 − ρ
X∞
Pr{Wq > t} = Pn Pr{Sn > t}
n=1
X∞
= (1 − ρ)ρn Pr{Sn > t}
n=1
25 / 60
∞
X
=ρ Pn Pr{Sn+1 > t}
n=0
= ρ Pr{W > t}
= ρe−µ(1−ρ)t , for t ≥ 0.
Pr{Wq > t}
Pr{Wq > t|Wq > 0} = = e−µ(1−ρ)t , for t ≥ 0
Pr{Wq > 0}
λ
Wq = E(Wq ) =
µ(µ − λ)
26 / 60
Results for the Multiple Server Case (s > 1)
(λ/µ)n for n = 1, 2, . . . , s
n!
Cn = (λ/µ)s
λ
n−s
(λ/µ)n
s! sµ = n−s for n = s, s + 1, . . .
s!s
s−1 ∞
" #
(λ/µ)s X λ n−s
(λ/µ)n
X
P0 = 1/ 1 + +
n! s! n=s sµ
n=1
" s−1 #
X (λ/µ)n (λ/µ)s 1
= 1/ +
n! s! 1 − λ/(sµ)
n=0
27 / 60
These Cn factors also give
(λ/µ)n
(
n! P0 if 0 ≤ n ≤ s
Pn = (λ/µ)n
P
s!sn−s 0
if n ≥ s
Furthermore,
P0 (λ/µ)s ρ
Lq =
s!(1 − ρ)2
Lq
Wq =
λ
1
W = Wq +
µ
1 λ
L = λ(Wq + ) = Lq +
µ µ
28 / 60
29 / 60
h i
P0 (λ/µ)s 1−e−µt(s−1−λ/µ)
Pr{W > t} = e−µt 1 + s!(1−ρ) s−1−λ/µ
30 / 60
With one hour as the unit of time,
1/λ = 1/2 hour per customer ⇒ λ = 2/hr
1/µ = 1/3 hour per customer ⇒ µ = 3/hr
2
λ 3 if there is only one doctor.
ρ= = 2
sµ 2·3 if there are two doctors.
Since ρ < 1, the system should approach a steady-state
condition.
31 / 60
32 / 60
The M/M/s/K model
Finite queue: # of customers in the system cannot exceed K
(so the queue capacity is K − s).
λ for n = 0, 1, 2, . . . , K − 1
λn =
0 for n ≥ K
Because λn = 0 for some n, eventually the system will reach a
steady-state condition even when λ ≥ µ.
33 / 60
1−ρ
P0 =
1 − ρK+1
1−ρ n
Pn = ρ , for n = 0, 1, 2 . . . , K
1 − ρK+1
ρ (K + 1)ρK+1
L= −
1−ρ 1 − ρK+1
Lq = L − (1 − P0 )
Note:
(1) These results do not require λ < µ. When ρ < 1 (i.e.
ρ
λ < µ), L → 1−ρ as K → ∞ (so M/M/1/K → M/M/1 as
K → ∞).
(2) No simple expressions are obtained for the waiting time
distribution.
34 / 60
(4) The expected waiting times for customers entering the
system still follow
L Lq
W = , Wq =
λ λ
where
∞
X K−1
X
λ= λ n Pn = λPn = λ(1 − PK ).
n=0 n=0
36 / 60
The Finite Calling Population Variation of the M/M/s
Model
Assume the input source is limited, i.e. the size of the calling
population, denoted by N , is finite.
For example, machine repair problem (only N machines in
total)
Note:
(1) each member of the calling population alternates between
being inside and outside the queueing system
(2) when n of the members are inside, N − n members are
outside
37 / 60
(4) the probability distribution of the remaining time until the
next arrival to the queueing system is the distribution of
the minimum of the remaining outside times for the latter
N − n members. This distribution must be exponential
with parameters λn = (N − n)λ
(5) λn = 0 for n = N , the system will eventually reach a
steady-state condition
( n n
λ N! λ
N (N − 1) · · · (N − n + 1) µ = (N −n)! µ for n ≤ N
Cn =
0 for n > N
N n
X N! λ
P0 = 1/
(N − n)! µ
n=0
38 / 60
n
N! λ
Pn = P0 , if n = 1, 2, . . . , N
(N − n)! µ
N
X λ+µ
Lq = (n − 1)Pn = N − (1 − P0 )
λ
n=1
µ
L=N− (1 − P0 )
λ
L Lq
W = , Wq =
λ λ
where
∞
X N
X
λ= λ n Pn = (N − n)λPn = λ(N − L)
n=0 n=0
40 / 60
Assume ρ = µλ < 1 and the mean and variance of service time
are µ1 and σ 2 .
P0 = 1 − ρ
λ2 σ 2 + ρ2
Lq =
2(1 − ρ)
L = ρ + Lq
Lq
Wq =
λ
1
W = Wq +
µ
Lq is referred to as the Pollaczek-Khintchine formula
41 / 60
Note:
(1) For fixed µ, Lq , L, Wq and W ↑ as σ 2 ↑
1
(2) When the service-time distribution is exponential, σ 2 = µ2
,
and M/G/1 ⇒ M/M/1.
42 / 60
The M/Ek /s Model
M/D/s ⇒ σ 2 = 0, M/M/s ⇒ σ 2 = µ12
M/Ek /s is in between ⇒ 0 < σ 2 < µ12
Assume the service-time distribution is the Erlang
distribution
43 / 60
Mean = µ1 , standard deviation = √1k µ1
Here k (shape parameter) is the parameter that specifies the
degree of variability of the service times relative to the mean.
44 / 60
Then,
T = T1 + T2 + · · · + Tk ∼ Erlang(µ, k)
46 / 60
When s = 2
47 / 60
Priority-Discipline Queueing Models
Customers are served in the order of their priority classes, but
on a first-come-first-served basis within each priority class.
Two possible cases:
1. Nonpreemptive: a customer being served cannot be ejected
back into the queue if the high-priority customer enters the
queueing system.
2. Preemptive: the lowest-priority customer being served is
preempted whenever a higher-priority customer enters the
queueing system.
Assuming a Poisson input process and exponential service
times, results for the nonpreemptive and preemptive priorities
model are given in the text (pp.799-801).
48 / 60
Note that
I No need to worry about defining the point at which service
begins when a preempted customer returns to service
(why?).
I For both models, if the distinction between customers in
different priority classes were ignored, it is essentially
identical to the M/M/s model.
I E(W) and E(Wq ) are the same as M/M/s but Var(W) and
Var(Wq ) are way larger (why?)
49 / 60
Queueing Networks
Networks of service of facilities where customers must receive
service at some of or all these facilities.
Equivalence property: Assume that a service facility with s
servers and an infinite queue has a Poisson input with
parameter λ and the same exponential service-time distribution
with parameter µ for each servers (the M/M/s model), where
sµ > λ. Then the steady-state output of this service facility is
also a Poisson process with parameter λ.
50 / 60
Infinite Queues in Series
51 / 60
Jackson Networks
1. Named after James R. Jackson who first characterized the
network and showed the M/M/s model can be used for
analysis.
2. Same as the infinite queues in series, except the customers
visit the facilities in different orders.
3. For each facility, its arriving customer come from both
outside the system and the other facilities.
A Jackson network is a system of m service facilities where
facility i (i = 1, 2, . . . , m) has
(1) An infinite queue
(2) Customers arriving from outside the system according to a
Poisson input process with parameter ai
(3) si servers with an exponential service-time distribution with
parameter µi
52 / 60
A customer leaving facility i is routed next to facility
j (j = 1, 2, . . . , m) with probability Pij or departs the system
with probability
Xm
qi = 1 − Pij
j=1
where sj µj > λj
53 / 60
λi is the departure rate and the arrival rate for all customers
using facility i.
Example:
54 / 60
λ1 = 1+0.0λ0 + 0.1λ2 + 0.4λ3
λ2 = 4 + 0.6λ1 +0.0λ0 + 0.4λ3
λ3 = 3 + 0.3λ1 + 0.3λ2
⇒ λ1 = 5, λ2 = 10, λ3 = 7 21
55 / 60
1 1 n1
Pn1 = for facility 1
2 2
1/3 for n2 = 0
Pn2 = 1/3 for n2 = 1 for facility 2
1/3(1/2)n2 −1 for n2 ≥ 2
1 3 n3
Pn3 = for facility 3
4 4
∴ Pr{(N1 , N2 , N3 ) = (n1 , n2 , n3 )} = Pn1 Pn2 Pn3
56 / 60
An Example
The Acme Machine Shop has a tool crib to store tools required
by the shop mechanics. Two clerks run the tool crib. The clerks
hand out the tools as the mechanics arrive and request them.
The tools then are returned to the clerks when they are no
longer needed. There have been complaints from supervisors
that their mechanics have had to waste too much time waiting
to be served at the tool crib, so it appears as if there should be
more clerks. On the other hand, management is exerting
pressure to reduce overhead in the plant, and this reduction
would lead to fewer clerks. To resolve these conflicting
pressures, an OR study is being conducted to determine just
how many clerks the tool crib should have.
57 / 60
The tool crib constitutes a queueing system, with the clerks as
its servers and the mechanics as its customers. After gathering
some data on interarrival times and service times, the OR team
has concluded that the queueing model that fits this queueing
system best is the M/M/s model. The estimates of the mean
arrival rate λ and the mean service rate (per server) µ are
λ = 120 customers per hour
µ = 80 customers per hour
so the utilization factor for the two clerk is
λ 120
ρ= = = 0.75
sµ 2(80)
58 / 60
The total cost to the company of each tool crib clerk is about
$20 per hour, so Cs = $20. While a mechanic is busy, the value
to the company of his or her output averages about $48 per
hour, so Cw = $48. Therefore, the OR team now needs to find
the number of servers (tool crib clerks) s that will
59 / 60
It turns out s = 3 yields the minimum total cost (how can we
know that in general?)
60 / 60