Basic Queueing Theory M/M/* Queueshuangyih/756/queueing.pdfFlaws in the analysis ? ... CS 756 25...
Transcript of Basic Queueing Theory M/M/* Queueshuangyih/756/queueing.pdfFlaws in the analysis ? ... CS 756 25...
1
CS 756 1
Basic Queueing TheoryM/M/* Queues
These slides are created by Dr. Yih Huang of George Mason University. Students registered in Dr. Huang's courses at GMU can make a single
machine-readable copy and print a single copy of each slide for their own reference, so long as each slide contains the copyright statement, and GMU facilities are not used to produce paper copies.
Permission for any other use, either in machine-readable or printed form, must be obtained from
the author in writing.
CS 756 2
Introduction
�Queueing theory provides a mathematical basis for understanding and predicting the behavior of communication networks.
�Basic Model
ServerQueue
Arrivals Departures
2
CS 756 3
� Major parameters:– interarrival-time distribution– service-time distribution– number of servers– queueing discipline (how customers are taken
from the queue, for example, FCFS)– number of buffers, which customers use to wait
for service� A common notation: A/B/m, where m is the
number of servers and A and B are chosen from – M : Markov (exponential distribution)– D: Deterministic – G: General (arbitrary distribution)
CS 756 4
M/M/1 Queueing Systems
� Interarrival times are exponentially distributed, with average arrival rate λλλλ.
�Service times are exponentially distributed, with average service rate µµµµ.
�There is only one server.
�The buffer is assumed to be infinite.
�The queuing discipline is first-come-first-serve (FCFS).
3
CS 756 5
System State
�Due to the memoryless property of the exponential distribution, the entire state of the system, as far as the concern of probabilistic analysis, can be summarized by the number of customers in the system, i.
– the past/history (how we get here) does not matter
�When a customer arrives or departs, the system moves to an adjacent state (either i+1 or i-1).
CS 756 6
� In equilibrium,
�Let
�We have
State Transition Diagram
10 2 3 4 5
λ
µ
λ
µ
λ
µ
λ
µ
λ
µ
λ
µ
}{ i state in systemPPi =PP ii 1+= µλ
λ
µi i+1
The rate of movements in both directions should be equal
4
CS 756 7
� Equations from the state transition diagram:
�Solve
�What is ?
�
PPPPPP
32
21
10
µλµλµλ
=
=
=
PP
PPPP
PPP
k
k 0
0
2
012
001
)(
ρ
ρρρµλ
ρµλ
=
===
==
�
ρ
CS 756 8
�Since
we have
�That is, .�Note that must be less than 1, or else the
system is unstable.
��∞
=
∞
===
00
0
1k
k
kk PP ρ
. 111
100
ρρ
−=�=− PP
ρ)1( ρρ −= k
kP
5
CS 756 9
Average Number of Customers
? )1(00��
∞
=
∞
=
=−==kk
kkkkPN ρρ
CS 756 10
�Average delay per customer (time in queue plus service time):
�Average waiting time in queue:
�Average number of customers in queue:
λµλ −== 1N
T
λµρ
µλµ −=−
−= 11
W
ρρλ−
==1
2
WNQ
6
CS 756 11
Applications
�Consider 24 computer users, each of which produces in average 48 packets per second.
�For every customer, the interarrival times of his packets are exponentially distributed.
�The lengths of packets are also exponentially distributed, with mean 125 bytes.
CS 756 12
Scenar io 1�Users share a T1 line using the standard T1
time-division multiplexing.
�Assume that each user is associated with an infinite buffer (that is, queue).
� In a T1 line, it takes 1/8000 seconds to deliver (or serve) each byte.
�However, due to their variable lengths, the delivery (or service) times of packets are still exponentially distributed.
– The average service rate µ = ?
7
CS 756 13
� The system can be considered as 24 M/M/1 queues:
We have %7564
48 ==ρ
375.01
75.0 =−
=N
msec4224
1
4864
1 ≈=−
=T
QueueArrivals
Departs to the other endof the T1 line
Server,1/24th ofthe T1 line
Packet
CS 756 14
Scenar io 2
�Users share a 1.544 Mbps line through an IP router.
Packetsfrom24 users
The entireT1 as theserver
8
CS 756 15
�The (aggregated) arrival rate is
�The service rate is
�We have
This system is 24 times faster than TDM !
. 11524824 =×
. 15366424 =×
msec 4.2384
1
11521536
1
%7564/48
≈=−
=
==
T
ρ
CS 756 16
Discussion�Flaws in the analysis ?
�Still such a drastic difference in results convincingly reveals the inefficiency of TDM.
�This partly explains the momentum toward using the Internet as the universal information infrastructure.
� In general, allowing customers to share a pool of resources is far more efficient than allocating a fixed portion to each customers.
9
CS 756 17
M/M/m Queueing Systems
All servers are identical, with service rate µ
DepartsQueue
Arrivals
1
2
Servers
m
CS 756 18
State Transition Diagram
Balance equations:
10 2
λ
µ
λ
2µ
λ
3µ µm
m m+1
µm
λ λ λ
µm
���
>≤
=−miPm
miPiP
i
ii
,
,
for
for1 µ
µλ
10
CS 756 19
Solution
Where
Noticing that we have
���
���
�
>
≤=
mim
mP
mii
mpP
Pim
i
i
for ,!
for ,!)(
0
0
ρ
. µ
λρm
=
, 10
=�∞
=i iP
][)1(!
)(1
0
)(
!
1
0 ρρρ−
−
== +�
−
m
m mm
i i
m iP
CS 756 20
The probability that an arriving customer has to wait in queue:
This is known as the Erlang C formula.
)1(!)(
!)(
!
0
0
0
ρρ
ρρ
ρ
−=
=
=
=
�
�
�
∞
=
−
∞
=
∞
=
m
mP
m
mP
mmP
PP
m
mi
mim
mi
im
miiQ
11
CS 756 21
Average number of waiting customers:
ρρ
ρρρ
ρρρ
−=
−=
==
=−=
��
��∞
=
∞
=
+
∞
=+
∞
=
1
)1(!)(
!)(
!
)(
20
0
0
00
0
P
mmP
im
mPm
mPi
PiPmiN
Q
m
i
im
i
mim
imi
miiQ
CS 756 22
Average waiting time in queue:
Average time in the system:
Average number of customers in the system:
)1( ρλρ
λ −== PN
W QQ
λµµρλρ
µµ −+=
−+=+=
mPP
WT QQ 1
)1(
11
ρρ
ρλµ
λµλλ
−+=
−+==
1P
mm
PTN QQ
12
CS 756 23
M/M/1/K Queueing Systems
�Similar to M/M/1, except that the queue has
a finite capacity of K slots.
�That is, there can be at most K customers in
the system.
� If a customer arrives when the queue is full,
he/she is discarded (leaves the system and
will not return).
CS 756 24
Analysis
Notice its similarity to M/M/1, except that there are no states greater than K . We have
Noticing that we have
λ
µ
λ
µ
λ
µ
λ
µ
λ
µ0 1 2 K- 1 K
���
>≤≤
=Kifor ,0
0for ,0 KiPP
i
i
ρ
10
=� =
K
i iP
ρρ
101
1+−
−= KP
13
CS 756 25
Poisson ProcessLet random variable N be a “counter” of the number of occurrences of a particular type of events. Clearly, the value of N increases over time. Let be the value of N at time t. Moreover, if , is said to be a counting process.The counting process is said to be a Poisson processhaving rate λ if the number of events in any interval of length t is Poisson distributed with mean λt. That is, for all
)(tN0)0( =N )(tN
)(tN
0, ≥ts,...1,0 ,
!)(
})()({ ===−+ nn
tensNstNP
nt λλ
CS 756 26
Discussion
� The interarrival times of a Poisson process with rate is exponentially distributed with average
� The reverse is also true: if the interarrival times of events are exponentially distributed with average then the event counting process is Poisson with rate .
� Thus, the customer arrival processes of M/M/* queueing systems are Poisson.
� A Poisson customer count and exponentially distributed customer interarrival times are the two sides of the coin.
λ λ/1
λ/1
λ
14
CS 756 27
Sampling Poisson Arr ivals
�Consider a Poisson customer arrival process of with average rate λ.
�Each customer can be classified as Type I or Type II, with probability p and 1-prespectively.
�Then, the arrival process of Type I customers is also Poisson with average rate pλ.
�Likewise, the arrivals of Type II customers is Poisson with average rate (1− p)λ.
CS 756 28
Application�We know that the customer arrivals at a
barbershop form Poisson process with average rate of 10 customers per hour.
�Among the customers, 40% are males and 60% are females.
�Then the interarrival times of male customers are exponentially distributed with an average rate of 4 per hour.
�The interarrival times of female customers are exponentially distributed with an average rate of 6 per hour.
15
CS 756 29
Exercise� Consider the router configuration below.
� The lengths of arriving packets are exponentially distributed with an average of 1000 bits.
2000PacketsPer sec.
1Mbps
2Mbps
Port 1
Port 2
40%
60%
Port 0
CS 756 30
Questions
�Argue that queues A and B are independent M/M/1 systems.
�Compute the average length of queue A in bits.
�For a packet destined for port 2, compute its expected time at the router (including transmission time).
16
CS 756 31
�Compute the average time a packet spent at the router (including transmission time).
�Compute the average number of packets at the router(including the ones in transmission).
CS 756 32
Merging Poisson Arr ivals
�Given two exponential variables and with rates and , the random variable
is also exponential, with rate .
�Consider two Poisson arrivals, with average rates and .
�The merged arrival process will also be a Poisson process, with the average rate
X 1 X 2
λ1 λ 2
},min{ 21 XXX =λλ 21+
λ1 λ 2
λλ 21+
17
CS 756 33
Application
�Consider the router configuration below.
Router
Port 1
Port 2
Port 0
Packetarrival
Packetarrival
CS 756 34
�The lengths of arriving packets are exponentially distributed with an average of 1000 bits.
– Why do we care about packet lengths ?
�Packet arrivals at ports 1 and 2 are exponentially distributed with average rates of 2000 and 3000 packets per second, respectively.
�The transmission rate of port 0 is 10Mbps.
�The whole system can be modeled as a single M/M/1 queueing system, with an arrival rate of 5000 and service rate of 10,000.
18
CS 756 35
Burke's TheoremIn its steady state, an M/M/m queueing system with arrival rate λ and per-server service rate µproduces exponentially distributed inter-departure times with average rate .
Application: Two cascaded, independently operating M/M/m systems can be analyzed separately.
Server 1
M/M/1 system 1
Server 2
Departs
M/M/1 system 2
µ1
µ2λ
CS 756 36
Pitfall�Consider the system below where the
servers are transmission lines.
�Packets lengths are exponentially distributed with an average of 1000 bits.
�Can the two queues be analyzed separately ? Why ?
1Mbps 2Mbps
500PacketsPer sec.
19
CS 756 37
Discussion
In general: any “ feedforward” network of independently-operating M/M/m systems can be analyzed in this system-by-system decomposition.
λ
p
1- p
µ1
µ 2
µ 3
µ4
CS 756 38
Question: How about networks that do contain “ feedbacks” ?
Answer : the interarrival times of some systems may not be exponentially distributed and thus cannot be analyzed as independent M/M/m queues
20
CS 756 39
Jackson's TheoremFor an arbitrary network of k M/M/1 queueing
systems,
where
That is, in terms of the number of customers in each system, individual systems act as if they are independent M/M/1 queues (they may not).
),()...()(),...,,( 221121 nPnPnPnnnP kkk =
. )1()( ρρ jjjjn jnP −=
CS 756 40
ApplicationConsider the network below. The arrival rate
and probabilities and are known.
We first compute the arrival rates and :
λ p1
p2
CPU µ 1
I / O µ2
λ λ 1 λ1 λ 1p1
λ1p2
λ2λ2
λ1 λ 2
ppp
p
12211
12221
/ ,/
, λλλλ
λλλλλ==�
=+=
21
CS 756 41
Let and . By Jackson's theorem,
And
Total number of customers in system is
Average time in system is
µλρ 111 /= µλρ 222 /=
)1()1(),( 2211 ρρρρ −−= jijiP
ρρ
ρρ
2
22
1
11
1 ,
1 −=
−= NN
.21 NNN +=
.)1()1( 2
2
1
1
ρλρ
ρλρ
λ −+
−== N
T
CS 756 42
DiscussionConsider the packet switching network below.
Can we cite the Jackson's theorem, model the transmission lines as servers, and analyze them as separate M/M/1 queues ? Why ?
Router 1
Router 2
Router 3
Router 4
Packets