You are on page 1of 61

Chapter 17 Queueing Theory

Kuo-Hao Chang
Dept. of Industrial Engineering and Engineering
Management
National Tsing Hua University
The basic queueing process

1. Input source (or called population from which arrivals


come)
(1) Size: infinite or finite depending on the input source is
limited or unlimited
(2) Interarrival time: the time between consecutive arrivals
(3) Balking: the customers refuse to enter the system and is lost
if the queue is long

1 / 60
2. Queue (customers wait before being served)

3. Queue discipline (the order in which members of the queue


are selected for service) e.g. first-come-first-served (FCFS)

4. Service mechanism (one or more service facilities, each of


which contains one or more parallel service channels, called
servers).

5. Service time: the time elapsed from the commencement of


service to its completion for a customer at a service facility

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

Some notation for steady-state results


I Transient condition – the state of the system will be
greatly affected by the initial state and by the time that
has elapsed.
I Steady- state condition – after sufficient time has elapsed,
the state of the system becomes essentially independent of
the initial state and the elapsed time.

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

Also, it can be shown that


αj
Pr{Tj = U } = Pn , for j = 1, 2, . . . , n
i=1 αi

4. Relationship to Poisson distribution

# of occurrences by time t ∼ Poisson(αt)


Ti ∼ Exp(α)

13 / 60
5. For all t > 0, Pr{T ≤ t + ∆t|T > t} ≈ α∆t, for small ∆t

Proof: Pr{T ≤ t + ∆t|T > t} = Pr{T ≤ ∆t}


= 1 − e−α∆t , for t ≥ 0

x
X xn
(Note: e = 1 + x + ),
n!
n=2
Pr{T ≤ t + ∆t|T > t} = 1−1 + α∆t

X (−α∆t)n
− (≈ 0) ≈ α∆t,
n!
n=2
for small ∆t

14 / 60
6. Unaffected by aggregation or disaggregationP
Poi (λ1 ) + Poi (λ2 ) +· · · + Poi (λn ) ∼ Poi( ni=1 λi )

Birth and Death Process

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.

The birth-and-death process is a special type of continuous time


Markov chain.

17 / 60
Let

En (t) = # of times that process enters state n by time t


Ln (t) = # of times that process leaves state n by time t

En (t) Ln (t) 1
|En (t) − Ln (t)| ≤ 1 ⇒ − ≤
t t t

En (t) Ln (t)
⇒ lim − =0
t→∞ t t
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

Once Pn is obtained, we can calculate



X ∞
X
L= nPn , Lq = (n − s)Pn
n=0 n=s
L Lq
W = , Wq =
λ λ
where λ is the average arrival rate over the long run,

X
λ= λ n Pn
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 = ∞.

Queueing models based on the Birth-and-Death


Process
Assume Poisson input and exponential service times.
The M/M/s model – the special case of the birth-and-death
process

21 / 60
µn = nµ when n ≤ s
µn = sµ when n ≥ s

Results for the Single-Server Case (M/M/1)


 n
λ
Cn = = ρn , for n = 0, 1, 2, . . .
µ
Therefore,
Pn = ρn P0 , for n = 0, 1, 2, . . .

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 − ρ)ρ (ρ )

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

Assume λ < µ and the queue discipline is first-come-first-served


(FCFS)
i.i.d.
Let Ti ∼ Exp(µ) be service time and Sn+1 be the conditional
waiting time given n customers already in the system.
Sn+1 = T1 + T2 + . . . + Tn+1 , for n = 0, 1, 2 . . .
Let W be the waiting time in the system (including service
time)

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.

Note that Wq does not quite have an exponential distribution


(why?). However,

Pr{Wq > t}
Pr{Wq > t|Wq > 0} = = e−µ(1−ρ)t , for t ≥ 0
Pr{Wq > 0}

i.e., Wq |Wq > 0 is exponential. Using Wq = W − 1/µ,

λ
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

Consequently, if λ < sµ [so that ρ = λ/(sµ) < 1], then

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−λ/µ

Pr{Wq > t} = ( 1 − Pr{Wq = 0})e−sµ(1−ρ)t


where Pr{Wq = 0} = s−1
P
n=0 Pn .

The County Hospital Example


By analyzing the available, we have :
1. The emergency room is a M/M/s system.
2. The patient will arrive at an average rate of 1 every 1/2
hour.
3. A doctor requires an average of 20 min to treat each
patient.

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 λ ≥ µ.

Results for the Single-Server Case (M/M/1/K)


Assume ρ 6= 1
(  n
λ
µ = ρn for n = 0, 1, 2, . . . , K
Cn =
0 for n > K

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

Results for the Multiple-Server Case (s > 1)


Assume s ≤ K
 (λ/µ)n
 n!  n−s
 for n = 0, 1, 2, . . . , s
Cn = (λ/µ)s λ (λ/µ)n
 s! sµ = s!sn−s
for n = s, s + 1, . . . K

0 for n > K
35 / 60

(λ/µ)n
n! P0
for n = 0, 1, 2, . . . , s


Pn = (λ/µ)n
 P
for n = s, s + 1, . . . K
s!sn−s 0
 0 for n > K
" s K   #
X (λ/µ)n (λ/µ)s X λ n−s
P0 = 1/ +
n! s! sµ
n=0 n=s+1
P0 (λ/µ)s ρ
Lq = [1 − ρK−s − (K − s)ρK−s (1 − ρ)]
s!(1 − ρ)2
s−1 s−1
!
X X
L= nPn + Lq + s 1 − Pn
n=0 n=0
L Lq
W = , Wq =
λ λ
Erlang’s loss system: when K = s

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

Results for the Single-Server Case (s = 1)

(  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

Check the machine breakdown example in Chapter 16, N = 2,


λ = 1, and µ = 2 ⇒ P0 = 0.4, P1 = 0.4, P2 = 0.2.
39 / 60
Results for the Multiple-Server Case (s > 1) can see P.790 in
the text.

Queueing Models Involving Nonexponential


Distributions
exponential interarrival times ⇒ random arrivals
(1) This does not apply to the situations when the arrivals are
carefully scheduled or regulated.
(2) When the actual service-time distribution is not
exponential and there is only one server, we have

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.

The M/D/s Model


Assume all service times actually equal some fixed constant
(the degenerate service-time distribution)
So M/D/1 is a special case of M/G/1 where σ 2 = 0
ρ2 1
Lq = 2(1−ρ) = 2 · Lq (of M/M/1)
Insight: decreasing σ 2 can greatly improve the measures of
performance of a queueing system.

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

(µk)k k−1 −kµt


f (t) = t e , for t ≥ 0
(k − 1)!
µ, k need to be strictly positive and k needs to be integer.

(Note: Erlang distribution, except for the integer restriction


and the definition of the parameters, is identical to the gamma
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.

More about Erlang distribution


Suppose T1 , T2 , · · · , Tk are k independent r.v.’s with an
1
identical exponential distribution whose mean is kµ

44 / 60
Then,
T = T1 + T2 + · · · + Tk ∼ Erlang(µ, k)

Exponential distribution = Erlang (µ, 1)


Degenerate distribution = Erlang (µ, ∞)
45 / 60
Since M/Ek /1 is a special case of M/G/1 where service times
have an Erlang distribution with shape parameter = k
Applying the Pollaczek-Khintchine formula with σ 2 = kµ1 2
yields
λ2 /(kµ2 ) + ρ2 1+k λ2
Lq = =
2(1 − ρ) 2k µ(µ − λ)
1+k λ
Wq =
2k µ(µ − λ)
1
W = Wq +
µ
L = λW

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 λ.

Note: this property makes no assumption about the type of


queue discipline used.

50 / 60
Infinite Queues in Series

Product form solution


Pr{(N1 , N2 , · · · , Nm ) = (n1 , n2 , · · · , nm )} = Pn1 Pn2 · · · Pnm
(Amazing! No need to study the interactions between facilities)
Expected total waiting time = W1 + W2 + · · · + Wm
Expected number of customers in the entire system
= L1 + L2 + · · · + Lm

Note: The equivalence property only holds for the case of


infinite queues.

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

Any such network has the following key property.


Under steady-state conditions, each facility j (j = 1, 2, . . . , m)
in a Jackson network behaves as if it were an independent
M/M/s queueing system with arrival rate
m
X
λj = aj + λi Pij ,
i=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

Each of the three service facilities can be analyzed


independently by using the formulas for the M/M/s model.
For example, to obtain the distribution of the number of
customers Ni = ni at facility i, because

λi  1/2 for i = 1
ρi = = 1/2 for i = 2
si µi 
3/4 for i = 3

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

Similarly, we can obtain L1 = 1, L2 = 43 , L3 = 3

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

Minimize E(TC) = $20s + $48L.

59 / 60
It turns out s = 3 yields the minimum total cost (how can we
know that in general?)

60 / 60

You might also like