8.queuing Theory
8.queuing Theory
8.queuing Theory
Total
cost
Cost
Cost of
service
Cost of waiting
Process capacity
Queuing Theory
The subject of queueing theory can be described as
follows:
A service center and a population of customers, which at
some times enter the service center in order to obtain
service.
Service center can only serve a limited number of
customers.
If a new customer arrives and the service is exhausted, he
enters a waiting line and waits until the service facility
becomes available.
Three main elements of a service center:
1. a population of customers,
2. the service facility and
3. the waiting line.
Queuing Theory
Applications:
Commercial Queuing Systems
Commercial organizations serving external customers
Ex. Dentist, bank, ATM, gas stations, plumber, garage …
Transportation service systems
Vehicles are customers or servers
Ex. Vehicles waiting at toll stations and traffic lights, trucks or
ships waiting to be loaded, taxi cabs, fire engines, buses
Business-internal service systems
Customers receiving service are internal to the organization
providing the service
Ex. Inspection stations, conveyor belts, computer support …
Social service systems
Ex. Judicial process, the ER at a hospital, waiting lists for
organ transplants or student dorm rooms …
Application of queuing models in
Computer Science
Queueing theory in networking:
Dimensioning of buffers in routers or multiplexers
Number of trunks in a central office in POTS,
Calculating end-to-end throughput in networks and so forth.
Server virtualized system with live VM migration
Service delivery improvements for cloud service
providers
Trading power consumption against performance by
reserving blocks of servers
Optimal partitioning of a multi-core server processor
Modeling and optimizing the delay-energy tradeoff in
TDM systems with sleep mode
Queuing System
model processes in which customers arrive.
wait their turn for service.
are serviced and then leave.
Example: supermarket checkouts stands, world series
ticket booths, doctors waiting rooms etc..
Five components of a Queueing system:
Interarrival-time probability density function (pdf)
Service-time
Number of servers
Queueing discipline
Size of queue.
Queuing Theory
Components of a Basic Queuing Process :
Input Source The Queuing System
Served
Calling Jobs Service Jobs
Queue Mechanism
Population
leave the
system
Arrival Queue
Process Discipline
Service
Queue
Process
Configuration
Queuing System
Assume: an infinite number of customers (i.e. long
queue does not reduce customer number).
Assumption is bad in :
a time-sharing model.
with finite number of customers.
if half wait for response, input rate will be reduced.
Queuing System
The calling population
The population from which customers/jobs originate
The size can be finite or infinite (the latter is most common)
Can be homogeneous (only one type of customers/ jobs) or
heterogeneous (several different kinds of customers/jobs)
The Arrival Process
Determines how, when and where customer/jobs arrive to
the system
Important characteristic is the customers’/jobs’ inter-arrival
times
To correctly specify the arrival process requires data
collection of interarrival times and statistical analysis
Queuing System
The queue configuration
Specifies the number of queues
Single or multiple lines to a number of service stations
Their location
Their effect on customer behavior
Balking and reneging
Their maximum size (number of jobs the queue can
hold)
Distinction between infinite and finite capacity
Queuing System
The queue configuration (cont.)
a a a a
0 1 2 3
d d d d
Stochastic Processes
Definition: A stochastic process in continuous time is a
family {X(t)} of stochastic variables defined over a
continuous set of t-values.
Example: The number of phone calls connected through
a switch board
X(t)=# Calls
P1 P 2 P k P k +1
Markov Chain
not (4,7) not (5,7) not (6,7) not (8,7) not (9,7) not (10,7)
P4 P5 P6 P8 P9 P10
5 6 8
4 9 7 7 7
7
5 6 8 9 7
Win 10 7
4 10 Lose
(7, 11) Start (2, 3, 12)
(0.6)
1
(0.1) 1 2 3
(0.3)
1 0.6 0.3 0.1
(1) (0.8)
P= 2 0.8 0.2 0
3 1
3 2
0 0
(0.2)
Markov Chain
Classification of states:
Accessible: Possible to go from state i to state j (path exists
in the network from i to j).
Two states communicate if both are accessible from each
other. A system is irreducible if all states communicate.
State i is recurrent if the system will return to it after leaving
some time in the future.
If a state is not recurrent, it is transient.
d1 d2 d3 d4
0 1 2 3 4 …
a0 a1 a2 a3
0
a0
1
a1
2
a2
3
a3
4 …
Markov Chain
Classification of states (cont.):
A state is periodic if it can only return to itself after a fixed
number of transitions greater than 1 (or multiple of a fixed
number).
A state that is not periodic is aperiodic. A state with a self-
loop transition (i.e. pii > 0) is always aperiodic.
(0.5)
0 0 4
(0.5)
(1) (1) (1) (1)
2 1 2 1
(1) (1)
d1 d2 d3
0 1 2 3 4
a1 a2 a3
Markov Chain
Classification of states (cont.):
Class: set of states that communicate with each other.
A class is either all recurrent or all transient and may be either
all periodic or aperiodic.
States in a transient class communicate only with each other
so no arcs enter any of the corresponding nodes in the
network diagram from outside the class. Arcs may leave,
though, passing from a node in the class to one outside.
0 3 6
2 1 5 4
Markov Chain
Illustration of Concepts:
Example 1
0
State 0 1 2 3
0 0 X X 0
1 X 0 0 0 3 1
2 0 0 0 X
3 X 0 0 X
State 0 1 2 3 4
0 X X 0 0 0
1 X X 0 0 0 4 1
2 0 0 X 0 0
3 0 0 X X 0
4 X 0 0 0 0
3 2
State 0 1 2 3
0 0 X X 0
1 0 0 0 X 1
3
2 0 0 0 X
3 X 0 0 0
Discrete Continuous
events event
1 2 start
5 3 4
exit 0
exit 0
1
Let {Xn}n=0, 1, 2, ... the position of the mouse after n rooms
visited
Assume that the mouse does not have any memory of
rooms visited previously and that she chooses any corridor
equiprobably.
Discrete Time Markov Chain
Homogenuous DTMC
A DTMC is said homogenuous iff its transitions
probabilities do not depend on the time n, i.e.
P[Xn+1 = j Xn = i] = P[X1 = j X0 = i] = pij
A homogenuous DTMC is then defined by its transition
matrix P =[pij]i,jE
Discrete Time Markov Chain
Stochastic Matrix
A square matrix is said stochastic iff
all entries are non negative
each line sums to 1
Properties
• A transition matrix is a stochastic matrix
• If P is stochastic, then Pn is stochastic
• The eigenvalues of P are all smaller than 1, i.e. |l| ≤1
Discrete Time Markov Chain
A DTMC is said irreducible iff a state j can be reached
in a finite number of steps from any other state i.
Discrete Continuous
events event
Memoryless:
In a CTMC, the past history impacts on the future
evolution of the system via the current state of the
system
Continuous Time Markov Chain
Poisson Exponential
Arrivals service time
N(t) : number of
customers at time t
Customer Customer
Arrivals departures
Continuous Time Markov Chain
Definition : A CTMC {X(t), t > 0} is homogeneous iff
P[X(t+s)= j X(t) = i] = P[X(t+s)= j X(t) = i] = pij(s)
Homogeneous memoryless:
In reliability, we only say "a machine that does not fail at
age t is as good as new"
t
Mean=
Time between arrivals
E[T]=1/
Continuous Time Markov Chain
When a CTMC leaves state i, it jumps to state j with
probability pij. This probability is:
independent of time as the CTMC is homogeneous
independent of sojourn time Ti as the process is
markovian (memoryless)
Continuous Time Markov Chain
1st characterization of a CTMC
An CTMC is fully characterized by the following
parameters:
{mi}iE with mi as the parameter of the exponential
distribution of sojourn time Ti
{pij}i≠j , with pij as the transition probability from i to j
when leaving state i
Continuous Time Markov Chain
Each CTMC is associated an underlying DTMC by
neglecting sojourn times.
0
a0
1
a1
2
a2
3
a3
4 …
0
d1
1
d2
2
d3
3
d4
4 …
C S = Server
The Queue C S
Customers (C)
CCC…C •
•
•
Customer =C C S
Queuing Models
Service times as well as inter-arrival times are
assumed independent and identically distributed
If not otherwise specified
Commonly used notation principle: A/B/C
A = The interarrival time distribution
B = The service time distribution
C = The number of parallel servers
Commonly used distributions
M = Markovian (exponential) - Memoryless
D = Deterministic distribution
G = General distribution
Example: M/M/c
Queuing system with exponentially distributed service and
inter-arrival times and c servers
Queuing Models
Notation of Kendall
The following is a standard notation system of
queueing systems
T/X/C/K/P/Z with
T: probability distribution of inter-arrival times
X: probability distribution of service times
C: Number of servers
K: Queue capacity
P: Size of the population
Z: service discipline
Queuing Models
Customer arrival process : T/X/C/K/P/Z
Loss of customers if
the queue Is full
Capacity K
Queuing Models
Size of the population : T/X/C/K/P/Z
The size of the population can be either finite or
infinite
Capacity Demand
Available Capacity c *
Terminology and Notation
Steady State condition
Enough time has passed for the system state to be independent
of the initial state as well as the elapsed time
The probability distribution of the state of the system remains the
same over time (is stationary).
Transient condition
Prevalent when a queuing system has recently begun operations
The state of the system is greatly affected by the initial state and
by the time elapsed since operations started
The probability distribution of the state of the system changes
with time
L W Lq Wq
L W Lq Wq
Queuing Models: M/M/1
M/M/1 queue is a useful approximate model when
service times have standard deviation approximately
equal to their means.
Single Server Queuing System (M/M/1)
Only one server
Poisson arrivals
Arrival population is unlimited
Exponential service times
All arrivals wait to be served
λ is constant
μ > λ (average service rate > average arrival rate)
Queuing Models: M/M/1
Assumptions - the Basic Queuing Process
Infinite Calling Populations
Independence between arrivals
The arrival process is Poisson with an expected arrival
rate
Independent of the number of customers currently in the
system
The queue configuration is a single queue with possibly
infinite length
No reneging or balking
The queue discipline is FIFO
The service mechanism consists of a single server with
exponentially distributed service times
= expected service rate when the server is busy
Queuing Models: M/M/1
Queuing Models: M/M/1
n= and n = for all values of n=0, 1, 2, …
0 1 2 n-1 n n+1
0 1 2 n-1 n n+1
2 (c-2) (c-1) c c
1
c1 ( / ) n ( / )c
1
P0
n! c! 1 ( /(c)
n 0
Steady State
( / ) n Condition:
P0 for n 1,2,, c
n! =(/c)<1
Pn
( / ) P
n
for n c 1, c 2,
c!c n c 0
Queuing Models: M/M/C
A Condition for existence of a steady state solution is that
= /(c) <1
( / ) c
Lq ( n c) Pn ... P
2 0
n c c!(1 )
W=Wq+(1/)
The proportion of arrivals who find Able idle and thus experience no
delay is P0 = 1- = 1/5 = 20%.
Baker: 1/ = 25 minutes and 2 = 22 = 4 minutes2:
(1 / 30) 2 [25 2 4]
LQ 2.097 customers
2(1 5 / 6)
The proportion of arrivals who find Baker idle and thus experience
no delay is P0 = 1- = 1/6 = 16.7%.
Although working faster on average, Able’s greater service variability
results in an average queue length about 30% greater than Baker’s.
Queuing Models: M/D/1
Single Server System With Constant Service Time
(M/D/1)
Poisson arrivals
Service times deterministic and constant (not random)
Has shorter queues than M/M/1 system
Lq and Wq are one-half as large
Queuing Models: M/D/1
Average length of queue
2
Lq
21
Average time waiting in queue
1
Wq
2 1
Average time spent in system
1 2
W
2 1
Queuing Models: M/D/1
Queuing Modeling and System Design
Design of queuing systems usually involve some kind
of capacity decision
The number of service stations
The number of servers per station
The service time for individual servers
The corresponding decision variables are , c and
Examples:
The number of doctors in a hospital,
The number of exits and cashiers in a supermarket,
The choice of machine type at a new investment decision,
The localization of toilets in a new building, etc…
Queuing Modeling and System Design
Two fundamental questions when designing (queuing)
systems
Which service level should we aim for?
How much capacity should we acquire?
The cost of increased capacity must be balanced
against the cost reduction due to shorter waiting time
Specify a waiting cost or a shortage cost accruing when
customers have to wait for service or…
… Specify an acceptable service level and minimize the
capacity under this condition
The shortage or waiting cost rate is situation dependent
and often difficult to quantify
Should reflect the monetary impact a delay has on the
organization where the queuing system resides