Anda di halaman 1dari 44

M/M/* Queues

Queuing Analysis:
Hongwei Zhang
http://www.cs.wayne.edu/~hzhang
Acknowledgement: this lecture is partially based on the slides of Dr. Yannis A. Korilis.
Outline
M/M/1 Queue
Poisson Arrivals See Time Averages (PASTA)
M/M/* Queues
Introduction to Sojourn Times Introduction to Sojourn Times
Outline
M/M/1 Queue
Poisson Arrivals See Time Averages (PASTA)
M/M/* Queues
Introduction to Sojourn Times Introduction to Sojourn Times
The M/M/1 Queue
Arrival process: Poisson with rate
Service times: iid, exponential with parameter
Service times and interarrival times: independent
Single server Single server
Infinite waiting room
N(t): Number of customers in system at time t (state)
0 1 n+1 n 2

Exponential Random Variables


X: exponential RV with
parameter
Y: exponential RV with
parameter
: independent
Proof:
( )
( )
{min{ , } } { , }
{ } { }
{min{ , } } 1
t t t
t
P X Y t P X t Y t
P X t P Y t
e e e
P X Y t e


+
+
> = > > =
= > > =
= =
=
X, Y: independent
Then:
1. min{X, Y}: exponential RV with
parameter +
2. P{X<Y} = /(+)
0 0
0 0
0 0
0
( )
0 0
{ } ( , )
(1 )
( )
1
y
XY
y
x y
y
y x
y y
y y
P X Y f x y dx dy
e e dx dy
e e dx dy
e e dy
e dy e dy







+
< = =
= =
= =
= =
= + =
+
= =
+ +



M/M/1 Queue: Markov Chain Formulation
Jumps of {N(t): t 0} triggered by arrivals and departures
{N(t): t 0} can jump only between neighboring states
Assume process at time t is in state i: N(t) = i 1
X
i
: time until the next arrival exponential with parameter
Y
i
: time until the next departure exponential with parameter
T
i
=min{X
i
,Y
i
}: time process spends at state i
T
i
: exponential with parameter
i
= +
P
i,i+1
=P{X
i
< Y
i
}= /(+), P
i,i-1
=P{Y
i
< X
i
}= /(+)
P
01
=1, and T
0
is exponential with parameter
{N(t): t 0} is a continuous-time Markov chain with
, 1 , 1
, 1 , 1
, 0
, 1
0, | | 1
i i i i i
i i i i i
ij
q P i
q P i
q i j


+ +

= =
= =
= >
M/M/1 Queue: Stationary Distribution?
Birth-death process DBE
0 1 n+1 n 2

Normalization constant
Stationary distribution
1
1 1 0
...
n n
n
n n n
p p
p p p p


=
= = = =
0 0
0 1
1 1 1 1 , if 1
n
n
n n
p p p

= =
(
= + = = <
(


(1 ), 0,1,...
n
n
p n = =
M/M/1 Queue (contd.)
Average number of customers in system?
Littles Theorem: average time in system?
1
0 0 0
2
(1 ) (1 )
1
(1 )
(1 ) 1
n n
n
n n n
N np n n
N




= = =
= = =
= = =


Average waiting time and number of customers in the queue
excluding service?

= =
1 1 N
T


= =

= =
1
and
1
2
W N T W
Q
M/M/1 Queue (contd.)
=/: utilization factor
=> =1-p
0
holds for any M/G/1 queue
too
Long term proportion of time
4
6
8
10
N
Long term proportion of time
that server is busy
Stability condition: <1
Arrival rate should be less
than the service rate
0
2
0 0.2 0.4 0.6 0.8 1

M/M/1 Queue: Discrete-Time Approach
Focus on times 0, , 2, ( arbitrarily small)
Study discrete time process N
k
= N(k)
Transition probabilities?
lim { ( ) } lim { }
k
t k
P N t n P N n

= = =
1 ( ) P = +
Discrete time Markov chain, omitting o()
00
, 1
, 1
1 ( )
1 ( ), 1
( ), 0
( ), 0
( ), | | 1
ii
i i
i i
ij
P
P i
P i
P i
P i j





+

= +
= +
= +
= +
= >
0 1 n+1 n 2


1 1 1 1
M/M/1 Queue: Discrete-Time Approach
Discrete-time birth-death process DBE:
0 1
n
n-1 2


1 1 1 1
Taking the limit 0:
Done!
1
1 0
[ ( )] [ ( )]
( ) ( )

( ) ( )
n n
n
n n


+ = +
( + +
= = =
(
+ +

L
0 0
0 0 0
( )
lim lim lim
( )
n n
n n
p p




( | | +
= =
| (
+
\
Transition Probabilities?
A
k
: number of customers that arrive in I
k
=(k, (k+1)]
D
k
: number of customers that depart in I
k
=(k, (k+1)]
Transition probabilities P
ij
depend on conditional probabilities: Q(a,d | n)
= P{A
k
=a, D
k
=d | N
k-1
=n}
Calculate Q(a,d | n) using arrival and departure statistics Calculate Q(a,d | n) using arrival and departure statistics
Use Taylor expansion e
-
=1-+o(), e
-
=1-+o(), to express as a
function of
Poisson arrivals: P{A
k
2}=o()
Probability there are more than 1 arrivals in I
k
is o()
Show: probability of more than one event (arrival or departure) in I
k
is
o()
See details in textbook
Example: Slowing Down
/
1 1 /
/
N N
N m
T mT
m


= = = =

= = =

/ m
/ m
/
1 1 /
1
N
N
T



= = =

= =

M/M/1 system: slow down the arrival and service rates by the same factor m
Utilization factors are the same stationary distributions the same, average
number in the system the same
Delay in the slower system is m times higher
Average number in queue is the same, but in the 1st system the customers move out
faster
/
( / )
/ /
m
m
W mW
m m


= = =

/
W


= =

Example: Statistical Multiplexing vs. TDM

m
/ m
/ m
/ m
/ m
m
m identical Poisson streams with rate /m; link with capacity 1; packet lengths iid,
exponential with mean 1/
Alternative: split the link to m channels with capacity 1/m each, and dedicate one
channel to each traffic stream
Delay in each queue becomes m times higher
Statistical multiplexing vs. TDM or FDM
When is TDM or FDM preferred over statistical multiplexing?
m
T mT

= =

Outline
M/M/1 Queue
Poisson Arrivals See Time Averages (PASTA)
M/M/* Queues
Introduction to Sojourn Times Introduction to Sojourn Times
PASTA Theorem
Markov chain: stationary or in steady-state:
Process started at the stationary distribution, or
Process runs for an infinite time t
Probability that at any time t, process is in state i is equal to
the stationary probability
Question: For an M/M/1 queue: given t is an arrival time,
what is the probability that N(t)=i?
Answer: Poisson Arrivals See Time Averages (PASTA)!
( )
lim { ( ) } lim
i
i
t t
T t
p P N t i
t

= = =
PASTA Theorem (contd.)
Steady-state probabilities:
Steady-state probabilities upon arrival:
lim { ( ) }
n
t
p P N t n

= =
lim { ( ) | arrival at }
n
t
a P N n t t

= =
Lack of Anticipation Assumption (LAA): Future inter-arrival times
and service times of previously arrived customers are independent
Theorem: In a queueing system satisfying LAA:
1. If the arrival process is Poisson:
2. Poisson is the only process with this property
(necessary and sufficient condition)
, 0,1,...
n n
a p n = =
PASTA Theorem (contd.)
Doesnt PASTA apply for all arrival processes?
Deterministic arrivals every 10 sec
Deterministic service times 9 sec
Upon arrival: system is always empty a
1
=0
1
Average time with one customer in system: p
1
=0.9
Customer averages need not be time averages
Randomization does not help, unless Poisson!
1
0
10 9 20 30 30 39
PASTA Theorem: Proof
Define A(t,t+), the event that an arrival occurs in [t, t+ )
Given that a customer arrives at t, probability of finding the system in
state n:
A(t,t+) is independent of the state before time t, N(t
-
)
0
{ ( ) | arrival at t} lim { ( ) | ( , )} P N t n P N t n A t t

= = = +
A(t,t+) is independent of the state before time t, N(t
-
)
N(t
-
) determined by arrival times <t, and corresponding service times
A(t,t+) independent of arrivals <t [Poisson]
A(t,t+) independent of service times of customers arrived <t [LAA]
=>
0 0
0
{ ( ) , ( , )}
( ) lim { ( ) | ( , )} lim
{ ( , )}
{ ( ) } { ( , )}
lim { ( ) }
{ ( , )}
n
P N t n A t t
a t P N t n A t t
P A t t
P N t n P A t t
P N t n
P A t t

= +
= = + =
+
= +
= = =
+
lim ( ) lim { ( ) }
n n n
t t
a a t P N t n p


= = = =
PASTA Theorem: Intuitive Proof
t
a
and t
o
: randomly selected arrival and observation times, respectively
The arrival processes prior to t
a
and t
o
respectively are stochastically
identical
The probability distributions of the time to the first arrival before t
a
and t
o
are both exponentially distributed with parameter (why?) are both exponentially distributed with parameter (why?)
Extending this to the 2nd, 3rd, etc. arrivals before t
a
and t
o
establishes the
result
State of the system at a given time t depends only on the arrivals (and
associated service times) before t
Since the arrival processes before arrival times and random times are
identical, so is the state of the system they see
Arrivals that Do not See Time-Averages
Example 1: Non-Poisson arrivals
IID inter-arrival times, uniformly distributed between in 2 and 4 sec
Service times deterministic 1 sec
Upon arrival: system is always empty
=1/3, T=1 N=T/=1/3 p =1/3 =1/3, T=1 N=T/=1/3 p
1
=1/3
Example 2: LAA violated
Poisson arrivals
Service time of customer i: S
i
= T
i+1
, < 1
Upon arrival: system is always empty
Average time the system has 1 customer: p
1
=
Distribution after Departure
Steady-state probabilities after departure:
Under very general assumptions:
N(t) changes in unit increments
limits a and d exist (i.e., system reaches steady state with all n
| departure at lim { ( ) }
n
t
d P X n t t
+

= =
limits a
n
and d
n
exist (i.e., system reaches steady state with all n
having positive steady-state distribution)
a
n
= d
n
, n=0,1,
=> In steady-state, system appears stochastically identical to an arriving and
departing customer
Poisson arrivals + LAA: an arriving and a departing customer see a
system that is stochastically identical to the one seen by an observer
looking at an arbitrary time
Outline
M/M/1 Queue
Poisson Arrivals See Time Averages (PASTA)
M/M/* Queues
Introduction to Sojourn Times Introduction to Sojourn Times
M/M/* Queues
Poisson arrival process
Interarrival times: iid, exponential
Service times: iid, exponential
Service times and interarrival times: independent
N(t): Number of customers in system at time t (state) N(t): Number of customers in system at time t (state)
{N(t): t 0} can be modeled as a continuous-time Markov chain
Transition rates depend on the characteristics of the system
PASTA Theorem always holds
M/M/1/K Queue
M/M/1 with finite waiting room
At most K customers in the system
0 1 K K-1 2

At most K customers in the system


Customer that upon arrival finds K customers in system is dropped
Stationary distribution:
Stability condition: always stable even if 1
Probability of loss using PASTA theorem:
0
0
1
, 1, 2,...,
1
1
n
n
K
p p n K
p

+
= =

1
(1 )
{loss} { ( ) }
1
K
K
P P N t K

= = =

M/M/1/K Queue (proof)


Exactly as in the M/M/1 queue:
0 1 K K-1 2

0
, 1, 2,...,
n
n
p p n K = =
Normalization constant:
Generalize: Truncating a Markov chain
1
0 0
0 1
0 1
1
1 1 1
1
1

1
K K K
n
n
n n
K
p p p
p

+
= =
+

= = =


0
, 1, 2,...,
n
p p n K = =
Truncating a Markov Chain
{X(t): t 0} continuous-time Markov chain with stationary distribution
{p
i
: i=0,1,}
S a subset of {0,1,}: set of states; Observe process only in S
Eliminate all states not in S
Set 0, , q q j S i S = = % % Set
{Y(t): t 0}: resulting truncated process; If irreducible:
Continuous-time Markov chain
Stationary distribution
if
0 if
j
i
j
i S
p
j S
p
p
j S

%
0, ,
ji ij
q q j S i S = = % %
Truncating a Markov Chain: proof
Possible sufficient condition (GBE)
Verify that distribution of truncated process
1. Satisfies the GBE
( ) ( )
j
i
j ji i ij j ji i ij ji ij
p
p
p q p q p q p q q q
p S p S
= = =

,
j ji i ij
i S i S
p q p q j S

=

2. Satisfies the probability conservation law:
Relates to reversibility
Holds for multidimensional chains
( ) ( )
,
j ji i ij j ji i ij ji ij
i i i S i S i S i S
j ji i ij j ji i ij
i S i S i S i S
p q p q p q p q q q
p S p S
p q p q p q p q j S


= = =
= =


% % % % % %
( )
1, ( )
( ) ( )
i
i i
i S i S i S
p p S
p p S p
p S p S

= = =

%
M/M/1 Queue with State-Dependent Rates
Interarrival times: independent, exponential, with parameter
n
when
at state n
0 1 n+1 n 2
0

1 n

+
1

1 n

at state n
Service times: independent, exponential, with parameter
n
when at
state n
Service times and interarrival times: independent
{N(t): t 0} is a birth-death process
Stationary distribution:
1
1 1
0 0
0 1 0
1 1
, 1 1
n n
i i
n
i n i
i i
p p n p


= = =
+ +
(
= = +
(


M/M/c Queue
Poisson arrivals with rate
Exponential service times with parameter
0 1 c+1 c 2

c
Exponential service times with parameter
c servers
Arriving customer finds n customers in system
n < c: it is routed to any idle server
n c: it joins the waiting queue all servers are busy
Birth-death process with state-dependent death rates
[Time spent at state n before jumping to n -1 is the minimum of
B
n
= min{n,c} exponentials with parameter ]
, 1
,
n
n n c
c n c

M/M/c Queue
0 1 c+1 c 2

c
Detailed balance equations
1 ( )
n
n
c | |
Normalizing
1 0 0 0
0 0 0
1 ( )
1 : ,
( 1) ! !
1
:
! ! !
n
n
n n
n c c n c n
c c n
n c
c
n c p p p p p
n n n n n c
c c
n c p p p p p
c c c c c c


| |
= = = = =
|

\
| | | | | | | |
> = = = =
| | | |
\ \ \ \
L L
1 1
1 1
0
0 1 0
( ) ( ) ( ) ( ) 1
1 1
! ! ! ! 1
k c k c
c c
k c
n
n k k c k
c c c c
p p
k c k c

= = = =
( (
= = + + = +
( (



M/M/c Queue
Probability of queueing arriving customer finds all servers busy
Erlang-C Formula: used in telephony and circuit-switching
0 0
( ) ( ) 1
{queueing}
! ! 1
c c
n c
Q n
n c n c
c c
P P p p p
c c

= =
= = = =


Call requests arrive with rate ; holding time of a call exponential
with mean 1/
c available circuits on a transmission line
A call that finds all c circuits busy, continuously attempts to find a
free circuit remains in queue
M/M/c/c Queue: c-server loss system
A call that finds all c circuits busy is blocked
Erlang-B Formula: popular in telephony
M/M/c Queue
Expected number of customers waiting in queue not in service
Average waiting time (in queue)
0 0
2
2
( ) ( )
( ) ( )
! ! (1 )
(1 )
(1 ) 1
c c
n c
Q n
n c n c
Q Q
c c
N n c p p n c p
c c
P P

= =
= = =

= =


Average waiting time (in queue)
Average time in system (queued + serviced)
Expected number of customers in system
(1 )
Q
Q
N
W P


= =

1 1
(1 )
Q
T W P


= + = +

(1 )
Q
N T P c

= = +

M/M/c/c Queue: c-Server Loss System


c servers, no waiting room
An arriving customer that finds all servers busy is blocked
Stationary distribution:
0 1 c 2

c
Stationary distribution:
Probability of blocking (using PASTA):
Erlang-B Formula: used in telephony and circuit-switching
Results hold for an M/G/c/c queue
1
0
( / ) ( / )
, 0,1,...,
! !
n k c
n
k
p n c
n k


=
(
= =
(

1
0
( / ) ( / )
! !
c k c
c
k
p
c k


=
(
=
(

M/M/ Queue: Infinite-Server System


Infinite number of servers no queueing
Stationary distribution:
0 1 n+1 n 2

( 1) n +

n
Stationary distribution:
Poisson with rate /
Average number of customers & average delay:
The results hold for an M/G/ queue
/
( / )
, 0,1,...
!
n
n
p e n
n



= =
1
,
N
N T


= = =
M/M/c/c and M/M/ Queues (proof)
DBE:
0 1 n+1 n 2

( 1) n +

n
1 1 2 0
( )
( 1) ( 1)
n n n n n
n p p p p p p
n n n n n



= = = = =

L
L
Normalizing:
1 1 2 0
0
( )
( 1) ( 1)
( / )
, 0,1,...
!
n n n n n
n
n
n p p p p p p
n n n n n
p p n
n




= = = = =

= =
L
L
1
0
0
( / )
, for M/M/c/c
!
k c
k
p
k


=
(
=
(

1
/
0
0
( / )
, for M/M/c/c
!
k
k
p e
k


=
(
= =
(

M/M/
Outline
M/M/1 Queue
Poisson Arrivals See Time Averages (PASTA)
M/M/* Queues
Introduction to Sojourn Times Introduction to Sojourn Times
Sum of IID Exponential RVs
X
1
, X
2
,, X
n
: iid, exponential with parameter
T = X
1
+ X
2
++ X
n
The probability density function of T is:
1
( )
( ) , 0
( 1)!
n
t
T
t
f t e t
n

[Gamma distribution with parameters (n, )]


If X
i
is the time between arrivals i -1 and i of a certain type of events,
then T is the time until the n
th
event occurs
For arbitrarily small :
Cummulative distribution function:
1
( )
{ arrival occurs in [ , )} ( )
( 1)!
n
th t
T
t
P n t t f t e
n

+ = =

1
0
( )
{ } 1 { arrival occurs after }
( 1)!
n
t
s th
n
s
P t t e ds P n t
n

= =

Sum of IID Exponential RVs


Example 1: Poisson arrivals with rate

1
: time until arrival of 1
st
customer

i
: i
th
interarrival time

1
,
2
,,
n
: iid exponential with parameter
1
,
2
,,
n
: iid exponential with parameter
t
n
=
1
+
2
+,+
n
: arrival time of n-th customer
t
n
follows Gamma with parameters (n, ).
For arbitrarily small :
1 1
0
( ) ( )
( ) , 0; { }
( 1)! ( 1)!
n n
t
t t
n
t t
f t e t P t t e dt
n n





= =

1
( )
{ arrival occurs in [ , )} ( )
( 1)!
n
th t
T
t
P n t t f t e
n

+ = =

Sojourn Times in a M/M/1 Queue


M/M/1 Queue FCFS
T
i
: time spent in system (queueing + service) by customer i
T
i
: exponentially distributed with parameter -
Example of a sojourn time of a customer: describes the
evolution of the queue together with the specific customer
M/M/1 Queue: Sojourn Times (proof)
M/M/1 Queue: Sojourn Times (proof)
Summary
M/M/1 Queue
Poisson Arrivals See Time Averages (PASTA)
M/M/* Queues
Introduction to Sojourn Times Introduction to Sojourn Times
Homework #9
Problems 3.23 and 3.26 of R1
Hints:
Prob. 3.23: see book R1
Prob. 3.26: define system state as the number of operational machines
Grading:
Overall points 100
50 points for 3.23
50 points for 3.26

Anda mungkin juga menyukai