queues lecturer: stanley b. gershwin · 2019-09-13 · lecturer: stanley b. gershwin . stochastic...

82
Queues Lecturer: Stanley B. Gershwin

Upload: others

Post on 29-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Queues

Lecturer: Stanley B. Gershwin

Page 2: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Stochasticprocesses

• t is time.

• X() is a stochastic process if X(t) is a random variable for every t.

• t is a scalar — it can be discrete or continuous.

• X(t) can be discrete or continuous, scalar or vector.

Page 3: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Stochastic Markov processes

processes

• A Markov process is a stochastic process in whichthe probability of finding X at some value at timet + δt depends only on the value of X at time t.

• Or, let x(s), s ≤ t, be the history of the values of X

before time t and let A be a possible value of X. Then prob{X(t + δt) = A|X(s) = x(s), s ≤ t} = prob{X(t + δt) = A|X(t) = x(t)}

Page 4: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Stochastic Markov processes

processes

• In words: if we know what X was at time t, we don’t gain any more useful information about X(t + δt) by also knowing what X was at any time earlier than t.

• This is the definition of a class of mathematical models. It is NOT a statement about reality!! That is, not everything is a Markov process.

Page 5: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov Example

processes

• I have $100 at time t = 0.

• At every time t ≥ 1, I have $N(t).

⋆ A (possibly biased) coin is flipped. ⋆ If it lands with H showing, N(t + 1) = N(t) + 1.⋆ If it lands with T showing, N(t + 1) = N(t) − 1.

N(t) is a Markov process. Why?

Page 6: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

States and transitions

• States can be numbered 0, 1, 2, 3, ... (or withmultiple indices if that is more convenient).

• Time can be numbered 0, 1, 2, 3, ... (or 0, Δ, 2Δ, 3Δ, ... if more convenient).

• The probability of a transition from j to i in one time unit is often written Pij, where

Pij = prob{X(t + 1) = i|X(t) = j}

Page 7: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

States and transitions

Transition graph14

P 14

P 24

P 64

P 45

14 P 14

P 24

P 64

1 − −−

1

2

3

4

5

6

7

Pij is a probability. Note that Pii = 1 − m,m � Pmi.=i

Page 8: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

States and transitions

Example : H(t) is the number of Hs after t coin flips.

Assume probability of H is p.

ppp p p 0 1 2 3 4

1−p 1−p 1−p 1−p 1−p

Page 9: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

States and transitions

Example : Coin flip bets on Slide 5.

Assume probability of H is p.

1−p 1−p 1−p 1−p 1−p 1−p 1−p 1−p 1−p

100 1029896 10397 10199

p p p p p p p p p

Page 10: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

States and transitions

• Define πi(t) = prob{X(t) = i}.

• Transition equations: πi(t + 1) = j Pijπj(t).(Law of Total Probability)

• Normalization equation: i πi(t) = 1.

Page 11: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

States and transitions

P 45

4

5

1 − P − P −P 1414 24 64

Transition equation:

π4(t + 1) = π5(t)P45

+π4(t)(1 − P14 − P24 − P64)

Page 12: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

States and transitions

14 P 14

P 24

P 64

P 45

14 P 14

P 24

P 64

1 − −−

1

2

3

4

5

6

7

prob{X(t + 1) = 2}

= prob{X(t + 1) = 2|X(t) = 1}prob{X(t)

+prob{X(t + 1) = 2|X(t) = 2}prob{X(t)

+prob{X(t + 1) = 2|X(t) = 4}prob{X(t)

+prob{X(t + 1) = 2|X(t) = 5}prob{X(t)

= 1}

= 2}

= 4}

= 5}

Page 13: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

States and transitions

14 P 14

P 24

P 64

P 45

14 P 14

P 24

P 64

1 − −−

1

2

3

4

5

6

7

Or, since

Pij = prob{X(t + 1) = i|X(t) = j}

and

πi(t) = prob{X(t) = i},

π2(t + 1) = P21π1(t) + P22π2(t) + P24π4(t) + P25π5(t)

Note that P22 = 1 − P52.

Page 14: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

� �

Discrete state, discrete time

States and transitions

limt→∞ πi(t), if it exists.

Markovprocesses

• Steady state: πi =

• Steady-state transition equations: πi = j Pijπj.

• Alternatively, steady-state balance equations: πi m,m � Pmi = j,j=i Pijπj=i �

• Normalization equation: i πi = 1.

Page 15: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

1

Markov processes

Discrete state, discrete time

States and transitions

14 P 14

P 24

1 − −−14 P 14

P 24 64

P 45

44

5

2

5

6

P 64

P Balance equation:

π4(P14 + P24 + P64)

= π5P45

in steady state only .

Page 16: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

Geometric distribution

Consider a two-state system. The system can go from 1 to 0, but not from 0 to 1.

1 0

p

1−p 1

Let p be the conditional probability that the system is in state 0 at time t + 1, given that it is in state 1 at time t. Then

p = prob [α(t + 1) = 0|α(t) = 1] .

Page 17: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov Discrete state, discrete time

processes 1 0

p

1−p 1

Let π(α, t) be the probability of being in state α at time t.

Then, since

π(0, t + 1) = prob [α(t + 1) = 0|α(t) = 1] prob [α(t) = 1]

+ prob [α(t + 1) = 0|α(t) = 0] prob [α(t) = 0],

we have π(0, t + 1) = pπ(1, t) + π(0, t),

π(1, t + 1) = (1 − p)π(1, t),

and the normalization equation

π(1, t) + π(0, t) = 1.

Page 18: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov Discrete state, discrete time

processes 1 0

p

1−p 1

Assume that π(1, 0) = 1. Then the solution is

π(0, t) = 1 − (1 − p)t,

π(1, t) = (1 − p)t.

Page 19: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov Discrete state, discrete time

processes 1 0

p

1−p 1

Geometric Distribution

t

pro

bab

ility

0 10 20 30 0

0.2

0.4

0.6

0.8

1

p(0,t)p(1,t)

Page 20: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

Unreliable machine

1=up; 0=down.

1−p 1−r

0

p

1

r

Page 21: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

Unreliable machine

The probability distribution satisfies

π(0, t + 1) = π(0, t)(1 − r) + π(1, t)p,

π(1, t + 1) = π(0, t)r + π(1, t)(1 − p).

Page 22: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

Unreliable machine

It is not hard to show that

π(0, t) = π(0, 0)(1 − p − r)t

+ p �

1 − (1 − p − r)t �

, r + p

π(1, t) = π(1, 0)(1 − p − r)t

r � �

+ 1 − (1 − p − r)t . r + p

Page 23: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

Unreliable machine

Discrete Time Unreliable Machine

t

pro

bab

ility

0 20 40 60 80 100 0

0.2

0.4

0.6

0.8

1

p(0,t)p(1,t)

Page 24: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

Unreliable machine

As t → ∞, p

π(0) → , r + p

rπ(1) →

r + p which is the solution of

π(0) = π(0)(1 − r) + π(1)p,

π(1) = π(0)r + π(1)(1 − p).

Page 25: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, discrete time

Unreliable machine

If the machine makes one part per time unit when it is operational, the average production rate is

r π(1) =

r + p

Page 26: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

States and transitions

• States can be numbered 0, 1, 2, 3, ... (or withmultiple indices if that is more convenient).

• Time is a real number, defined on (−∞, ∞) or a smaller interval.

• The probability of a transition from j to i during [t, t + δt] is approximately λijδt, where δt is small, and

λijδt ≈ prob{X(t + δt) = i|X(t) = j} for i � j=

Page 27: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

States and transitions

Transition graph

1

2

3

4

5

6

7

1414

λ 24

λ 45

λ 64

λ

λij is a probability rate. λijδt is a probability.

Page 28: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

States and transitions

Transition equation

Define πi(t) = prob{X(t) = i}. Then for δt small,

π5(t + δt) ≈

(1 − λ25δt − λ45δt − λ65δt)π5(t)

+λ52δtπ2(t)+ λ53δtπ3(t)+ λ56δtπ6(t)+ λ57δtπ7(t)

Page 29: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

States and transitions

Or, π5(t + δt) ≈ π5(t)

−(λ25 + λ45 + λ65)π5(t)δt

+(λ52π2(t) + λ53π3(t) + λ56π6(t) + λ57π7(t))δt

Page 30: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

States and transitions

Or, π5(t + δt) − π5(t) dπ5

lim = (t) = δt→0 δt dt

−(λ25 + λ45 + λ65)π5(t)

+λ52π2(t) + λ53π3(t) + λ56π6(t) + λ57π7(t)

Page 31: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

States and transitions

• Define πi(t) = prob{X(t) = i}

• It is convenient to define λii = − j � λji =i

• Transition equations: dπi(t)

= �

λijπj(t). dt

j

• Normalization equation: i πi(t) = 1.

Page 32: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

� �

Discrete state, continuous time

States and transitions

= limt→∞ πi(t), if it exists.

Markovprocesses

• Steady state: πi

• Steady-state transition equations: 0 = j λijπj.

• Alternatively, steady-state balance equations: πi m,m � λmi = j,j=i λijπj=i �

• Normalization equation: i πi = 1.

Page 33: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

States and transitions

Sources of confusion in continuous time models:

• Never Draw self-loops in continuous time markov process graphs.

• Never write 1 − λ14 − λ24 − λ64. Write

⋆ 1 − (λ14 + λ24 + λ64)δt, or ⋆ −(λ14 + λ24 + λ64)

• λii = − j=� i λji is NOT a rate and NOT a probability. It is ONLY a convenient notation.

Page 34: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

Exponential

Exponential random variable T : the time to move from state 1 to state 0.

1 0

µ

Page 35: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

Exponential

π(0, t + δt) =

prob [α(t + δt) = 0|α(t) = 1] prob [α(t) = 1]+

prob [α(t + δt) = 0|α(t) = 0] prob[α(t) = 0]. or

π(0, t + δt) = pδtπ(1, t) + π(0, t) + o(δt)

or dπ(0, t)

= pπ(1, t). dt

Page 36: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

Exponential

Since π(0, t) + π(1, t) = 1,

dπ(1, t) = −pπ(1, t).

dt If π(1, 0) = 1, then

π(1, t) = e−pt

and π(0, t) = 1 − e−pt

Page 37: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

Exponential

The probability that the transition takes place at some T ∈ [t, t + δt] is

prob [α(t + δt) = 0 and α(t) = 1] = e −ptpδt.

The exponential density function is pe−pt.

The time of the transition from 1 to 0 is said to beexponentially distributed with rate p. The expectedtransition time is 1/p. (Prove it!)

Page 38: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

Exponential

• f(t) = µe −µt for t ≥ 0; f(t) = 0 otherwise; F (t) = 1 − e−µt for t ≥ 0; F (t) = 0 otherwise.

• ET = 1/µ, VT = 1/µ2. Therefore, cv=1.

µf(t) F(t)1

1

1

0.9 0.9

0.8 0.8

0.7 0.7

0.6 0.6

0.5 0.5

0.4 0.4

0.3 0.3

0.2 0.2

0.1 0.1

0 0 0 0.5 1.5 2 2.5 3 3.5 4 4.5 0 0.5 1.5 2 2.5 3 3.5 4 4.5

µ1 t

1 µ t 1

Page 39: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

Exponential

• Memorylessness: P (T > t + x|T > x) = P (T > t)

• P (t ≤ T ≤ t + δt|T ≥ t) ≈ µδt for small δt.

• If T1, ..., Tn are independent exponentially distributed random variables with parameters µ1..., µn and T = min(T1, ..., Tn), then T is an exponentially distributed random variable with parameter µ = µ1 + ... + µn.

Page 40: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

Unreliable machine

Continuous time unreliable machine. MTTF=1/p; MTTR=1/r.

r

downup

p

Page 41: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Discrete state, continuous time

Poisson Process

t

Markovprocesses

T4T1 T2 T3

0 T1 T1 + T2 T1 + T2 + T3 T1 + T2 + T3 +T4

Let Ti, i = 1, ... be a set of independent exponentially distributed random variables with parameter λ that each represent the time

nuntil an event occurs. Then i=0 Ti is the time required for n

such events.

0 if T1 > t Define N(t) =

n such that �n Ti ≤ t,

�n+1 Ti > t i=0 i=0

Then N(t) is a Poisson process with parameter λ.

Page 42: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

Discrete state, continuous time

Poisson Distribution

P (N(t) = n) = e −λt(λt)n

n! Poisson Distribution

0.18

0.16

0.14

0.12

0.10

0.08

0.06

0.04

0.02

0.00 10987654321

n

λt = 6

Page 43: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Markov processes

(λt)n

Discrete state, continuous time

Poisson Distribution

P (N(t) = n) = e −λt , λ = 2 n!

n=1

n=2

n=3

n=4

n=5

n=10

P(N(t)=n)

0

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0 2 3 4 5 6 7 81 t

0.05

Page 44: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/1 Queue Queueing theory

µλ

• Simplest model is the M/M/1 queue:

⋆ Exponentially distributed inter-arrival times — mean is 1/λ; λ

is arrival rate (customers/time). (Poisson arrival process.) ⋆ Exponentially distributed service times — mean is 1/µ; µ is

service rate (customers/time). ⋆ 1 server. ⋆ Infinite waiting area.

• Define the utilization ρ = λ/µ.

Page 45: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/1 Queue Queueing theory

Sample path

Number of customers in the system as a function of time.

n

6

t

1

2

3

4

5

Page 46: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/1 Queue Queueing theory

State Space

λ λ λ λ λ λ λ

0 1 2 n−1 n n+1

µ µ µ µ µ µ µ

Page 47: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/1 Queue Queueing theory

Performance of M/M/1 queue

Let P (n, t) be the probability that there are n parts in the system at time t. Then,

P (n, t + δt) = P (n − 1, t)λδt + P (n + 1, t)µδt

+P (n, t)(1 − (λδt + µδt)) + o(δt)

for n > 0

and P (0, t+δt) = P (1, t)µδt+P (0, t)(1−λδt)+o(δt).

Page 48: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/1 Queue Queueing theory

Performance of M/M/1 queue

Or, dP (n, t)

= P (n − 1, t)λ + P (n + 1, t)µ − P (n, t)(λ + µ), dt

n > 0 dP (0, t)

= P (1, t)µ − P (0, t)λ. dt

If a steady state distribution exists, it satisfies

0 = P (n − 1)λ + P (n + 1)µ − P (n)(λ + µ), n > 0

0 = P (1)µ − P (0)λ.

Why “if”?

Page 49: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/1 Queue Queueing theory

Performance of M/M/1 queue

Let ρ = λ/µ. These equations are satisfied by

P (n) = (1 − ρ)ρn, n ≥ 0

if ρ < 1. The average number of parts in the system is

� ρ λ n̄ = nP (n) = = .

1 − ρ µ − λ n

Page 50: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/1 Queue Queueing theory

Little’s Law

• True for most systems of practical interest.

• Steady state only.

• L = the average number of customers in a system.

• W = the average delay experienced by a customer in the system.

L = λW

In the M/M/1 queue, L = n̄ and 1

W = . µ − λ

Page 51: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/1 Queue Queueing theory

Capacity

W 100

80

60

40

20

0

0 0.5 1 1.5 2 λµ=1

• µ is the capacityof the system.

• If λ < µ, system is stable and waiting time remains bounded.

• If λ > µ, waiting time grows over time.

Page 52: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/1 Queue Queueing theory

Capacity

• To increase capacity, increase µ.

• To decrease delay for a given λ, increase µ.

λ

W

µ=1

µ=2 0

20

40

60

80

100

0 0.5 1 1.5 2

Page 53: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/1 Queue Queueing theory

Other Single-Stage Models

Things get more complicated when:

• There are multiple servers.

• There is finite space for queueing.

• The arrival process is not Poisson.

• The service process is not exponential.

Closed formulas and approximations exist for some cases.

Page 54: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/s Queue Queueing theory

µ

µλ

µ

s-Server Queue, s = 3

Page 55: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/s Queue Queueing theory

State Space

• The service rate when there are k > s customers in the system is sµ since all s servers are always busy.

• The service rate when there are k ≤ s customers in the system is kµ since only k of the servers are busy.

λ λ

0 1 2

λ λ λ λ λ

s−1 s

λ

s−2 s+1

µ 2µ 3µ (s−2) µ (s−1) µ sµ sµ sµ

Page 56: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/s Queue

skρk

P (0) , k ≤ s

k!P (k) =

sρk

s

P (0) , k > s s!

Queueing theory Steady-State Probability Distribution

where λ �

ρ = < 1; P (0) chosen so that P (k) = 1 sµ

k

Page 57: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/s Queue Queueing theory

PerformanceW

20

15

10

5

0

0 0.5 1 1.5 2 2.5 3 3.5 4

lambda

(mu,s)=(4,1) (mu,s)=(2,2) (mu,s)=(1,4) (mu,s)=(.5,8)

Page 58: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/s Queue Queueing theory

Performance

0

5

10

15

20

0 0.5 1 1.5 2 2.5 3 3.5 4

L

lambda

(mu,s)=(4,1) (mu,s)=(2,2) (mu,s)=(1,4) (mu,s)=(.5,8)

Page 59: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

M/M/s Queue Queueing theory

Performance

20 20

15

0

5

0 0.5 1 1.5 2 2.5 3 3.5 4

(mu,s)=(4,1) (mu,s)=(2,2) (mu,s)=(1,4) (mu,s)=(.5,8)

L

15

10 10

0

5

0 0.5 1 1.5 2 2.5 3 3.5 4

(mu,s)=(4,1) (mu,s)=(2,2) (mu,s)=(1,4)

(mu,s)=(.5,8)

W

lambda lambda

• Why do the curves go to infinity at the same value of λ?

• Why is the (µ, s) = (.5, 8) curve the highest, followed by (µ, s) = (1, 4), etc.?

Page 60: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Networks ofQueues

• Set of queues where customers can go to another queue after completing service at a queue.

• Open network: where customers enter and leave the system. λ is known and we must find L and W .

• Closed network: where the population of the systemis constant. L is known and we must find λ and W .

Page 61: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Networks of Examples

Queues Open networks

• internet traffic

• emergency room

• food court

• airport (arrive, ticket counter, security, passport control, gate, board plane)

• factory with serial production system and no material control after it enters

Page 62: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Networks of Examples

Food Court Queues

PIZZA McDonald’s

Sbarro’s TCBY Frozen Yogurt

EX

ITE

NT

RA

NC

E

Person

Person with Tray

Tables

Page 63: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Networks of Closed Networks

Queues

• factory with material controlled by keeping the number of items constant (CONWIP)

• factory with limited fixtures or pallets

Page 64: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Benefits

Networks

Queueing networks are often modeled as Jackson networks.

• Easy to compute performance measures (capacity,average time in system, average queue lengths).

• Easily gives intuition.

• Easy to optimize and to use for design.

• Valid (or good approximation) for a large class of systems ...

Page 65: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Limitations

Networks

• ... but not everything. Storage areas must be infinite (i.e., blocking never occurs).

⋆ This assumption fails for systems with bottlenecks.

• In Jackson networks, there is only one class. That is, all items are interchangeable. However, this restriction can be relaxed.

Page 66: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Open Jackson Networks

Networks Assumptions

A

A

D

A

D

Goal of analysis: say something about how much inventory there

is in this system and how it is distributed.

Page 67: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Open Jackson Networks

Networks Assumptions

• Items arrive from outside the system to node i according to a Poisson process with rate αi.

• αi > 0 for at least one i.

• When an item’s service at node i is finished, it goes to node j next with probability pij.

• If pi0 = 1 − pij > 0, then items depart from the network j

from node i.

• pi0 > 0 for at least one i.

• We will focus on the special case in which each node has a single server with exponential processing time. The service rate of node i is µi.

Page 68: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Open Jackson Networks

Networks • Define λi as the total arrival rate of items to node i.

This includes items entering the network at i and items coming from all other nodes.

• Then λi = αi + pjiλj

j

• In matrix form, let λ be the vector of λi, α be the vector of αi, and P be the matrix of pij. Then

λ = α + PTλ

or λ = (I − PT)−1α

Page 69: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Networks Jackson Open Jackson Networks

Product Form Solution

• Define π(n1, n2, ..., nk) to be the steady-state probability that there are ni items at node i, i = 1, ..., k.

• Define ρi = λi/µi; πi(ni) = (1 − ρi)ρini .

• Then π(n1, n2, ..., nk) = πi(ni)

i

ρin̄i = Eni =

1 − ρi

Does this look familiar?

Page 70: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Networks Jackson Open Jackson Networks

Product Form Solution

• This looks as though each station is an M/M/1

queue. But even though this is NOT in general true, the formula holds.

• The product form solution holds for some more general cases.

• This exact analytic formula is the reason that theJackson network model is very widely used —sometimes where it does not belong!

Page 71: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Closed Jackson Networks

Networks

• Consider an extension in which

⋆ αi = 0 for all nodes i. ⋆ pi0 = 1 − pij = 0 for all nodes i.

j

• Then

⋆ Since nothing is entering and nothing is departing from the network, the number of items in the network is constant .

That is, ni(t) = N for all t. i

⋆ λi = pjiλj does not have a unique solution:j

If {λ1∗, λ2

∗, ..., λk∗} is a solution, then {sλ1

∗, sλ2∗, ..., sλk

∗} is also a solution for any s ≥ 0.

Page 72: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

� � �

� �

� � � �

Jackson Closed Jackson Networks

Networks For some s, define

πo(n1, n2, ..., nk) = (1 − ρi)ρn

i i = (1 − ρi) ρ

n

i i

i i i

where

sλ∗

ρi = i

µi

This looks like the open network probability distribution, but it is a

function of s.

Page 73: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

i

Jackson Closed Jackson Networks

Networks Consider a closed network with a population of N . Then if

ni = N ,

πo(n1, n2, ..., nk)π(n1, n2, ..., nk) = �

πo(m1, m2, ..., mk) m1+m2+...+mk =N

Since πo is a function of s, it looks like π is a function of s. But it is not because all the s’s cancel! There are nice ways of calculating

C(k, N) = πo(m1, m2, ..., mk) m1+m2+...+mk =N

Page 74: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Closed Jackson Networks

Let {pij} be the set of routing probabilities, as defined on slide 67.

1

q1

q 2 piM = 1 if i � M=2 q

M 3

(TransportStation) q 3

M−1 pMj = qj if j � M=

pij = 0 otherwise Load/Unload

qM Service rate at Station i is M − 1

µi. Solberg’s “CANQ” model.

Networks Application — Simple FMS model

M(Transport

Station)

1

3

M - 1

Page 75: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Closed Jackson Networks

Networks Application — Simple FMS model

Let N be the number of pallets.

The production rate is

C(M, N − 1) P = µm

C(M, N)

and C(M, N) is easy to calculate in this case.

• Input data: M, N, qj, µj(j = 1, ..., M )

• Output data: P, W, ρj(j = 1, ..., M )

Page 76: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Closed Jackson Networks

Networks Application — Simple FMS model

P 0.35

0.3

0.25

0.2

0.15

0.1

0.05 0 2 4 6 8 10 12 14 16 18 20

Number of pallets

Page 77: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Closed Jackson Networks

Networks Application — Simple FMS model

Average time in system

70

60

50

40

30

20

10 0 2 4 6 8 10 12 14 16 18 20

Number of Pallets

Page 78: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Closed Jackson Networks

Networks Application — Simple FMS model

Utilization

Station 2

0.2

0.4

0.6

0.8

1

0 0 2 4 6 8 10 12 14 16 18 20

Number of Pallets

Page 79: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Closed Jackson Networks

P

Networks Application — Simple FMS model

0.25

0.3

0.35

0.4

0.45

0.5

0.55

0.6

0.2 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Station 2 operation time

Page 80: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Closed Jackson Networks

Networks Application — Simple FMS model

Average time in system

45

15 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Station 2 operation time

20

25

30

35

40

Page 81: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

Jackson Closed Jackson Networks

Networks Application — Simple FMS model

Utilization

1

0.8

0.6

0.4

0.2

0

Station 2

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Station 2 operation time

Page 82: Queues Lecturer: Stanley B. Gershwin · 2019-09-13 · Lecturer: Stanley B. Gershwin . Stochastic processes • t is time. • X() is a stochastic process if X(t) is a random variable

MIT OpenCourseWarehttp://ocw.mit.edu

2.854 / 2.853 Introduction to Manufacturing Systems Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.