CS 756 1
Basic Queueing Theory
M/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.
Introduction
Queueing theory provides a mathematical basis for understanding and predicting the behavior of communication networks. Basic Model
Server Queue
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)
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).
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).
In equilibrium, Let
We have
State Transition Diagram
1 0 2 3 4 5 λ µ λ µ λ µ λ µ λ µ λ µ } {systeminstatei P Pi = P Pi = µ i+1 λ λ µ i i+1 The rate of movements in both directions should be equal
CS 756 7
Equations from the state transition diagram:
Solve What is ?
P
P
P
P
P
P
3 2 2 1 1 0 µ λ µ λ µ λ = = =P
P
P
P
P
P
P
P
P
k k 0 0 2 0 1 2 0 0 1 ) ( ρ ρ ρ ρ µ λ ρ µ λ = = = = = =ρ
Since we have That is, .Note that must be less than 1, or else the system is unstable. ∞ = ∞ = = = 0 0 0 1 k k k
P
kρ
P
. 1 1 1 1 0 0 ρ ρ = = − −P
P
ρ)
1
(
ρ
ρ
−
=
k kP
CS 756 9
Average Number of Customers
? ) 1 ( 0 0 ∞ = ∞ = = − = = k k k k k kP N ρ ρAverage delay per customer (time in queue plus service time):
Average waiting time in queue:
Average number of customers in queue: λ µ λ = − = N 1 T λ µ ρ µ λ µ− − = − = 1 1 W ρ ρ λ − = = 1 2 W NQ
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.
Scenario 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.
CS 756 13
The system can be considered as 24 M/M/1 queues: We have 75% 64 48 = = ρ 3 75 . 0 1 75 . 0 = − = N msec 42 24 1 48 64 1 = ≈ − = T Queue Arrivals Departs to the other end of the T1 line Server, 1/24th of the T1 line Packet
Scenario 2
Users share a 1.544 Mbps line through an IP router. Packets from 24 users The entire T1 as the server
CS 756 15
The (aggregated) arrival rate is The service rate is
We have
This system is 24 times faster than TDM ! . 1152 48 24× = . 1536 64 24× = msec 4 . 2 384 1 1152 1536 1 % 75 64 / 48 ≈ = − = = = T ρ
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.
CS 756 17
M/M/m Queueing Systems
All servers are identical, with service rate
µ
Departs Queue Arrivals 1 2 Servers m
State Transition Diagram
Balance equations: 1 0 2 λ µ λ 2µ λ 3µ mµ m m+1 µ m λ λ λ µ m > ≤ = − m i P m m i P i P i i i , , for for 1 µ µ λ
CS 756 19
Solution
Where
Noticing that we have
> ≤ = m i m m P m i i mp P P i m i i for , ! for , ! ) ( 0 0 ρ . µ λ ρ m = , 1 0 = ∞ = i
P
i]
[
1 (!(1) ) 0 ) (!
1 0 ρ ρ ρ − − = =+
− m m m m i i m i PThe probability that an arriving customer has to wait in queue:
This is known as the Erlang C formula. ) 1 ( ! ) ( ! ) ( ! 0 0 0 ρ ρ ρ ρ ρ − = = = = ∞ = − ∞ = ∞ = m m P m m P m m P P P m m i m i m m i i m m i i Q
CS 756 21
Average number of waiting customers:
ρ ρ ρ ρ ρ ρ ρ ρ − = − = = = = − = ∞ = ∞ = + ∞ = + ∞ = 1 ) 1 ( ! ) ( ! ) ( ! ) ( 2 0 0 0 0 0 0 P m m P i m m P m m P i P i P m i N Q m i i m i m i m i m i m i i Q
Average waiting time in queue:
Average time in the system:
Average number of customers in the system: ) 1 ( ρ λ ρ λ = − = N P W Q Q λ µ µ ρ λ ρ µ µ + = + − = + − = m P P W T Q 1 Q ) 1 ( 1 1 ρ ρ ρ λ µ λ µ λ λ − + = − + = = 1 P m m P T N Q Q
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).
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 > ≤ ≤ = K i for , 0 0 for , 0 i K P P i i ρ 1 0 = = K i Pi ρ ρ 1 0 1 1 + − − = K P
CS 756 25
Poisson Process
Let 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 process having rate λ if the number
of events in any interval of length t is Poisson distributed with mean λt. That is,
for all ) (t N 0 ) 0 ( = N N(t) ) (t N 0 ,t ≥ s ,... 1 , 0 , ! ) ( } ) ( ) ( { + − = = n= n t e n s N s t N P n t λ λ
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
CS 756 27
Sampling Poisson Arrivals
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-p
respectively.
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)λ.
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.
CS 756 29
Exercise
Consider the router configuration below.
The lengths of arriving packets are exponentially distributed with an average of 1000 bits.
2000 Packets Per sec. 1Mbps 2Mbps Port 1 Port 2 40% 60% Port 0
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
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).
Merging Poisson Arrivals
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
X1 X2
λ
1λ
2 } , min{X1 X2 X =λ
λ
1+
2λ
1λ
2λ
λ
1+
2CS 756 33
Application
Consider the router configuration below.
Router Port 1 Port 2 Port 0 Packet arrival Packet arrival
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.
CS 756 35
Burke's Theorem
In 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 λ
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
500 Packets Per sec.
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
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
CS 756 39
Jackson's Theorem
For 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). ), ( )... ( ) ( ) ,..., , (n1 n2 n P1 n1 P2 n2 P n P k = k k . ) 1 ( ) ( j ρj ρj j n nj P = −
Application
Consider 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 p1λ1 λ1 p2 λ2 λ2λ
1λ
2 p p p p 1 2 2 1 1 1 2 2 2 1 / , / ,λ λ λ λ λ λ λ λ λ = = = + =
CS 756 41
Let and . By Jackson's theorem,
And
Total number of customers in system is Average time in system is
µ λ ρ1= 1/ 1 ρ2=λ2/µ2 ) 1 ( ) 1 ( ) , (i j = ρ1i −ρ1 ρ2j −ρ2 P ρ ρ ρ ρ 2 2 2 1 1 1 1 , 1− = − = N N . 2 1 N N N = + . ) 1 ( ) 1 ( 2 2 1 1 ρ λ ρ ρ λ ρ λ = − + − = N T
Discussion
Consider 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