M/G/1 queue
description
Transcript of M/G/1 queue
Weiqiang Sun
M/G/1 QUEUEShanghai Jiao Tong University
Weiqiang SunWeiqiang Sun
M/G/1 queue
2
The M/G/1 queue
General service time distribution- i.i.d (identical independent distribution)- Service time is independent from arrival- = 1/μ, average service time- : Second moment of service time, <∞
X2X
Poisson Arrival rate λ: Markovian
M/G/1Poisson arrivals
General independent service times
Weiqiang SunWeiqiang Sun
Pollaczek-Khinchin (P-K) formula
Applying Little’s Theorem
3
2
2(1 )XW
X
,
QN WT W X
Number of customers in queue
W: Average waiting time in queue
Average system time: queueing delay + service time
Again Little’s Theorem, we get the number of customers in system
QN T W N
Weiqiang SunWeiqiang Sun
M/G/1 examples• Example 1: M/M/1
4
• Example 2: M/D/1
22
1 2; X X
2 (1 ) (1 )W
Deterministic service time: 1/μ2
2
1 1; X X
22 (1 ) 2 (1 )W
• Waiting time of M/D/1 is half of M/M/1, in fact the results of M/G/1 is a lower bound for all M/G/1 with same λ and μ
Weiqiang SunWeiqiang Sun
Proof of P-K formula• Suppose customer i arrives to the system and finds– Ni customers waiting in queue– Up to one customer receiving service
• And also define:– Ri: the residual service time seen by i– Wi: the waiting time in queue of customer i
5
Customer i arrives
Xi-3Xi-2Xi-1
Xi
Xi-4
Ni =3
Weiqiang SunWeiqiang Sun
Proof of P-K formula (Cont.)
6
Xi-3Xi-2Xi-1Xi Xi-4
Customer i arrivesCustomer i starts to receive serviceWi
RiNi =3 1
i
ii i jj i N
W R X
[ ] [ ] [ ] [ ]i i i QE W E R E X E N R X N
By Little’s Theorem, QN W
QW R X N
/(1 )W R X
,
Weiqiang SunWeiqiang Sun
R – The average residual service time
• Average residual service time is the sum of area of the triangles divided by time t
7
R(t)residual service time
t
Let M(t) = the number of customers served by time t
X1
X1 X2 X3 X4
X2
X3
X4
2( )
10
1 1( ) ( )2
t M t ii
XR t R d
t t
( ) 21( )
2 ( )
M tii
XM tt M t
As ( ), M ttt
is the average departure rage, and is equal to arrival rate λ
Hence,
2X
2
2iX
R
The P-K formula is then proved.
Weiqiang SunWeiqiang Sun
R in M/M/1• For M/M/1, we already know that
8
22
1 2; X X
• So, R for M/M/1 is:2
2
12
iXR
• Why it is not equal to 1/μ, given the PASTA property? R(t)residual service time
t
X1
X1 X2 X3 X4
X2
X3
X4
Weiqiang SunWeiqiang Sun
M/G/1 with vacations• Once the system is empty, the server takes a vacation
– If system is still empty after the vacation, the server takes another vacation– Useful in analyzing some polling and reservation systems
• Vacation times are i.i.d and independent of service times and arrival times
• The only impact on analysis is that a customer may enter to find the server on vacation, and must wait until end of that vacation
9
Xi-3Xi-2Xi-1Xi
Customer i arrivesWi
ViNi =3 1
i
ii i jj i N
W R X
Weiqiang SunWeiqiang Sun
R(t) with vacations
• A customer will always experience some residual time, either because server is on vacation, or is serving a customer
10
R(t)residual service time
t
X1
X1 X2 X3 X4
X2
X3
X4
V2V1 V3
Let M(t) = the number of customers served by time tL(t) = the number of vacations taken by time t
2 2( ) ( )
1 1
1( )2 2
M t L ti ii i
X VR t
t
Weiqiang SunWeiqiang Sun
R(t) with vacations (cont.)
• From the server’s point of view,
11
( )limt
M tt
( )lim vt
L tt
And we have ,
1v V (1 ) /v V
• Hence, 22 1
2 2VXR
V
And
2 2
/(1 )2 1 2
X VW RV
?
Weiqiang SunWeiqiang Sun
Example: Slotted M/D/1 system
• Fixed slot duration 1/ μ• Service can begin only at start of a slot• If a customer misses the slot start, it must wait until next start
(slot in vacation)
12
1/μ
E[X] = E[V] = 1/μE[X2] = E[V2] = 1/μ2
2 2 / 12 1 2 22
X VWV
/ /11
2M DW
• This part of time is spent waiting for the slot (syncronizing)
Weiqiang SunWeiqiang Sun
Example. Text problem 3.29
13