等候理論 queueing theorybbcr.uwaterloo.ca/~lcai/ece418/topic2_queue.pdf · priority queueing...

26
Queueing Analysis

Upload: others

Post on 22-Jun-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

Queueing Analysis

Page 2: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

Outline

• M/M/1 Queue (infinite buffer)• M/M/1/N (finite buffer)• M/M/m/m (Erlang’s B formula)• M/M/m (Erlang’s C formula)• Networks of M/M/1 Queues• M/G/1• Priority Queue

Page 3: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/1

• M: Markovian/Memoryless– Arrival process is Poisson– Departure process is Exponential– Single Server– Infinite buffer for waiting customers

Poisson arrivals with rate λ Exponential service

with rate μ

server

queue

Page 4: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

Poisson Process• Arrival process, Δt is a very small

segmented time and λ is the average arrival rate– P [1 arrival in [t, t+Δt] ] → λΔt – P [ no arrival in [t, t+Δt] ] → 1-λΔt– P [more than 1 arrivals in [t, t+Δt] ] → 0

• Joint or split Poisson process is also Poisson process

Page 5: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

Markov Property

• Memoryless:

– P (T>t0+ ∆t | T>t0)=P (T>∆t )

– P(X(tn+1)=xn+1| X(tn)=xn, P(X(tn-1)=xn-1 …. X(t1)=x1) = P(X(tn+1)=xn+1| X(tn)=xn)

The future is independent of the past!

Page 6: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/1 queueing model

• State transition diagram

… …0 1 2 3 n-1 n n+1

λ∆t λ∆t λ∆t λ∆t λ∆t λ∆t λ∆t λ∆t

μ∆t μ∆t μ∆t μ∆t μ∆t μ∆t μ∆t μ∆t

… …

1- λ∆t1-(λ+μ)∆t 1-(λ+μ)∆t 1-(λ+μ)∆t 1-(λ+μ)∆t 1-(λ+μ)∆t1-(λ+μ)∆t

Page 7: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/1: balance equations

• Equilibrium or steady state analysis:Pn+1 μ∆t = Pn λ∆t λP0 =μ P1λP1 =μ P2

λP2 =μ P3 =>…..λPn-1 =μ Pn

P1= λ/μ P0 =ρP0

P2= λ/μ P1 = ρ2P0P3= λ/μ P2 = ρ3P0

…..Pn= λ/μ Pn-1 = ρnP0

ρ = λ/μ is called utilization factor or traffic intensityρ <1 or λ<μ <=> System is stable!

Page 8: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/1: find P0

)1(1

1

0

00

0

ρρ

ρ

ρ

−=

−=⇒

== ∑∑∞

=

=

nn

n

n

nn

Pp

PP

n=0,1,2,… …

Geometric distribution!

Page 9: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

Little’s law

• The long term average number of customers in a queueing system isE[N]=λ E[T], where E[T] is the average time a customerspends in the system, λ is the average arrivalrate of customers.

Page 10: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/1: system performance• The average number of customers in the

queueing system

• The average waiting time in the queueing system (using Little’s Law)

λμλ

ρρ

−=

−=

1][NE

λμλ −==

1][][ NETE

Page 11: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/1: queue performance• The average number of customers in the queue

• The average waiting time in the queue (or using Little’s Law)

ρρ−

=1

][2

qNE

μλμλ

)(][][][

−=−= sq TETETE

Page 12: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/1/N queueing system(finite buffer)

N: The system can hold at most N customers (including the one in service)

1

QueueServer

λ

λPB

λ(1-PB)

N

Page 13: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

NB

nNn

NN

n

n

nn

PP

p

p

Nnpp

=−−

=∴

−−

==

≤≤=

+

+

=∑

ρρρ

ρρ

ρ

ρ

1

1

0

0

0

11

111

0,

0 1 2 3 N-2 N-1 N

λ∆t λ∆t λ∆t λ∆t λ∆t λ∆t λ∆t

μ∆t μ∆t μ∆t μ∆t μ∆t μ∆t μ∆t

… …

1- λ∆t1-(λ+μ)∆t 1-(λ+μ)∆t 1-(λ+μ)∆t 1-(λ+μ)∆t 1-μ∆t1-(λ+μ)∆t

Blocking probability: the probability that the system is full

M/M/1/N : blocking probability

Page 14: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/m/m queueing model

0 1 2 3 m-2 m-1 m

λ∆t λ∆t λ∆t λ∆t λ∆t λ∆t λ∆t

μ∆t 2μ∆t 3μ∆t 4μ∆t (m-2)μ∆t(m-1) μ∆t mμ∆t

… …

1- λ∆t1-(λ+μ)∆t 1-(λ+2μ)∆t 1-(λ+3μ)∆t

1-(λ+(m-2)μ)∆t 1-mμ∆t1-(λ+(m-1)μ)∆t

1

Servers

λ

λPB

λ(1-PB)2

3

m

Page 15: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/m/m: blocking probability

• λn= λ, n=0,1,2,…m-1• μn =nμ,0≤n≤m• Blocking probability PB

(find all servers are busy)– Erlang’s B formula

=

=

=

==

=

=⎥⎦

⎤⎢⎣

⎡∏=

m

n

n

m

mB

m

n

n

nn

in

n

mPP

n

P

pn

pi

P

0

0

0

001

)(!

1

)(!

1

)(!

11

!1)()(

μλ

μλ

μλ

μλ

μλ

Page 16: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/m queueing model: m parallel servers with an infinite queue

Performance metric: the probability that an arrival has to wait in the queue (PQ)

1

Servers

λ2

3

m

Queue

Page 17: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/m: state transition diagram

λ∆t

0 1 2 3 m-1 m m+1

λ∆t λ∆t λ∆t λ∆t λ∆t λ∆t λ∆t

μ∆t 2μ∆t 3μ∆t 4μ∆t (m-1)μ∆t mμ∆t mμ∆t

… …

1- λ∆t1-(λ+μ)∆t 1-(λ+2μ)∆t 1-(λ+3μ)∆t

1-(λ+(m-1)μ)∆t 1-(λ+ mμ)∆t1-(λ+mμ)∆t

mμ∆t

… …

⎩⎨⎧

>≤≤

=mnm

mnnn

,0,

)(μμ

μ

Presenter
Presentation Notes
n= , n=0,1,2,….. n =n,0nm n =m,nm
Page 18: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/m: find P0

• 0≤n≤m

• n≥m

0)!)(( p

nmp

n

n ⎥⎦

⎤⎢⎣

⎡=

ρ

0!p

mmp n

m

n ρ=

μλρ

m=

11

00

0 )1(!!)(1

−−

=

=⎥⎦

⎤⎢⎣

⎡−

+=⇒= ∑∑m

n

mmn

nn

mm

nmpP

ρρρ

Page 19: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/M/m:PQ

• All the servers in this system are busy– Erlang’s C formula

⎥⎦

⎤⎢⎣

⎡−

+

−=⎥⎦

⎤⎢⎣

⎡−

==

∑∑ −

=

=1

0

0Q

)1(!!)(

)1(!)1(!

Pm

n

mmn

mm

mm

mnn

mm

nm

mm

pm

mP

ρρρρ

ρ

ρρ

Page 20: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

Networks of M/M/1 queues

• L M/M/1 queues form a system, and λi and μi are Poisson arrival and departure rates of a queue, Qi.

• The average number of customers in each M/M/1 queue(node) is

ii

i

i

iiNE

λμλ

ρρ

−=

−=

1][

Page 21: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

• The total number of customers in the system

• The average delay per packet (little’s law)

∑∑== −

==L

i ii

iL

iiNENE

11][][

λμλ

∑∑∈=

=−

==Sk

k

L

i ii

iNETE γλλμ

λλλ

,1][][1

λ is the average arrival rate of the customers entering the system

Page 22: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/G/1 queueing model

• Poisson arrivals with rate λ• Arbitrary service time (any distribution)

– E[X]=1/μ first moment (of service time)– E[X2]=Var(X)+E2 [X] second moment

Page 23: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/G/1: system performance• The average number of customers in the

queueing system

• The average waiting time in the system

)1(2][][

22

ρλ

μλ

−+=

XENE

)1(2][1][][][

2

ρλ

μ −+=+=

XETETETE qs

Page 24: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

M/G/1: queue performance

• The average number of customers in the queue

• The average waiting time in the queue)1(2][][

22

ρλ

−=

XENE q

)1(2][][

2

ρλ

−=

XETE q

Page 25: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

Priority queueing(M/G/1 queue)

• Two priority classes case: delay sensitive and best effort– Type 1 packets are given service priority in

that service will never begin on Type 2 packets if a Type 1 packet is waiting

– If Type 2 packet is being served and a Type 1 packet arrives, the service of the Type 2 packet is continued until completion (there is not pre-emption)

Page 26: 等候理論 Queueing Theorybbcr.uwaterloo.ca/~lcai/ece418/Topic2_queue.pdf · Priority queueing (M/G/1 queue) • Two priority classes case: delay sensitive and best effort – Type

• The average delay per Type 1 packet is given by

• The average delay per Type 2 packet is given by

)1(2

][1][1][

1

2

1

2

11

11 ρ

λ

μμ −+=+=∑=i

isi

q

TETETE

)1)(1(2

][1][1][

211

2

1

2

22

22 ρρρ

λ

μμ −−−+=+=

∑=i

isi

q

TETETE