You are on page 1of 22

Expected Cost

Suppose that C is the unit cost associated with


time that a customer spends in the queueing
system. Let X(t) be the number of customers
in the system at time t. Then,

1
number of
customers
in the system
X(t)
3

2
x5
1 x2 x4 x6
x1 x3
τ0 τ1 τ2 τ3 τ4 τ5 τ6 time

T
n

 
average cost C xi(τi − τi−1)
  i=1
 per unit =
of time T

∫ T  
X(t) dt average number
 
=C 0 =C · of customers 
T in the system

Therefore we will use the following formula

2
   
expected cost expected number
   
 per unit of time  = C· of customers 
in system in the system

Similarly, let Q be the unit cost associated with


time that a customer spends waiting for ser-
vice (in queue). Then, we will calculate the
expected cost per unit of time that a customer
spends waiting for service (in queue) as follows:

   
expected cost expected number
   
 per unit of time  = Q· of customers 
in queue in queue

3
Birth-and-Death Queueing Systems
in Equilibrium

For the general birth-and-death process we ob-


tained the following differential equations

P0′ (t) = µ1P1(t) − λ0P0(t) (1)


and for all j = 1, 2, ...

Pj′ (t) = λj−1Pj−1(t) + µj+1Pj+1(t)


−(λj + µj )Pj (t) (2)
The time dependent solution of (1)-(2) quickly
becomes unmanageable when we consider any
sophisticated birth and death rates. Further-
more, even if we are capable of solving (1)-(2)
for Pi(t), it is not clear how useful that set of
functions is in aiding our understanding of the
behaviour of the corresponding queueing sys-
tem. So, the practical applications of queueing
theory are largely concerned with the statisti-
cal equilibrium properties of a system.
4
Assume the existence of limt→∞ Pi(t) for all
i = 0, 1, ..., and denote

pi = lim Pi(t).
t→∞
By virtue of (1)-(2), the existence of limt→∞ Pi(t)
for all i implies the existence of limt→∞ Pi′(t) for
all i. This in turn implies that for all i

lim Pi′(t) = 0,
t→∞
because any other value of limt→∞ Pi′(t) con-
tradicts the assumed existence of limt→∞ Pi(t).

Substituting into (1)-(2), we obtain

λ0p0 = µ1p1. (3)


and for all j ≥ 1

(λj + µj )pj = µj+1pj+1 + λj−1pj−1 (4)


For j = 1 equation (4) yields

(λ1 + µ1)p1 = µ2p2 + λ0p0,


5
which by virtue of (3) gives
λ1p1 = µ2p2. (5)
Similarly, for j = 2 equation (4) yields
(λ2 + µ2)p2 = µ3p3 + λ1p1,
which by virtue of (5) gives
λ2p2 = µ3p3.
Continuing in this way, we arrive at the set of
equations
λj pj = µj+1pj+1 for j = 0, 1, ... (6)
If µj+1 > 0 for j = 0, 1, ..., then (6) yields
λ0λ1 . . . λj−1
pj = p0 . (7)
µ1 µ2 . . . µ j
Let
λ0λ1 . . . λj−1
cj =
µ1µ2 . . . µj
Thus, the steady-state probabilities are
pj = cj p0 , for j = 1, 2, . . . ,

6
Since ∞

pj = 1,
j=0
we have ∞

p0 + cj p0 = 1
j=1
and
1
p0 = ∑∞ . (8)
1 + j=1 cj
Equations (3)-(4) are called the balance
equations. The balance equations can be in-
terpreted as stating that the rate at which the
system leaves state j equals the rate at which
the system enters state j.

Similarly, equations (6) can be interpreted as


stating that the rate at which the system leaves
state j for state j + 1 equals the rate at which
the system leaves state j + 1 for state j.

Equation (6) and equations (3)-(4) are state-


ments of conservation of flow.
7
The notation adopted in queueing theory con-
sists of the specification of three characteris-
tics of a queueing model:


interarrival service number of

time time servers
Thus, G|G|1 denotes a queueing system with
general interarrival time distribution, general
service time distribution and one server. An-
other example, D|G|2 denotes a queueing sys-
tem with deterministic arrivals (at regular in-
tervals), general service time distribution and
two servers. The notation M |M |1 is used for
the system having random arrivals, i.e. expo-
nentially distributed interarrival time, exponen-
tially distributed service time and one server.
Here the M stands for Markovian. A.A.Markov
published in 1907 a paper in which he intro-
duced a highly useful dependency among the
random variables forming a stochastic process.

8
M |M |1 model

We assume that
• customers arrive according to a Poisson
process, and therefore all interarrival times
are independent and identically distributed
exponential random variables
• all service times are independent and iden-
tically distributed exponential random vari-
ables
• there is only one server.
M |M |1 model is a special case of the birth-
and-death process, where for all j

λj = λ and µj = µ
Transition diagram:
λ λ λ λ λ

0 1 2 3 4
µ µ µ µ µ 9
We will use the following notation:
• L = expected number of customers in the
queueing system


L= npn
n=0

• Lq = expected number of customers in the


queue


Lq = (n − 1)pn,
n=1

• Ls = expected number of customers in ser-


vice
• W = expected waiting time in system (in-
cluding service time)
• Wq = expected waiting time in queue

10
Denote λ
ϱ=
µ
Then, for M |M |1 model
( )j
λ
pj = p0 = ϱj p0 for j = 0, 1, ...
µ
and if ϱ < 1, then
1 1
p0 = ∞

= ϱ = 1 − ϱ.
1+ ϱj 1+
1−ϱ
j=1
Let X be the number of customers in the sys-
tem. Consider the probability generating func-
tion

∑ ∞
∑ 1
g(z) = pj z j = ϱj p0z j = p0 .
j=0 j=0 1 − ϱz
Then,
p0 ϱ 2p0ϱ2
g ′(z) = and g ′′(z) = .
(1 − ϱz)2 (1 − ϱz)3

11
Taking into account that p0 = 1 − ϱ,
λ
′ ϱ µ λ
L = E[X] = g (1) = = = .
1−ϱ λ µ−λ
1−
µ
and
V ar[X] = g ′′(1) + g ′(1) − [g ′(1)]2
2ϱ2 ϱ ϱ2 ϱ
= + − =
(1 − ϱ)2 1 − ϱ (1 − ϱ)2 (1 − ϱ)2
The expected number of customers in the queue

∑ ∞
∑ ∞

Lq = (n − 1)pn = npn − pn
n=1 n=1 n=1
[ ( )]
λ λ λ
= − [1 − p0] = − 1− 1−
µ−λ µ−λ µ

λ2
= .
µ(µ − λ)
The expected number of customers in service

∑ λ
Ls = 0 · p0 + 1 · pn = 1 − p0 = ϱ = .
n=1 µ
12
Waiting Time Distribution

In our M |M |1 model we assume that the cus-


tomers are served according to the FIFO (first
in – first out) discipline.

Let Z be the customer’s waiting time in the


queue. This random variable has an interest-
ing property: it is part discrete and part con-
tinuous.
• If on arrival a customer finds no other cus-
tomers in the system, then this customer
enters service immediately upon arrival and
for the steady state
P (Z = 0) = p0 = 1 − ϱ.
• If on arrival a customer finds n other cus-
tomers present in the system, then
Z = Y1′ + Y2 + . . . + Yn
where Y1′ is the residual service time of the
customer being served and Y2, . . . , Yn are
service times of the n − 1 customers in the
queue.

13
By the no-memory property of the exponential
distribution, the residual service time Y1′ is ex-
ponentially distributed with parameter µ, and
therefore Z is the sum of n identically and inde-
pendently distributed exponential random vari-
1
ables each with mean . This means that Z
µ
has an n-Erlang distribution with density func-
tion
−µt (µt)n−1
f (t) = µe ,
(n − 1)!
and for the steady state and x > 0

P (Z ≤ x)
∞ ( )
∑ arrival found n

= P (Z = 0)+ P Z≤x ·pn
in system
n=1


∑ ∫ x
−µt (µt)n−1
= 1 − ϱ + (1 − ϱ) ϱn µe dt
n=1 0 (n − 1)!

14
∫ x ∞
∑ (µtϱ)n−1
= 1 − ϱ + (1 − ϱ)ϱ µe−µt dt
0 n=1 (n − 1)!
∫ x
=1−ϱ+ϱ µ(1 − ϱ)e−µ(1−ϱ)t dt
0

= 1 − ϱe−µ(1−ϱ)x
Hence, the cumulative distribution function of
Z is
P (Z ≤ x) = 1 − ϱe−µ(1−ϱ)x, x ≥ 0,
and consequently, the density function of Z is
f (x) = µ(1 − ϱ)ϱe−µ(1−ϱ)x
The expected waiting time in the queue is
∫ ∞
Wq = 0 · (1 − ϱ) + µ(1 − ϱ)ϱ xe−µ(1−ϱ)x dx
0

λ ∞ −(µ−λ)x λ
= x(µ − λ)e dx = ,
µ 0 µ(µ − λ)
which satisfies one of Little’s formulae
Lq = λWq .
15
Let R be the total time in the system, including
service. Then
∞ ( )
∑ arrival found n

P (R ≤ x) = P R≤x · pn
in system
n=1
∫ x
+(1−ϱ) µe−µtdt
0

∑ ∫ x
−µt (µt)n
= (1 − ϱ)ϱn µe dt
n=0 0 n!
∫ x ∞
∑ (µϱt)n
= (1−ϱ)µ e−µt dt
0 n=0 n!
∫ x ∫ x
= (1 − ϱ)µ e−µteµϱt dt = (µ − λ) e−µteλt dt
0 0
∫ x
= (µ−λ) e−(µ−λ)t dt = 1−e−(µ−λ)x.
0

16
Since
P (R ≤ x) = 1 − e−(µ−λ)x,
the amount of time a customer spends in the
system is exponential random variable with rate
µ − λ, and therefore
1
W = E[R] =
µ−λ
We have
1 λ 1
W − Wq = − =
µ − λ µ(µ − λ) µ

Alternatively, let Xs be the service time. Then,

R = Z + Xs,
and
1
W = E[R] = E[Z] + E[Xs] = Wq +
µ
λ 1 1
= + = .
µ(µ − λ) µ µ−λ
17
M |M |1|k Queueing System

The only difference between this model and


the M |M |1 model is that the maximum number
of customers in the system is k. Therefore, the
maximum queue length is k − 1. We assume
that once k customers are in the system, new
arrivals are not permitted to join the queue
and are forever lost to the system. From the
viewpoint of the birth-and-death process
{
λ for n = 0, 1, ...k − 1
λn =
0 for n ≥ k.
We have
{
λ )n = ϱn
(µ for n = 0, 1, ...k
cn =
0 for n > k.
∑k ∑k
Hence, n=0 ϱ p0 = n=0 pn = 1 and if ϱ ̸= 1
n

1 1−ϱ
p0 = ∑ k = .
n=0 ϱ
n 1−ϱ k+1

18
Consequently,


 1−ϱ n
ϱ if n = 0, 1, ...k
pn =
 1 − ϱk+1
 0 for n > k.
For M |M |1|k the expected number of customers
in queueing system is
k
∑ k
1−ϱ ∑ n
L= npn = nϱ
n=0 1 − ϱk+1
n=0

k
∑ k

1−ϱ n−1 = 1 − ϱ d n
= ϱ nϱ ϱ ϱ
1−ϱk+1
n=0 1−ϱ k+1
n=0 dϱ

k ( )
1−ϱ d ∑ n= 1−ϱ d 1 − ϱk+1
= ϱ ϱ ϱ
1 − ϱk+1 dϱ n=0 1 − ϱk+1 dϱ 1−ϱ

ϱ[1 − (k + 1)ϱk + kϱk+1]


=
(1 − ϱk+1)(1 − ϱ)

ϱ (k + 1)ϱk+1
= − .
1−ϱ 1−ϱ k+1

Notice that we do not need the condition ϱ < 1.


19
Alternatively, consider the probability generat-
ing function
k
∑ k
∑ 1 − (ϱz)k+1
g(z) = pn z n = p0 n n
ϱ z = p0 .
n=0 n=0 1 − ϱz
Since
[ ]
−(k + 1)ϱ(ϱz) (1 − ϱz) + ϱ 1 − (ϱz)
k k+1
g ′(z) = p0 ,
(1 − ϱz)2
the expected number of customers in system
is
−(k + 1)ϱk+1 (1 − ϱ) + ϱ(1 − ϱk+1 )
L = g ′(1) = p0
(1 − ϱ)2

1 − ϱ −(k + 1)ϱk+1(1 − ϱ) + ϱ(1 − ϱk+1)


=
1 − ϱk+1 (1 − ϱ)2

ϱ (k + 1)ϱk+1
= − .
1−ϱ 1−ϱ k+1

20
If ϱ < 1, then
{ }
ϱ (k + 1)ϱk+1
lim L = lim −
k→∞ k→∞ 1−ϱ 1 − ϱk+1

ϱ λ
= = ,
1−ϱ µ−λ
which gives the formula for M |M |1.

λ ∑
If ϱ = = 1, then pn = ϱnp0 = p0 and kn=0 pn =
µ
1 implies that
1
pn = if n = 0, 1, ...k.
k+1
Hence
k
∑ k
∑ 1
L= n · pn = n· =
n=0 n=0 k+1

k

1 1 k(k + 1) k
= n= · = .
k + 1 n=0 k+1 2 2

21
All remaining characteristics we can find us-
ing Little’s formulae. In order to apply Little’s
formulae, we have

∑ k−1
∑ k−1

λ̄ = λ n pn = λnpn = λ pn = λ(1−pk ).
n=0 n=0 n=0
Then we can calculate
L
. W =
λ̄
Using W , we can calculate
1
Wq = W − .
µ
This in turn gives

Lq = λ̄ · Wq .

22

You might also like