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.

15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

  • Upload
    vothuy

  • View
    219

  • Download
    4

Embed Size (px)

Citation preview

Page 1: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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.

Page 2: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Outline

� M/M/1 Queue

� Poisson Arrivals See Time Averages (PASTA)

� M/M/* Queues

Introduction to Sojourn Times� Introduction to Sojourn Times

Page 3: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Outline

� M/M/1 Queue

� Poisson Arrivals See Time Averages (PASTA)

� M/M/* Queues

Introduction to Sojourn Times� Introduction to Sojourn Times

Page 4: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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+1n2

λ

µ

λ

µ

λ

µ

λ

µ

Page 5: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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

yx y

yy 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

λ µ

µ λ

µ λ

µ λ µ

λ µ

µ λ

µ

µµ λ µ

λ µµ λ

λ µ λ µ

∞− −

∞− −

∞− −

∞ ∞− − +

< = =

= ⋅ =

= =

= − =

= − + =+

= − =+ +

∫ ∫

∫ ∫

∫ ∫

∫ ∫

Page 6: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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

� Xi: time until the next arrival – exponential with parameter λ

� Yi: time until the next departure – exponential with parameter µ

� Ti =min{Xi,Yi}: time process spends at state i

� Ti : exponential with parameter νi= λ+µ

� Pi,i+1=P{Xi < Yi}= λ/(λ+µ), Pi,i-1=P{Yi < Xi}= µ/(λ+µ)

� P01=1, and T0 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

ν λ

ν µ+ +

− −

= = ≥

= = ≥

= − >

Page 7: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/1 Queue: Stationary Distribution?

� Birth-death process → DBE

0 1 n+1n2

λ

µ

λ

µ

λ

µ

λ

µ

� 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 1n

n

n n

p p pρ ρ ρ∞ ∞

= =

= ⇔ + = ⇔ = − <

∑ ∑

(1 ), 0,1,...n

np nρ ρ= − =

Page 8: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/1 Queue (contd.)

� Average number of customers in system?

� Little’s 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?

λµλµ

λ

λλ −=

−==

11NT

ρ

ρλ

λµ

ρ

µ −==

−=−=

1 and

1 2

WNTW Q

Page 9: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/1 Queue (contd.)

� ρ=λ/µ: utilization factor

� => ρ=1-p0

� 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

ρρρρ

Page 10: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/1 Queue: Discrete-Time Approach

� Focus on times 0, δ, 2δ,… (δ arbitrarily small)

� Study discrete time process Nk = N(δk)

Transition probabilities?

lim { ( ) } lim { }kt 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+1n2

λδ

µδ

λδλδ

µδ

λδ

µδµδ1 λδ µδ− − 1 λδ µδ− − 1 λδ µδ− −1 λδ−

Page 11: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/1 Queue: Discrete-Time Approach

� Discrete-time birth-death process → DBE:

0 1 nn-12

λδ

µδ

λδλδ

µδ

λδ

µδµδ1 λδ µδ− − 1 λδ µδ− − 1 λδ µδ− −1 λδ−

� Taking the limit δ→0:

Done!

1

1 0

[ ( )]π [ ( )]π

( ) ( )π π π

( ) ( )

n n

n

n n

µδ ο δ λδ ο δ

λδ ο δ λδ ο δ

µδ ο δ µδ ο δ

+ = + ⇒

+ += = = + +

L

0 00 0 0

( )limπ lim limπ

( )

n n

n np p

δ δ δ

λδ ο δ λ

µδ ο δ µ→ → →

+= ⇒ = +

Page 12: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Transition Probabilities?

� Ak: number of customers that arrive in Ik=(kδ, (k+1)δ]

� Dk: number of customers that depart in Ik=(kδ, (k+1)δ]

� Transition probabilities Pij depend on conditional probabilities: Q(a,d | n)

= P{Ak=a, Dk=d | Nk-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{Ak ≥ 2}=o(δ)

� Probability there are more than 1 arrivals in Ik is o(δ)

�Show: probability of more than one event (arrival or departure) in Ik is

o(δ)

☺ See details in textbook

Page 13: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Example: Slowing Down

/

1 1 /

/

N N

N mT mT

m

ρ λ µ λ

ρ λ µ µ λ

λ µ λ

′′ = = = =

′− − −

′′ = = =

λµ

/ mλ/ mµ

/

1 1 /

1

N

NT

ρ λ µ λ

ρ λ µ µ λ

λ µ λ

= = =− − −

= =−

� 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

mW mW

m m

λ µ λ

ρ λ µ

µ λ µ λ

′′ = = =

− −

/W

λ µ λ

ρ λ µ

µ λ µ λ

= =− −

Page 14: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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?

mT mT

µ λ′ = =

Page 15: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Outline

� M/M/1 Queue

� Poisson Arrivals See Time Averages (PASTA)

� M/M/* Queues

Introduction to Sojourn Times� Introduction to Sojourn Times

Page 16: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

“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

it t

T tp P N t i

t→∞ →∞= = =

Page 17: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

PASTA Theorem (contd.)

� Steady-state probabilities:

� Steady-state probabilities upon arrival:

lim { ( ) }nt

p P N t n→∞

= =

lim { ( ) | arrival at }n

ta P N nt 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= =

Page 18: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

PASTA Theorem (contd.)

Doesn’t PASTA apply for all arrival processes?

� Deterministic arrivals every 10 sec

� Deterministic service times 9 sec

Upon arrival: system is always empty a1=01

Average time with one customer in system: p1=0.9

� “Customer” averages need not be time averages

� Randomization does not help, unless Poisson!

1

0 109 20 30 30 39

Page 19: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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 ta t P N t n A t t

P A t t

P N t n P A t tP N t n

P A t t

δ δ

δ

δδ

δ

δ

δ

−−

→ →

−−

= += = + =

+

= += = =

+

lim ( ) lim { ( ) }n n n

t ta a t P N t n p

→∞ →∞= = = =

Page 20: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

PASTA Theorem: Intuitive Proof

� ta and to : randomly selected arrival and observation times, respectively

� The arrival processes prior to ta and to respectively are stochastically

identical

� The probability distributions of the time to the first arrival before ta and to

are both exponentially distributed with parameter λ (why?)are both exponentially distributed with parameter λ (why?)

� Extending this to the 2nd, 3rd, etc. arrivals before ta and to 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

Page 21: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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 → p1=1/3

Example 2: LAA violated

� Poisson arrivals

� Service time of customer i: Si= αTi+1, α < 1

Upon arrival: system is always empty

Average time the system has 1 customer: p1= α

Page 22: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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

td P X nt t+

→∞= =

� limits an and dn exist (i.e., system reaches steady state with all n

having positive steady-state distribution)

an = dn, 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

Page 23: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Outline

� M/M/1 Queue

� Poisson Arrivals See Time Averages (PASTA)

� M/M/* Queues

Introduction to Sojourn Times� Introduction to Sojourn Times

Page 24: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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

Page 25: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/1/K Queue

� M/M/1 with finite waiting room

� At most K customers in the system

0 1 KK-12

λ

µ

λ

µ

λ

µ

λ

µ

� 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

KP P N t K

ρ ρ

ρ +

−= = =

Page 26: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/1/K Queue (proof)

� Exactly as in the M/M/1 queue:

0 1 KK-12

λ

µ

λ

µ

λ

µ

λ

µ

0 , 1,2,...,n

np p n Kρ= =

� Normalization constant:

Generalize: Truncating a Markov chain

1

0 0

0 1

0 1

11 1 1

1

1

1

KK Kn

n

n n

K

p p p

p

ρρ

ρρ

ρ

+

= =

+

−= ⇒ = ⇒ =

−−

⇒ =−

∑ ∑

0 , 1,2,...,np p n Kρ= =

Page 27: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Truncating a Markov Chain

� {X(t): t ≥ 0} continuous-time Markov chain with stationary distribution

{pi: 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 distributionif

0 if

j

ij

i S

pj S

pp

j S

=

∑%

0, ,ji ij

q q j S i S= = ∈ ∉% %

Page 28: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Truncating a Markov Chain: proof

� Possible sufficient condition (GBE)

� Verify that distribution of truncated process

1. Satisfies the GBE

( ) ( )

j ij ji i ij j ji i ij ji ij

p pp 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 qp S p S

p q p q p q p q j S∈ ∈ ∈ ∈

∈ ∈ ∈ ∈

= ⇒ = ⇒ =

⇒ = ⇒ = ∈

∑ ∑ ∑ ∑ ∑ ∑

∑ ∑ ∑ ∑% % % % % %

( )1, ( )

( ) ( )

ii i

i S i S i S

p p Sp p S p

p S p S∈ ∈ ∈

= = = ≡∑ ∑ ∑%

Page 29: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/1 Queue with State-Dependent Rates

� Interarrival times: independent, exponential, with parameter λn when

at state n

0 1 n+1n2

1nµ +

1nλ −

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 01 1

, 1 1n n

i i

n

i n ii i

p p n pλ λ

µ µ

−− ∞ −

= = =+ +

= ≥ = +

∏ ∑∏

Page 30: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/c Queue

� Poisson arrivals with rate λ

� Exponential service times with parameter µ

0 1 c+1c2

λ

µ

λ

λ

λ

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 Bn= min{n,c} exponentials with parameter µ]

, 1

,n

n n c

c n c

µµ

µ

≤ ≤=

Page 31: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/c Queue

0 1 c+1c2

λ

µ

λ

λ

λ

� 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 nc c n

n c

cn c p p p p p

n n n n n c

c cn c p p p p p

c c c c c c

λ λ λ λ λ ρ λρ

µ µ µ µ µ µ

λ λ λ λ ρ

µ µ µ µ

− −

≤ ≤ = = = = = ≡

> = = = =

L L

1 11 1

0

0 1 0

( ) ( ) ( ) ( ) 11 1

! ! ! ! 1

k c k cc ck c

n

n k k c k

c c c cp p

k c k c

ρ ρ ρ ρρ

ρ

− −∞ − ∞ −

= = = =

= ⇒ = + + = + −

∑ ∑ ∑ ∑

Page 32: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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 cn c

Q n

n c n c

c cP 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

Page 33: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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 cn c

Q nn c n c

Q Q

c cN 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

NW P

ρ

λ λ ρ= =

1 1

(1 )QT W P

ρ

µ λ ρ µ= + = +

(1 )QN T P c

ρλ ρ

ρ= = +

Page 34: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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 c2

λ

µ

λ

λ

� 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 kc

n

k

p n cn k

λ µ λ µ−

=

= =

1

0

( / ) ( / )

! !

c kc

c

k

pc k

λ µ λ µ−

=

=

Page 35: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/∞ Queue: Infinite-Server System

� Infinite number of servers – no queueing

� Stationary distribution:

0 1 n+1n2

λ

µ

λ

( 1)n µ+

λ

λ

� Stationary distribution:

Poisson with rate λ/µ

� Average number of customers & average delay:

The results hold for an M/G/∞ queue

/( / ), 0,1,...

!

n

np e n

n

λ µλ µ −= =

1,

NN T

λ

µ λ µ= = =

Page 36: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/c/c and M/M/∞ Queues (proof)

� DBE:

0 1 n+1n2

λ

µ

λ

( 1)n µ+

λ

λ

1 1 2 0( )( 1) ( 1)

n n n n nn p p p p p p

n n n n n

λ λ λ λ λ λµ λ

µ µ µ µ µ µ− − −

⋅= ⇒ = = = =

− ⋅ −

LL

� Normalizing:

1 1 2 0

0

( )( 1) ( 1)

( / ), 0,1,...

!

n n n n n

n

n

n p p p p p pn n n n n

p p nn

µ λµ µ µ µ µ µ

λ µ

− − −= ⇒ = = = =− ⋅ −

⇒ = =

LL

1

0

0

( / ), for M/M/c/c

!

kc

k

pk

λ µ−

=

= ∑

1

/

0

0

( / ), for M/M/c/c

!

k

k

p ek

λ µλ µ−

∞−

=

= = ∑ M/M/∞

Page 37: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Outline

� M/M/1 Queue

� Poisson Arrivals See Time Averages (PASTA)

� M/M/* Queues

Introduction to Sojourn Times� Introduction to Sojourn Times

Page 38: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Sum of IID Exponential RV’s

� X1, X2,…, Xn: iid, exponential with parameter λ

� T = X1+ X2+…+ Xn

The probability density function of T is:1( )

( ) , 0( 1)!

nt

T

tf t e t

n

λλλ

−−= ≥

[Gamma distribution with parameters (n, λ)]

If Xi is the time between arrivals i -1 and i of a certain type of events,

then T is the time until the nth event occurs

For arbitrarily small δ:

Cummulative distribution function:

1( )

{ arrival occurs in [ , )} ( )( 1)!

nth t

T

tP n t t f t e

n

λλδ δ λδ

−−+ = =

1

0

( ){ } 1 { arrival occurs after }

( 1)!

nt

s th

n

sP t t e ds P n t

n

λλλ

−−≤ = = −

−∫

Page 39: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Sum of IID Exponential RV’s

Example 1: Poisson arrivals with rate λ

� τ1: time until arrival of 1st customer

� τi: ith interarrival time

� τ1, τ2,…, τn: iid exponential with parameter λ� τ1, τ2,…, τn: iid exponential with parameter λ

� tn= τ1+ τ2+…,+τn: arrival time of n-th customer

tn follows Gamma with parameters (n, λ).

For arbitrarily small δ:

1 1

0

( ) ( )( ) , 0; { }

( 1)! ( 1)!

n nt

t t

n

t tf t e t P t t e dt

n n

λ λλ λλ λ

− −− −= ≥ ≤ =

− −∫

1( )

{ arrival occurs in [ , )} ( )( 1)!

nth t

T

tP n t t f t e

n

λλδ δ λδ

−−+ = =

Page 40: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Sojourn Times in a M/M/1 Queue

� M/M/1 Queue – FCFS

� Ti: time spent in system (queueing + service) by customer i

� Ti: exponentially distributed with parameter µ-λ

� Example of a sojourn time of a customer: describes the

evolution of the queue together with the specific customer

Page 41: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/1 Queue: Sojourn Times (proof)

Page 42: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

M/M/1 Queue: Sojourn Times (proof)

Page 43: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

Summary

� M/M/1 Queue

� Poisson Arrivals See Time Averages (PASTA)

� M/M/* Queues

Introduction to Sojourn Times� Introduction to Sojourn Times

Page 44: 15 - M-M-Star Queues.ppt - cs.wayne.eduhzhang/courses/7290/Lectures/15... · M/M/* Queues Queuing Analysis: Hongwei Zhang hzhang Acknowledgement: this lecture is partially based on

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