Equilibrium Analysis of the M/G/1 Queue

Equilibrium Analysis
of
the M/G/1 Queue
Copyright 2002, Sanjay K. Bose
1
1. Mean Analysis using Residual Life Arguments
(Section 3.1)
2. Analysis using an Imbedded Markov Chain Approach
(Section 3.2)
3. Method of Supplementary Variables (done later!)
(http://home.iitk.ac.in/~skb/qbook/MG1_SupVar.PDF)
Method of Stages or other exact/approximate analytical methods may
also be used
Copyright 2002, Sanjay K. Bose
2
1
Why is the M/M/1 queue so easy to analyze while the analysis of the
M/G/1 queue is substantially more difficult ?
• State description for M/M/1 is simple as one needs just one
number (i.e. the number in the system) to denote the system state.
• This is possible because the exponential service time distribution is
memoryless and service already provided to the customer currently
in service need not be considered in the state description.
• This is not true for the M/G/1 queue. Its general state description
would require specification of both the number currently in the
system and the amount of service already provided to the customer
currently being served.
Copyright 2002, Sanjay K. Bose
M/G/1/∞ Queue:
3
Single server, Infinite number of waiting
positions
Service discipline assumed to be FCFS unless otherwise specified.
Mean results same regardless of the service discipline
Arrival Process:
Poisson with average arrival rate λ
Inter-arrival times exponentially
distributed with mean 1/λ
Service Times:
Generally distributed with pdf b(t), cdf
B(t) and L.T.[b(t)]=LB(s)
Copyright 2002, Sanjay K. Bose
4
2
Residual Life Approach for
Analyzing the M/G/1 Queue
Arrivals
λ
M/G/1
E{X}=1/µ
(Section 3.1)
Departures
Note that this approach can only give the mean results for the
performance parameters - state distributions cannot be found
We will tacitly assume a FCFS queue. However, since only the mean
results are being obtained, these will be the same for queues with
other service disciplines, such as LCFS, SIRO etc..
Copyright 2002, Sanjay K. Bose
5
Consider a particular arrival of interest entering the M/G/1 queue
Let r = (random) residual service time of the customer (if any)
currently in service
R=E{r}
Then
Mean Residual Service Time
Wq = N q E{ X } + R = λWq E{ X } + R
Wq =
where
R
(1 − ρ )
ρ = λE{ X } = λX =
λ
µ
We still need to find R to find Wq . However, once Wq is known, the
results Nq, N and W may be found directly from that.
Copyright 2002, Sanjay K. Bose
6
3
R may be found as the time
average of r(τ) using a
graphical approach, as shown
r(τ)
X2
X4
X1
X1
τ
X4
X3
X2
R = lim t →∞ Rt
where
t
M (t )
Rt =
Residual Service Time r(τ) as a Function of τ
=
For t→∝,
M (t )
→λ
t
1 M (t ) 1 2
Xi → X 2
M (t ) i=1 2
R=
∑
1
1
r (τ )dτ ≅
t0
t
∫
∑2X
1
1 M (t ) 1 M ( t ) 1 2
Xi
2 t M (t ) i =1 2
∑
1
λX 2
2
Wq =
λX 2
2(1 − ρ )
2
i
i =1
(3.1)
Pollaczek-Khinchine
or P-K Formula
(3.2)
Copyright 2002, Sanjay K. Bose
Wq =
λX2
2(1 − ρ )
For the M/M/1 queue
λX 2
W = Wq + E{ X } =
+X
2(1 − ρ )
N q = λW q =
N = λW =
7
λ2 X 2
2(1 − ρ )
λ2 X 2
+ρ
2(1 − ρ )
Copyright 2002, Sanjay K. Bose
E{X}=1/µ,
E{X2}=2/µ2
Substituting these
lead to the same
results as obtained
directly for the
M/M/1 queue
earlier
8
4
P{server is busy}=ρ=λE{X}
P{server not busy}=(1-ρ)
(See page 59 for justification)
R = (1-ρ)E{r | system found empty on arrival}
+ ρE{r | system found not empty on arrival}
E{r | system found not empty on arrival} =
σ2
R X 2 1 
=
= X + X
ρ 2X 2 
X




Note that the counter-intuitive nature of the above result, i.e. that it is
σ2 
1
 X + X  rather than 1 X illustrates the Paradox of Residual Life
2 
X 
2
Arrival to a non-empty queue samples an ongoing service time but
would tend to select longer service times more than shorter ones.
Copyright 2002, Sanjay K. Bose
System examined at arbitrary time instant t
Some Residual Life Results
tk-1
E{τ i − τ i −1 } = X
E{(τ i − τ i −1 ) } = X
2
Y =
2
xf X ( x)
X
Y
tk
tk+1
1
1 σ 2X
X+
2
2 X
where X is a lifetime and Y is then
referred to as the residual lifetime
f Xˆ ( x) =
9
Time
t
Arrivals coming at time instants ti i=1,2,...............
where X̂ is the pdf of the selected lifetime
For the distribution of Y, we have the following results
f Y ( y )dy = P{ y ≤ Y ≤ y + dy} =
1
1
LY (s) = L.T . −
X X

y
∫f
0
X
1
[1 − F X ( y )]dy
X
 1 − L X (s )
( y)dy  =

sX

Copyright 2002, Sanjay K. Bose
(3.7)
(3.8)
10
5
The Imbedded Markov Chain Approach (M/G/1 Queue)
(Section 3.2)
• Choose imbedded time instants ti i=1, 2, 3…...∞ as the instants
just after the departure of jobs from the system (after completing
service)
• At these time instants, we can describe the system state by the
number in the system, i.e.
ni = Number left behind in the queue by the ith departure
• We can easily see (shown subsequently) that the sequence ni
forms a Markov Chain, which can be solved to obtain the
equilibrium state distribution at these specially chosen time
instants (“the departure instants”)
Copyright 2002, Sanjay K. Bose
11
Useful Results Applicable to the M/G/1 Queue
Kleinrock's Result:
For systems where the system state
can change at most by +1 or -1, the system distribution as seen
by an arriving customer will be the same as that seen by a
departing customer
State Distribution at the Arrival Instants will be the same as
the State Distribution at the Departure Instants
PASTA:
Poisson Arrival See Time Averages
State Distributions and Moments seen by an arriving
customer will be the same as those observed at an arbitrarily
chosen time instant under equilibrium conditions
Copyright 2002, Sanjay K. Bose
12
6
ith departure leaves
non-empty system
(i+1)th departure
ni > 0
ni+1 = ni -1+ai+1
(i+1)th service time
ai+1 arrivals in
(i+1)th service time
Departure Leaves System Non-empty
ni+1 = ni - 1 + ai+1
ni =1,2,………….
Copyright 2002, Sanjay K. Bose
ith departure leaves
empty system
ni = 0
13
(i+1)th departure
ni+1 = ai+1
(i+1)th service time
First Arrival to
the system after it
becomes empty
ai+1 arrivals in
(i+1)th service time
Departure Leaves System Empty
ni+1 = ai+1
ni =1,2,………….
Copyright 2002, Sanjay K. Bose
14
7
ni +1 = ai +1
for ni = 0
= ni − 1 + ai +1
(3.11)
for ni = 1, 2, 3.........
or
ni +1 = ni − U ( ni ) + ai +1
for
ni = 0,1, 2, 3,........
(3.12)
Copyright 2002, Sanjay K. Bose
Taking expectations of LHS and RHS of
(3.11) or (3.12)
15
E{U(ni)}=E{ai+1}
E{U ( ni )} = 1 − p0
Since
∞
∫
E{ai +1} = (λt )b(t ) dt = λX = ρ
0
Therefore
p0 =1-ρ
P{System Empty}
Copyright 2002, Sanjay K. Bose
16
8
P(z) Generating Function for the Number in the System
Pi ( z ) = E{ z ni } =
∞
∑z
k
Pi +1 ( z ) = E{z ni −U ( ni ) }E{z ai +1 }
P{ni = k}
k =0
Pi +1 ( z) = E{z ni +1 } =
∞
∑z
k =0
k
P{ni +1 = k}
Solve for Transient Solution
For Equilibrium State Distribution
1. Drop subscript “ i ” since equilibrium conditions are considered
2. Use A(z)=LB (λ - λz)
(3.13)
3. Use the following results A′( z ) = −λLB′ (λ − λz )
A′(1) = −λLB′ (0) = λX = ρ
A′′( z ) = λ2 LB′′ (λ − λz )
A′′(1) = λ2 L′B′ (0) = λ2 X 2
Copyright 2002, Sanjay K. Bose
{
}
P ( z) = A( z) E z n −U ( n ) = A( z)
∞
∑z
k −U ( k )
17
P{n = k}
k =0
∞



1 ∞ k
1 
z pk − p0 
= A( z )  z 0 p0 + z k −1 pk  = A( z)  p0 +
z k =0
z 
k =1



1
1

= A( z )  P ( z) − p0 (1 − z) 
z
z

∑
(1 − ρ )(1 − z ) A( z )
A( z ) − z
(1 − ρ )(1 − z ) L B (λ − λz )
=
L B (λ − λz ) − z
P( z ) =
Copyright 2002, Sanjay K. Bose
∑
P-K
Transform
Equation
(3.14)
18
9
Under equilibrium conditions, P(z) was derived at the customer
departure instants. However • It will hold at the customer arrival instants (Kleinrock’s Result)
• It will also hold for the time averages or at an arbitrary time
instant under equilibrium conditions
Expressing
P( z) =
∞
∑α z
i
i
(Taylor Series Expansion)
i =0
We can obtain αi = P{i customers in the system} under equilibrium
conditions
Copyright 2002, Sanjay K. Bose
19
Moments of the system parameters (e.g. number in the system, may be
computed directly from P(z)
For this, use A(1)=1
A′(1) = λX = ρ
P(1) = lim z →1 P ( z ) = lim z →1
A ′′(1) = λ2 X 2
(1 − ρ )[(1 − z) A′( z ) − A( z)]
(1 − ρ )
=−
=1
A′( z ) − 1
ρ −1
This result, i.e. P(1) must be unity could have been used to obtain p0
directly, instead of obtaining it as done earlier
2
2
Similarly N = P ′(1) = ρ + λ X
2(1 − ρ )
Mean number in system
Knowing N, the other parameters Nq,W, and Wq may be calculated
as before
Copyright 2002, Sanjay K. Bose
20
10
W=X+
N=ρ+
λ2 X 2
2(1 − ρ )
λX 2
2(1 − ρ )
Wq = W − X =
⇒
Nq =
λX 2
2(1 − ρ )
X2
2(1 − ρ )
Copyright 2002, Sanjay K. Bose
21
Delay Distribution in a FCFS M/G/1 Queue
T
Total time spent in system (r.v.) by an arrival
Q
Total waiting time (r.v.) before service begins for an
arrival
T =Q + X
Q⊥X
LT ( s ) = E{e − sT } = LQ ( s ) L B ( s)
LB(s) is known if the distribution of the service time X is given
Copyright 2002, Sanjay K. Bose
22
11
Consider a particular job arrival and its departure (say the nth one) in
a FCFS M/G/1 queue
The number of customers
that the nth user will see
left behind in the queue
when it departs will be the
number of arrivals that
occurred while it was in
the system.
Therefore
Service ends for
the nth arrival
Tn
Xn
Qn
nth arrival
Time
Service starts for
the nth arrival
LT (λ − λz ) = P ( z )
Copyright 2002, Sanjay K. Bose
Substituting s = (λ - λz)
LT ( s ) =
s (1 − ρ ) L B ( s )
s − λ + λL B ( s )
23
(3.15)
Substituting T = Q + X, Q⊥X and L B ( s ) = E{e − sX }
LQ ( s) =
LT ( s)
s (1 − ρ )
=
LB ( s ) s − λ + λL B ( s )
(3.16)
LT(s) and LQ(s) are the L.T.s of the pdfs of the total delay and the queueing
delay as seen by an arrival in a FCFS M/G/1 queue.
An alternate approach for deriving LT(s) and LQ(s) may be found in
Section 3.7
Copyright 2002, Sanjay K. Bose
24
12
Busy Period Analysis of a M/G/1 Queue (Section 3.4)
U(t)=0 during Idle Period
U(t)>0 during Busy Period
Cycle
U(t)
A Cycle consists of the
combination of successive
Idle and Busy periods
Idle
Period
Busy Period
Time
Unfinished Work U(t) in a M/G/1 Queue
Copyright 2002, Sanjay K. Bose
25
Idle Period
Exponentially distributed with mean 1/λ
f IP (t ) = µe − µt
L IP (s ) =
t≥0
λ
s+λ
This will have the same distribution as an inter-arrival time
Copyright 2002, Sanjay K. Bose
26
13
Busy Period
Consider a busy period that starts with the arrival of customer A1.
Let X1 be the service time for A1.
Let there be n* arrivals (A2,................., An*+1) that arrive during the
service time X1, in the sequence A2,............., An*+1.
Note that the busy period BP will consist of the sum of X1 and n*
sub-busy periods.
Each of the sub-busy periods are i.i.d. random variables with the
same distribution as that of the busy period BP (to be found)
BP = X 1 + BP2 + .......... + BPn*+1
BP j ⊥BPk
BPj ⊥X 1
∀j, k
Copyright 2002, Sanjay K. Bose
27
E{e − s ( BP ) | X 1 = x, n* = k} = e − sx [ L BP ( s)]k
E{e − s ( BP ) | X 1 = x} = e − sx
∞
∑e
−λx
k =0
(λx) k
[ LBP ( s)]k
k!
= e − sx e − λx e λxLBP ( s )
= e − x( s + λ −λLBP ( s ))
LBP ( s ) = E{e − s ( BP ) } =
∞
∫e
− x[ s + λ −λLBP ( s )
b( x)dx
x=0
L BP ( s ) = LB (s + λ − λL BP ( s ) )
(3.19)
Solve (3.19) to obtain LBP(s)
The moments of BP may be obtained directly from (3.19) using the
moment generating properties of the L.T. LBP(s). See Section 3.4
for the mean and some higher moments of BP.
Copyright 2002, Sanjay K. Bose
28
14
Delay Distribution in a LCFS M/G/1 Queue
End of
Residual
Service Time
D0
Customer A
arrives to a
non-empty
queue
Customer A's
service starts
Customer A
departs
D1
Q
Queuing Delay
for Customer A
X
Service time
for A
Customer arrival/departure instants and delays in a
LCFS M/G/1 Queue
Copyright 2002, Sanjay K. Bose
29
Queueing Delay Q= D0+D1 waiting time in queue before service
D0 = Residual service time of job during whose service A arrives
D0=0 if A arrives to an empty queue (probability = 1-ρ )
f D0 (t ) =
1 − B (t )
X
LD0 ( s) =
1 − LB ( s )
sX
(3.20)
(3.21)
D1 will consist of sub busy periods, one associated with each of the
customer arrivals in D0
Note that D0 and D1 are not independent of each other
Copyright 2002, Sanjay K. Bose
30
15
{
{ }
}
LQ (s) = E e − sQ = (1 − ρ ) + ρE e − sQ arrival to non − empty queue
= (1 − ρ ) + ρE{exp(− s( D0 + D1 )) arrival to non − empty queue}
{
E {e
}
= n}= e
E e − sD1 | D0 = y, N 0 = n = [ LBP ( s )]n
For the case
where the
arrival A
comes to a
non-empty
queue
− sQ
| D0 = y , N 0
− sy
[ L BP ( s )] n
which leads to
{
} ∑ (λny!)
{
}
E e − sD1 | D0 = y =
∞
n
e − λy [ L BP ( s )] n = exp[ − y{λ − λL BP ( s )}]
n =0
E e − sQ | D0 = y = exp[ − y{s + λ − λL BP ( s )}]
Copyright 2002, Sanjay K. Bose
{
} ∫ E {e
E e − sD1 =
∞
− sD1
31
}
D0 = y f D0 ( y )dy
y =0
∞
For the case
where the
arrival A
comes to a
non-empty
queue
=
∫ [exp[ − y{λ − λL
]f D
BP ( s )}
0
( y ) dy
y =0
= LD0 (λ − λLBP ( s ) )
Using (3.21), we then get
{
}
E e − sD1 =
1 − L B (λ − λL BP ( s ))
X (λ − λLBP ( s ))
Copyright 2002, Sanjay K. Bose
(3.22)
32
16
Similarly
{ } ∫ E{e
∞
E e − sQ =
− sQ
}
D0 = y f D0 ( y) dy
y =0
∞
For the case
where the
arrival A
comes to a
non-empty
queue
=
∫ [exp[ − y{s + λ − λL
]f D
BP ( s )}
0
( y) dy
y =0
= LD0 (s + λ − λL BP ( s ) )
Using (3.21), we then get
{ }
E e − sQ =
1 − L B ( s + λ − λL BP ( s ))
X ( s + λ − λL BP ( s ))
1 − L BP ( s )
=
X ( s + λ − λL BP ( s))
(3.23)
Copyright 2002, Sanjay K. Bose
33
Therefore, considering both the cases where Customer A finds
the queue empty and non-empty LQ ( s ) = (1 − ρ ) + ρ
1 − LBP ( s )
( s + λ − λLBP ( s )) X
(3.24)
and
LT ( s) = LQ (s ) LB ( s)
(3.25)
LT(s) and LQ(s) are the L.T.s of the pdfs of the total delay and the queueing
delay as seen by an arrival in a LCFS M/G/1 queue.
The results obtained for the M/G/1 queue may be used to obtain the delay
distributions for the M/D/1 queue as well. This is given in Section 3.6.
Copyright 2002, Sanjay K. Bose
34
17
An Elapsed Time Approach for the M/G/1 Queue
Allows us to show that the state distribution at the customer
departure instants will be the same as the equilibrium state
distribution without using either Kleinrock’s Principle or
PASTA
Copyright 2002, Sanjay K. Bose
35
For i=0,1,2……..∞
r(τ)
qi= P{i jobs left in system as seen
by a departing job}
X2
X4
X1
X1
X2
X3
X4
Imbedded Points at the Job Departure
Instants of the M/G/1 Queue
τ
pi = P{i jobs in system as seen at
an arbitrarily time instant
between successive imbedded
points}
Note that • pi, i=0,1,2……..∞ is the equlibrium state distribution of the system
• We want to prove that pi=qi i=0,1,2……..∞ without using either
Kleinrock’s Principle or PASTA
Copyright 2002, Sanjay K. Bose
36
18
Arrival Process:
Poisson with rate λ
Service Time:
pdf b(t), cdf B(t), L.T. LB(s)=LT[b(t)]
Mean E{ X } = X = 1
µ
∞
αk = P{k arrivals in a service time} =
A( z ) =
with generating function
(λx) − λx
e b( x) dx k = 0,1,........∞
k!
x= 0
k
∫
∞
∑α
k
z k = L B ( λ − λz )
k =0
We now focus on the Markov Chain at only the imbedded points
corresponding to departures from the system
Copyright 2002, Sanjay K. Bose
37
For this imbedded chain, we had obtained the generating function
earlier (as P(z) in Eq. (3.14)).
We write this again as Q(z)
Q( z) =
∞
∑q
j
zj =
j =0
(1 − ρ )(1 − z ) A( z )
A( z ) − z
ρ = λX
By expanding this, we can get
q0 = 1 − ρ
q1 =
1
[q0 (1 − α 0 )]
α0
qk =
k −1

1 
q jα k − j − q 0α k −1 
q k −1 −
α 0 
j =1

∑
Copyright 2002, Sanjay K. Bose
k =1
k = 2,......, ∞
38
19
Alternatively, we may note that this imbedded Markov Chain has
the following state transition probabilities q jk = α k
j=0
= α k − j +1
j = 1,2,......., ∞
Its equilibrium state probabilities {qj} may be obtained by solving
qk =
∞
∑q
k = 0,1,........, ∞
j q jk
j =0
∞
along with the normalization condition
∑q
k
=1
k =0
This solution method, which is used to directly obtain Q(z), has been
given in more detail in the notes.
Copyright 2002, Sanjay K. Bose
39
D = Mean time interval between successive embedded points
1
+ X ) + (1 − q0 ) X
λ
1
= X + q0
λ
D = q0 (
Using this, p0 (of the equilibrium state distribution) may also be obtained
as the fraction of time the system stays idle, in the time interval between
successive imbedded points
p0 =
q0
1
λ
1
X + q0
λ
=
q0
=1 − ρ
q0 + ρ
Same as obtained from
earlier analysis
Copyright 2002, Sanjay K. Bose
40
20
The other equilibrium state probabilities pk, k≥1 are obtained as the
probability of the event of examining the system at an arbitrary time
instant and finding k jobs in the system, where k≥1.
(Since k=0 is not being considered, this arbitrarily chosen time instant
will not be one where the system is empty. So if the system became
empty at the last imbedded point, the time instant chosen will have to
fall after the arrival of the first customer coming subsequent to the
imbedded point where the system became empty.)
Case (a) Time instant falls in a service time following an
imbedded point where the system became empty.
Case (b) Time instant falls in a service time following an
imbedded point where the system was not empty
Copyright 2002, Sanjay K. Bose
The probability of occurrence of Case (a) will be
The probability of occurrence of Case (b) will be
41
q0 X
X + q0
1
λ
qjX
X + q0
1
λ
when the system state at the earlier imbedded point (seen left
behind by the departing customer) is j for j=1,2,…..,k
Copyright 2002, Sanjay K. Bose
42
21
For both Cases (a) & (b), the pdf of the elapsed service time x for
the job currently in service when the system is examined will be
give by [1 − B ( x )] X using residual life arguments.
Case (a)
Therefore


 q X ∞
k −1
0
 (λx ) e − λx 1 − B ( x ) dx
pk = 
1  (k − 1)!

X
 X + q0  0
λ



k 
q j X ∞ (λx) k − j − λx 1 − B ( x)


e
dx
1  (k − j)!
X
j =1  X + q
0


0
λ

Case (b)
∫
∑
∫
k = 1,......., ∞
Copyright 2002, Sanjay K. Bose
43
Let
Ak = P{k or more job arrivals in a service time}
k=0,1,2,…..,∞
A0 = 1
From definition
of Ak
Ak =
∞
∑α
k
k = 0,1,........∞
k
&
α k = Ak − Ak +1
Copyright 2002, Sanjay K. Bose
k = 0,1,........∞
44
22
We can also show that
∞
∑A
= λX = ρ
k
k =1
Ak =
∑
αj =
j =k
∞
=
( λ x)
∞ ∞
(λx) j − λx
e b( x)dx
j!
0
∑∫
j =k
k −1
∫ (k − 1)! e
− λx
[1 − B( x)]λdx
for
k=1,2,......,∞
0
Copyright 2002, Sanjay K. Bose
45
Applying these to the expression for pk given earlier, we get
 q0 
  Ak +
p k = 
 q 0 + ρ  

= p 0  Ak +

∑  q

= q 0  Ak +

∑  q

qj 
 Ak − j +1 

0 
j =1

k
∑  q

qj 
 Ak − j +1 


0 
j =1
k
for
k=1,2,......,∞

qj 
 Ak − j +1 

0 
j =1

k
Copyright 2002, Sanjay K. Bose
46
23
Using

 Ak +

 q
qj 
 Ak − j +1  = k

0 
j =1
 q 0
k
∑  q
for k=1,2,......,∞
we then get the desired result
pk=qk
for k=1,2,......,∞
Copyright 2002, Sanjay K. Bose
47
24