Lecture 8 20240427-Handout
Lecture 8 20240427-Handout
Lecture 8 20240427-Handout
Introduction
In this chapter we will study a class of models in which
customers arrive in some random manner at a service facility.
Interested parameters
the average number of customers in the system (or in the queue)
the average time a customer spends in the system (or spends
waiting in the queue), etc.
What is Queuing Theory?
Mathematical analysis of queues and waiting times in
stochastic systems.
Used extensively to analyze production and service processes
exhibiting random variability in market demand (arrival times) and
service times.
Served
4. Calling Jobs Service Jobs
Population Queue Mechanism
leave the
system
Service Disciplines
First-Come-First-Served (FCFS)
Last-Come-First-Served (LCFS)
Last-Come-First-Served with Preempt and Resume (LCFS-PR)
Round-Robin (RR) with a fixed quantum.
Small Quantum ⇒ Processor Sharing (PS)
Infinite Server: (IS) = fixed delay
Shortest Processing Time first (SPT)
Shortest Remaining Processing Time first (SRPT)
Shortest Expected Processing Time first (SEPT)
Shortest Expected Remaining Processing Time first (SERPT).
Biggest-In-First-Served (BIFS)
Loudest-Voice-First-Served (LVFS)
Example: M/M/3/20/1500/FCFS
Time between successive arrivals is exponentially distributed.
Service times are exponentially distributed.
Three servers
20 Buffers = 3 service + 17 waiting
After 20, all arriving jobs are lost
Total of 1500 jobs that can be serviced.
Service discipline is first-come-first-served.
Defaults:
Infinite buffer capacity
Infinite population size
FCFS service discipline.
M/M/1 = M/M/1/∞/∞/FCFS
M/G/1/10 = M/G/1/10/∞/FCFS
Preliminaries: Cost Equations
Key variables
𝑁𝑁(𝑡𝑡)=Number of customers in the system at time t
𝑃𝑃𝑛𝑛 (𝑡𝑡)=Probability that at time t, there are n
customers in the system.
𝜆𝜆𝑛𝑛 =Average arrival intensity at n customers in the
system 𝐿𝐿
𝜇𝜇𝑛𝑛 =Average service intensity for the system when 𝐿𝐿𝑄𝑄
there are n customers in it
𝜌𝜌=Utilization factor for the service facility
λ λ
µ
Some fundamental quantities of interest for
queueing models are 1
𝐿𝐿: the average number of customers in the system 𝑊𝑊𝑄𝑄 µ
𝐿𝐿𝑄𝑄 : the average number of customers waiting in
queue 𝑊𝑊
𝑊𝑊: the average amount of time a customer spends
in the system
𝑊𝑊𝑄𝑄 : the average amount of time a customer spends
waiting in queue
M/M/1 Queue
Arrival process: Poisson process with 𝜆𝜆
𝑃𝑃 𝑁𝑁 𝑡𝑡 = 1 = 𝜆𝜆Δ𝑡𝑡 + 𝑜𝑜(Δ𝑡𝑡)
Service time distribution: exponential with 𝜇𝜇
The probability of a service completion in 𝑡𝑡, 𝑡𝑡 + Δ𝑡𝑡 = 𝜇𝜇Δ𝑡𝑡 + 𝑜𝑜(Δ𝑡𝑡)
The number of servers: one
The capacity of queues: infinity
Let us define 𝑝𝑝𝑛𝑛 as the probability that there are 𝑛𝑛 customers
in the queue, including the one in service
λ μ
Waiting Service
area node
M/M/1 Queue: Transient and
Stationary behaviors
Transient behavior
𝑝𝑝𝑛𝑛 𝑡𝑡 + Δ𝑡𝑡 = 𝑝𝑝𝑛𝑛 𝑡𝑡 1 − 𝜆𝜆Δ𝑡𝑡 1 − 𝜇𝜇Δ𝑡𝑡 + 𝜇𝜇Δ𝑡𝑡 ⋅ 𝜆𝜆Δ𝑡𝑡 + 𝑜𝑜 Δ𝑡𝑡
+𝑝𝑝𝑛𝑛−1 𝑡𝑡 𝜆𝜆Δ𝑡𝑡 1 − 𝜇𝜇Δ𝑡𝑡 + 𝑜𝑜 Δ𝑡𝑡
+𝑝𝑝𝑛𝑛+1 𝑡𝑡 𝜇𝜇Δ𝑡𝑡 1 − 𝜆𝜆Δ𝑡𝑡 + 𝑜𝑜 Δ𝑡𝑡
→ 𝑝𝑝𝑛𝑛 𝑡𝑡 + Δ𝑡𝑡 = 𝑝𝑝𝑛𝑛 𝑡𝑡 1 − 𝜆𝜆 + 𝜇𝜇 Δ𝑡𝑡 + 𝑝𝑝𝑛𝑛−1 𝑡𝑡 𝜆𝜆Δ𝑡𝑡 + 𝑝𝑝𝑛𝑛+1 𝑡𝑡 𝜇𝜇Δ𝑡𝑡
𝑑𝑑𝑝𝑝 𝑡𝑡
From a Tailor series such that 𝑝𝑝𝑛𝑛 𝑡𝑡 + Δ𝑡𝑡 = 𝑝𝑝𝑛𝑛 𝑡𝑡 + 𝑛𝑛 Δ𝑡𝑡
𝑑𝑑𝑑𝑑
𝑑𝑑𝑝𝑝𝑛𝑛 𝑡𝑡
= − 𝜆𝜆 + 𝜇𝜇 𝑝𝑝𝑛𝑛 𝑡𝑡 + 𝑝𝑝𝑛𝑛−1 𝑡𝑡 𝜆𝜆 + 𝑝𝑝𝑛𝑛+1 𝑡𝑡 𝜇𝜇
𝑑𝑑𝑑𝑑
𝑑𝑑𝑝𝑝𝑛𝑛 𝑡𝑡
Stationary behavior (Non-time varying probability) =0
𝑑𝑑𝑑𝑑
𝜆𝜆 + 𝜇𝜇 𝑝𝑝𝑛𝑛 = 𝜆𝜆𝑝𝑝𝑛𝑛−1 + 𝜇𝜇𝑝𝑝𝑛𝑛+1 for 𝑛𝑛 ≥ 1
M/M/1 Queue: State Diagram
𝜆𝜆 𝜆𝜆 𝜆𝜆 𝜆𝜆 𝜆𝜆
0 1 2 3 4
𝜇𝜇 𝜇𝜇 𝜇𝜇 𝜇𝜇 𝜇𝜇
𝜆𝜆 𝜆𝜆 𝜆𝜆 𝜆𝜆 𝜆𝜆
0 1 2 3 4
𝜇𝜇 𝜇𝜇 𝜇𝜇 𝜇𝜇 𝜇𝜇
Surface 1
𝜆𝜆 + 𝜇𝜇 𝑝𝑝𝑛𝑛 = 𝜆𝜆𝑝𝑝𝑛𝑛−1 + 𝜇𝜇𝑝𝑝𝑛𝑛+1
M/M/1 Queue: State Probability
𝜆𝜆𝑝𝑝𝑛𝑛 = 𝜇𝜇𝑝𝑝𝑛𝑛+1 (balance equation)
𝜆𝜆
𝑝𝑝𝑛𝑛 = 𝜌𝜌𝑛𝑛 𝑝𝑝0 , 𝜌𝜌 =
𝜇𝜇
𝜆𝜆
Σ𝑛𝑛 𝑝𝑝𝑛𝑛 = 1 → 𝑝𝑝𝑛𝑛 = 1 − 𝜌𝜌 𝜌𝜌𝑛𝑛 , 𝜌𝜌 = <1
𝜇𝜇
M/M/1 state probability distribution is geometric distribution
𝜌𝜌 < 1 is the necessary condition. If violated, equilibrium is
never reached.
The M/M/1 state probability distribution is geometric
𝑝𝑝0 is the probability that the queue is empty.
𝜌𝜌 is called utilization, the probability that the queue is non-empty.
M/M/1/N Queue
Accommodating at most N packets
The balance equation is unchanged except for the two
boundary points 𝑛𝑛 = 0, and 𝑛𝑛 = 𝑁𝑁
1−𝜌𝜌 1−𝜌𝜌
Σ𝑛𝑛 𝑝𝑝𝑛𝑛 = 1 𝑝𝑝0 = , 𝑝𝑝𝑛𝑛 = 𝜌𝜌𝑛𝑛 𝑝𝑝0 = 𝜌𝜌𝑛𝑛 , 𝑛𝑛 = 1,2 … , 𝑁𝑁
1−𝜌𝜌𝑁𝑁+1 1−𝜌𝜌𝑁𝑁+1
1−𝜌𝜌
𝑝𝑝𝑁𝑁 = 𝜌𝜌𝑁𝑁
1−𝜌𝜌𝑁𝑁+1
The probability that the queue is full=the probability of blocking 𝑃𝑃𝐵𝐵
With the blocking probability 𝑃𝑃𝐵𝐵 , the net arrival rate is
𝜆𝜆 1 − 𝑃𝑃𝐵𝐵
Throughput= 𝛾𝛾 = 𝜆𝜆 1 − 𝑃𝑃𝐵𝐵
𝜆𝜆 = 𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙
Throughput= 𝛾𝛾 = 𝜆𝜆 1 − 𝑃𝑃𝐵𝐵
𝜆𝜆𝑃𝑃𝐵𝐵 Queue
M/M/1/N Queue:
Another Interpretation
For single-server queue, the type of queue, the average rate
of service would be 𝜇𝜇 in customers/sec served on the
average, if the queue were always nonempty
Since the queue is sometimes empty, with probability 𝑝𝑝0 , the
actual rate of service, or throughput 𝛾𝛾, is less than 𝜇𝜇.
More precisely, 𝛾𝛾 = 𝜇𝜇 1 − 𝑝𝑝0 , since 1 − 𝑝𝑝0 is the probability
that the queue is nonempty
There is no blocking and the throughput 𝛾𝛾 = 𝜆𝜆, the average arrival
rate. 𝜆𝜆 = 𝜇𝜇 1 − 𝑝𝑝0
𝛾𝛾 = 𝜆𝜆 1 − 𝑃𝑃𝐵𝐵 = 𝜇𝜇 1 − 𝑝𝑝0
1−𝜌𝜌 𝜌𝜌𝑁𝑁+1 ≪1
𝑃𝑃𝐵𝐵 = 𝑝𝑝𝑁𝑁 = 𝜌𝜌𝑁𝑁 1 − 𝜌𝜌 𝜌𝜌𝑛𝑛
1−𝜌𝜌𝑁𝑁+1
The region 𝜌𝜌 > 1 is said to be the congested region
𝛾𝛾 = 𝜆𝜆 1 − 𝑃𝑃λ𝐵𝐵 μ 𝛾𝛾 = 𝜇𝜇 1 − 𝑝𝑝0
Waiting Service
area node
M/M/1 Queue: Properties
Statistics of interest: 𝐸𝐸 𝐿𝐿 , 𝐸𝐸 𝑊𝑊𝑞𝑞 , 𝐸𝐸 𝑊𝑊 etc
0 1 2 3 4
𝜇𝜇1 𝜇𝜇2 𝜇𝜇3 𝜇𝜇4 𝜇𝜇5
𝑛𝑛
M/M/2 𝜆𝜆 𝜇𝜇
𝜇𝜇
0 1 2 3 4
𝜇𝜇 2𝜇𝜇 2𝜇𝜇 2𝜇𝜇 2𝜇𝜇
M/M/1 vs M/M/2 vs M/M/1 with 2𝜇𝜇
Other examples
M/M/∞
M/M/N/N
Other examples: M/M/∞
The number of trunks is equal to the number of calls. No
queueing up for service nor a probability of blocking
𝜆𝜆𝑛𝑛 = 𝜆𝜆
𝜇𝜇𝑛𝑛 = 𝑛𝑛𝑛𝑛, 𝑛𝑛 ≥ 1
𝜆𝜆 𝑛𝑛
𝑝𝑝 ∏𝑛𝑛−1
𝑖𝑖=0 𝜆𝜆𝑖𝑖 𝜇𝜇 𝜌𝜌𝑛𝑛 𝜆𝜆
𝑛𝑛 = ∏𝑛𝑛
= = , 𝑛𝑛 ≥ 1, 𝜌𝜌 =
𝑝𝑝0 𝑖𝑖=1 𝜇𝜇𝑖𝑖 𝑛𝑛! 𝑛𝑛! 𝜇𝜇
Σ𝑛𝑛 𝑝𝑝𝑛𝑛 = 1 → 𝑝𝑝0 = 𝑒𝑒 −𝜌𝜌 ,
𝜌𝜌𝑛𝑛 𝑛𝑛
𝜌𝜌
𝑝𝑝𝑛𝑛 = 𝑝𝑝0 𝑛𝑛! = 𝑒𝑒 −𝜌𝜌 𝑛𝑛! (Poisson!!!)
𝜆𝜆
𝐸𝐸 𝐿𝐿 = Σ𝑛𝑛 𝑛𝑛𝑝𝑝𝑛𝑛 = 𝜌𝜌 = ,
𝜇𝜇
𝐸𝐸 𝑛𝑛 1
𝐸𝐸 𝑇𝑇 = =
𝜆𝜆 𝜇𝜇
Closed systems
Fixed number of customers (K) are trapped in the system and
circulate among the queues.
Example: CPU job scheduling problem
Mixed systems
Example of Open Systems:
Tandom system
Consider a two-server system in which customers arrive at a
Poisson rate 𝜆𝜆 at server 1. After being served by server 1
then join the queue in front of server 2
There is infinite waiting space at both servers
Each server serves on customer at a time which server 𝑖𝑖
taking an exponential time with rate 𝜇𝜇𝑖𝑖 for a server 𝑖𝑖 = 1, 2.
A tandom (or sequential) system
𝜆𝜆 Leaves
Server1 Server2 system
Analysis of a Tandom System
To analyze this system, keep tack of the number of
customers at the servers and define the state by the pair
(𝑛𝑛, 𝑚𝑚), where 𝑛𝑛 customers at server 1 and 𝑚𝑚 customers at
server 2
𝑛𝑛, 𝑚𝑚; 𝑛𝑛𝑛𝑛 > 0 𝜆𝜆 + 𝜇𝜇1 + 𝜇𝜇2 𝑃𝑃𝑛𝑛,𝑚𝑚 = 𝜇𝜇2 𝑃𝑃𝑛𝑛,𝑚𝑚+1 + 𝜇𝜇1 𝑃𝑃𝑛𝑛+1,𝑚𝑚−1 + 𝜆𝜆𝑃𝑃𝑛𝑛−1,𝑚𝑚−1
Σ𝑛𝑛,𝑚𝑚 𝑃𝑃𝑛𝑛,𝑚𝑚 = 1
Probability of State
The departure process of an M/M/1 queue is a Poisson
process with rate 𝜆𝜆, it follows that what server 2 faces is also
an M/M/1 queue.
𝜆𝜆 𝑛𝑛 𝜆𝜆
𝑃𝑃 𝑛𝑛 𝑎𝑎𝑎𝑎 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 1 = 1−
𝜇𝜇1 𝜇𝜇1
𝜆𝜆 𝑚𝑚 𝜆𝜆
𝑃𝑃 𝑚𝑚 𝑎𝑎𝑎𝑎 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 2 = 1 −
𝜇𝜇2 𝜇𝜇2
From the diagram 𝑃𝑃12 = 0.4, 𝑃𝑃13 = 0.6, 𝑃𝑃32 = 0.25, 𝑃𝑃24 =
1.0, 𝑃𝑃34 = 0.75
0 0.4 0.6
𝑅𝑅 = 0 0 0 𝜆𝜆 = 𝑟𝑟 𝐼𝐼 − 𝑅𝑅 1 = [0.5, 0.5875, 055]
0 0.25 0
Closed System
A system in which new customers never enter and existing
ones never depart
Simplest case 𝑘𝑘 customers circulating among 𝑚𝑚 queues
Each queue 𝑖𝑖 has exponentially distributed service time 𝜇𝜇𝑖𝑖
State of network defined by (𝑛𝑛1 , 𝑛𝑛2 , … , 𝑛𝑛𝑚𝑚 )
Example m=2, k=3
Closed System
The limiting probability
𝑃𝑃𝑘𝑘 𝑛𝑛1 , … , 𝑛𝑛𝑚𝑚 = 𝑃𝑃{𝑛𝑛𝑗𝑗 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑎𝑎𝑎𝑎𝑎𝑎 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑗𝑗, 𝑗𝑗 = 1, . . , 𝑚𝑚}
From the balance equation
𝑚𝑚 𝑛𝑛𝑗𝑗 𝑚𝑚
𝜆𝜆𝑘𝑘 𝑗𝑗
𝑃𝑃𝑘𝑘 𝑛𝑛1 , … , 𝑛𝑛𝑚𝑚 �𝑀𝑀𝑘𝑘 �𝑗𝑗=1 𝜇𝜇𝑗𝑗
𝑖𝑖𝑖𝑖 �
𝑗𝑗=1
𝑛𝑛𝑗𝑗 = 𝑘𝑘
0
−1
𝑛𝑛𝑗𝑗
𝜆𝜆𝑘𝑘 𝑗𝑗
where 𝑀𝑀𝑘𝑘 = ∑𝑛𝑛1,…,𝑛𝑛𝑘𝑘 : ∏𝑚𝑚
𝑗𝑗=1 𝜇𝜇𝑗𝑗
Σ𝑛𝑛𝑗𝑗 =𝑘𝑘
Example of Closed Systems
Example m=2, k=3
From the diagram 𝑃𝑃12 = 𝑃𝑃21 = 1
State space 𝑆𝑆 = 0,3 , 1,2 , 2,1 , 3,0
−1
𝑛𝑛𝑗𝑗 3 1 𝜆𝜆 2 2
𝜆𝜆𝑘𝑘 𝑗𝑗 𝜆𝜆𝑘𝑘 2 𝜆𝜆𝑘𝑘 1
𝑀𝑀𝑘𝑘 = ∑𝑛𝑛1 ,…,𝑛𝑛𝑘𝑘 : ∏𝑚𝑚
𝑗𝑗=1 =� + 𝑘𝑘
+
𝜇𝜇𝑗𝑗 𝜇𝜇2 𝜇𝜇1 𝜇𝜇2
Σ𝑛𝑛𝑗𝑗 =𝑘𝑘
𝜆𝜆𝑘𝑘 1 2 𝜆𝜆 2 1 𝜆𝜆 1 3 −1
𝑘𝑘
+ 𝑘𝑘 �
𝜇𝜇1 𝜇𝜇2 𝜇𝜇1
−1
Let 𝜆𝜆𝑘𝑘 1 = 1 → 𝜆𝜆𝑘𝑘 2 = 1, then 𝑀𝑀
3 𝑘𝑘 = 1.875
𝜆𝜆𝑘𝑘 2
P 0,3 = 𝑀𝑀𝑘𝑘 = 0.0667
𝜇𝜇2 1 2
𝜆𝜆𝑘𝑘 1 𝜆𝜆𝑘𝑘 2
P 1,2 = 𝑀𝑀𝑘𝑘 = 0.1333
𝜇𝜇1 2 𝜇𝜇2 1
𝜆𝜆𝑘𝑘 1 𝜆𝜆𝑘𝑘 2
P 2,1 = 𝑀𝑀𝑘𝑘 = 0.2667
𝜇𝜇 3 𝜇𝜇2
𝜆𝜆𝑘𝑘 11
P 3,0 = 𝑀𝑀𝑘𝑘 = 0.5333
𝜇𝜇1