Top Banner
Queueing theory primer Lecturer: Massimo Tornatore Original material prepared by: Professor James S. Meditch Typesetter: Dr. Anpeng Huang Courtesy of: Prof. Biswanath Mukherjee 1
80

Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Aug 16, 2018

Download

Documents

hoàng_Điệp
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Queueing theory

primer

Lecturer: Massimo Tornatore Original material prepared by:

Professor James S. Meditch

Typesetter: Dr. Anpeng Huang

Courtesy of: Prof. Biswanath Mukherjee 1

Page 2: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

A change of focus

• So far we have investigated «static» problems

– Traffic requests are given and constant in time

• E.g., Multi commodity flow problem

• In general, mathematical programming, optimization and graph

theory, heuristics…

• Now we move to a class of dynamic problems

– Random or stochastic flow problems

– The times at which the demands arrive are uncertain

and also the size of the demands are unpredictable

• Queueing (in our case «traffic») theory

2

Page 3: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Source

• Notes taken mainly from – L. Kleinrock, Queueing Systems (Vol 1: Theory)

• Chapter 1 and 2

– L. Kleinrock, Queueing Systems (Vol. 2: Computer

Applications)

• Chapter 1

3

Page 4: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Delay and Congestion, why?

• The reason for this behaviour is the irregularity

(i.e, statistical distribution) of:

– Arrivals (i.e., interarrival times)

– Services (i.e., service times)

R C

If R>C, we expect congestion (intuitive)

If R<C, there might still be congestion (why?)

4

Page 5: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

A. Notation and terminology

5

Page 6: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

cn = customer n = arrival time of cn

tn = – = interarrival time →

wn = waiting time for cn →

xn = service time for cn →

sn = system time for cn →

sn = wn + xn

n

n

t~

1n

s~

x~

w~

*Note that these distributions do not depend by n (same distribution for all arrivals/services) 6

Page 7: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Arrival process Service process

kttE

ttE

dt

tdAta

ttPtA

])~

[(

1]

~[

)()(

]~

[)(

k

kxxE

xxE

dx

xdBxb

xxPxB

])~[(

1]~[

)()(

]~[)(

k

7

CDF

pdf

mean

kth moment

Page 8: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Laplace transform/moment generating fn

kk

sk

kk

xs

tsst

tds

sAdA

eEsB

tfEeEdtetasA

)1()(

)0(

][)(

)]([][)()(

0

*)(*

~*

~

0

*

8

Page 9: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Queueing system performance

Input variables: system defined by and

Output variables: performance defined by

1. N(t) no. of customers in system at time t

2. wn waiting time

3. sn system time

HP: (statistical equilibrium,

stationarity)

t~ x~

NtNt )(,

9

Page 10: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

N w s

k

k

k

N

k

N

zPzQzE

NNE

kNPP

kNPkF

0

)(][

][

][

][)(

)(][

]~[

)()(

]~[)(

*~

sWeE

WwE

dy

ydWyw

ywPyW

ws

)(][

]~[

)()(

]~[)(

*~

sSeE

TsE

dy

ydSys

ysPyS

ss

10

Page 11: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Other performance variables:

I = idle period

D = interdeparture time

G = busy period

Nq = no. of customers in queue

11

Page 12: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Kendall’s notation for queueing systems

A/B/m A/B/m/K/M no. of users

no. of servers queue size

M exponential(Markovian) D deterministic

Er r-stage Erlangian G general

Hr R-stage hyperexponential

12

Page 13: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

B. General results

1. Utilization factor

10

avg.) (on the usein capacity system offraction

workdo tosystem theofcapacity

arrivesork at which w rate avg.

C

R

13

Page 14: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

G/G/1

• Let us start with no assumptions on arrival and

service distribution and one single server

• It can be generally proven that:

sec / service of rate avg.

sec / arrivals no. avg.

x

1

where

x

14

Page 15: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

G/G/m

• In case of multiple (m) servers:

)10 wherefor except (

10 requiresStability

serversbusy offraction avg.

servereach for timeservice avg. 1

,

D/D/m

mm

x

15

Page 16: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

2. System time

WxT

wExEsE

wxs

]~[]~[]~[

~~~

16

Page 17: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

3. Little’s result

WNTN

TN

q

,

The average number of customers in a queueing system

is equal to the average arrival time of customers to that

system, times the average time spent in that system

17

Page 18: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

t)(0, interval theduring system in the customers of no. avg.

t)(0, during arrived who

customers allover averagedcustomer per timesystem

)area!grey the(i.e, t time toup system in thespent have

customers all time totalsec)-(customer )()(0

t

t

t

N

T

dssNt

0(t)- (t)N(t)

t)(0,in departures no.)(

t)(0,in arrivals no.)(

t

t

18

Page 19: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

N

)(

)()(Ncan But we

t)(0,in systemin customers no. Avg. )(

N

t)(0,in customer per timesystem Avg. erssec/custom )(

)(

t)(0,in rate arrival Avg. sec

)()(

t

t

t

tt

t

T

t

t

t

t

t

t

t

tT

customers

t

tt

19

Page 20: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

m , ://

get also weand

)(

:tproven tha becan it Similarly,

(q.e.d) then exist, lim and lim If

mNNmGG

WxT

NNNxN

WN

TNTT

q

qs

s

q

ttt t

20

Page 21: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

C. Poisson process

])0(in arrivals[ Pr

,1,0,!

)()(

1,0,1]

~[

d,distributelly exponentia

tindependen : timesalInterarriv

,tk

kek

ttP

ttettP

t

tk

k

t

i

Pure birth system (see p. 60-63, 65,Vol. 1) 21

Page 22: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

1. Derivation of the Poisson process

rate) (arrivalintensity process

t)o(t1

]in arrival 1Pr[1]in arrival 0Pr[

t)o(t]in arrival 1Pr[

ΔtΔt

Δt

)()()()()(

)()(]1)[()(

1

1

tottPttPtPttP

tottPttPttP

kkkk

kkk

22

Page 23: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

1)0( that note )()(

)2(

)(]1)[()(

,2,1 )()()(

)1(

000

00

1

PtPdt

tdP

tottPttP

ktPtPdt

tdPkk

k

If I divide by «dt», I obtain:

Similarly for P0:

Solving the the first-order differential equation (2):

then inserting P0(t) in (1) for k=1:

then continuing by induction:

tetP )(0

0,0,!

)()( tke

k

ttP t

k

k

ttetP )(1

]~

[1)( )!on!distributi neg. exp.with (relation note Final* 0 ttPetP t

23

Page 24: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

2. Properties of the Poisson Process

2

2

1

)1(

1

)1(

0

)(

2

)(

0

1

1

)s!(memoryles ddistributelly exponentia are timesalInterarriv

)(

1]~

[ iv.

),(

][)( iii.

ii.

rate arrival avg.

)()( i.

t

eta

ettPA(t)

tetdz

tzdQ

ezEztPQ(z,t)

t

ttkPtN

t

t

z

zt

z

zt

k

tNk

k

tN

k

k

24

Page 25: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Random process

• Poisson Process is a stochastic (or

random) process

• Now we will use some more advanced

stochastic processes (Markov chains)

• But… what is a stochastic process?

– It is «family» of random variables X(t)

indexed by time t

– A possible (intuitive) case is when the

random process represents the sum of

simple random variables at instant t 25

Page 26: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Example of a random process

S1(t), S2(t) S3(t)…. are

random variables

X(t) is random process

X(t,w) = Number of servers

busy at time t of realization

w of the process= one

realization of the process

Assumptions

Stationarity

• E[to,to+][X(t, w)] = A(t0, w)

= A (w)= A(w)

Ergodicity

• A(w) = A

S1

S2

S3

S4

X(t)

4

3

2

1

0

´

´

´

´

´

´

´

´

H 1

H 2

H 3

H 3

H 6 H 1

H 5 H 4

H 5 H 2

H 4 H 8

H 7

t 0

H 7

H 3 H 4 H 7 H 6 H 5

H 6 H 7 H 8

H 8

t 0 + t

26

Page 27: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

D. Markov chains

• A random process is called a “chain” if the state space

is discrete (i.e., if X(t) can assume only discrete

values)

– Note: S = {0, 1, . . ., K} finite state

S = {0, 1, . . .} infinite state (countable)

• A chain can be

– Discrete-time

• If t can assume only discrete values, i.e., if X(t) can change values on at

discrete instants in time

– Continuous-time

• If t can assume any continuous value

• A chain is a Markov chain if … see next slide

27

Page 28: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

D.1. Discrete-time Markov chains

][

],,,[

11

001111

nnn

nnn

iXjXP

iXiXiXjXP

28

NNSSXn },...,,1,0{,1) It’s a chain since:

3) It’s a Markov

Chain since:

2) It’s a discrete-time chain since the time («x-axis») is slotted

Page 29: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

State probabilities

i

(n)

i

)(

1

)(

0

)()(

1

][ ][ define usLet

nnn

n

n

i iXP

(One-step) transition probabilities

j

n

ij

n

ij

n

nn

n

ij

niPPP

iXjXPP

, 1 ][

][ define usLet

)()1()1(

1

)1(

29

Page 30: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

State equations

given ,2,1 )0(

)1()1()(

n

P nnn

Homogeneous chain

j

ijij

nnij

ij

n

ij

iPPP

niXjXPP

nPP

each for 1 ][

][

timeoft independen i.e, ,

1

)(

30

Page 31: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

1

)state"steady (" iesprobabilit mequilibriu

thenexists, lim If

1 given

,2,1

)(

i

)(

i

)0(

)0()(

)1()(

i

i

n

n

nn

nn

P

P

nP

n

31

Page 32: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Proof of π(n) = π(n-1) P

32

Page 33: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Proof- Contd.

...

...]......[

......

2

1

0

)1()1(

2

)1(

1

)1(

0

)1(

2

)1(

21

)1(

10

)1(

0

)(

si

i

i

i

n

s

nnn

si

n

s

i

n

i

n

i

nn

i

P

P

P

P

P

PPP

i-th column of P

33

Page 34: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Example

Discrete-time birth-death (arrival-departure) process with no

waiting room.

P(1 arrival at any time n) = a

P(1 departure at any time n) = d

s = {0,1} π = [π0 π1]

34

Page 35: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Example – Contd.

101

100

)1()(

)1(

)1(

1

1

da

da

Pn

P

dd

aaP

nn

35

Page 36: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Example – Contd.

da

a

da

d

d

a

d

aad

10

010

0101

1)1(1

36

Page 37: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

D.2. Continuous-time Markov chains

NNSStX },...,,1,0{,)(

37

1) It’s a chain since:

3) It’s a Markov Chain since:

2) It’s a continuos-time chain since the times t can assume any real value

])()([])(...,,)()([

...0.

1111

121

nnnnnn

nn

itXjtXPitXitXjtXP

ttttanyandnallForDef

t1 t2 t3…..

Finite or

countable

Real

Page 38: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Time spent in a state

r.v. geometric a is state ain

spent Chain time Markov time-discrete ain :Note

exp.) (negative 1][

..

Chain Markov time-continuos ofProperty

t

i

i

ietP

withvraisSEstateintime

38

Page 39: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Neg. Exp. Is «Memoryless»

39

tT

ee

ee

tT

tTttT

tT

ttTttTttT

t

t

ttt

Pr

111

11

Pr

PrPr

Pr

Pr Pr

0

00

0

00

0

0000

Pr T t t 0 T t0 Pr T t

t 0

et

e t t0

Page 40: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

D.2.a. General Case

D.2.a.1. Transition probabilities

ieachfortq

jit

tttptq

t

tttptq

matrixratetransitiont

ItPtQ

tttptP

stisXjtXPtsp

j

ij

ij

ij

iiii

ij

ij

0)(

),(lim)(

1),(lim)(

)(lim)(

)],([)(

])()([),(

If these limits do not exist, we do not have a continuous-time Markov chain

Δt→0

Δt→0

Δt→0

40

Page 41: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

D.2.a.2 State Probabilities

t

j

j

N

j

dssQt

tgiven

tQtdt

td

Ntttt

SjjtXPt

0

10

])(exp[)0()(

1)()0(

)()()(

)],(...)()([)(

])([)(

41

Page 42: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

D.2.b. Homogenous case

tQ

ij

ijij

ijij

etQtdt

td

qQ

constqtq

sofindeptssptp

)0()()()(

][

.)(

.),()(

42

Page 43: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Homogenous case – Contd.

1

0

:)0(

)(lim

)(

j

jj

Q

oftindependen

t

existsitifstateSteady

t→∞

43

Page 44: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Models used in this course Birth-death processes

• We want to apply the previously seen random processes

to model queues in telecom equipment

• The state changes only

– When a packet arrives (birth)

– When a packet leaves (death)

• Basically you can only move between adjacent states

– State k State k+1 (birth)

– State k State k-1 (death)

• Continuous time

– Packet arrive and depart at any time!

• Mathematical treatment follows in the next slides

44

Page 45: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

E. Continuous-time birth-death processes aka arrival-departure processes

(1) Continuous-time Markov chain dealing with a population

of size N at time t

LLS

SkktNPtPk

}...,,1,0{

])([)(

(2) System state changes by at most one (up or down, or no

change) in Δt

45

1j-k if 0,

,1

,1

jk

kk

kkk

p

pdt

pdt

Page 46: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

(3) Births and deaths independent

– Follows from Markovianity

(4) Transitions

ratedeath

totktNtttindexactlyP

totktNtttindexactlyP

ratebirth

totktNtttinbexactlyP

totktNtttinbexactlyP

k

k

k

k

k

k

)(1])(),(0[

)(])(),(1[

)(1])(),(0[

)(])(),(1[

Contd.

46

Page 47: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Transitions - State Eqns.

)(1)( )3

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

1 )()(

)()()()()( )1

0

1010000

,11

,11,

LtP

ktptPtptPttP

ktptP

tptPtptPttP

L

k

k

kkk

kkkkkkk

47

- 3 (set of) equations regulate the birth-death process

Page 48: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

State Eqns. – Contd.

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

)]()[()]()[(

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

11000

1111

tottPtottPttP

tottPtottP

tottottPttP

kkkk

kkkk

48

- Solving of previous equations

*Similar derivation as seen in the Poisson process

Page 49: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

State Eqns. – Contd.

0

0)()()(

1

)()()()()(

11000

1111

t

ktPtPdt

tdP

k

tPtPtPdt

tdPkkkkkkk

k

49 *Solving these equations is quite complex, so, in practice, the approach used

is the one shown in the next slide (inspection over a state diagram)

Page 50: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

State-Transition Rate Diagrams

tPtPE kkkkk 1111 into Flow

flowy probabilit ofNotion

tPE kkkk ofout Flow

... 1, 0,k

E ofout Flow - E into Flow

k11k11-k

kk

tPtPtP

dt

tdP

kkkk

k

Note: a simple «inspection» technique to find the same equations

50

Page 51: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

1,2,...k

:

P Hence, 0dP

um)(equilibri balancedboundary across flows want weif

11

11

kk

k

k

kk

kkkk

k

PP

PP

Note

Ptdt

t

51

Page 52: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

(Generic M/M/1) Queue

...,1,00)(

,

sec/

sec/

kdt

tdP

tbehaviorEquilibrum

jobsrateservice

jobsratearrival

k

k

k

52

System Representation

Page 53: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

1

1

0 1

0

1

0 1

0

0

21

1020

1

01

0

1100

1111

1

1

...,,

1

00

1,)(0

)(;.1

k

k

i i

i

k

i i

ik

k

k

kkkkkkk

kkkk

p

pp

pppp

p

kpp

kppp

ptPanddependentState

53

Page 54: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Classical M/M/1

1

0

0

1

1

1

,,

k

k

k

k

kk

p

kpp

kall

54

k k+1

k-1

10 2

Page 55: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Classical M/M/1 – Contd.

0)1(

)1(1

10

1

11 ,1

0

01

kp

pp

If

k

k

k

k

k

k

k

k

55

Page 56: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

2

2

0

22

20

00 0

1

0 0

)1(

)(

1

)1(1

1

)(

)1(

N

k

kN

k

k

k

k

k k

kk

k k

k

k

pNk

N

d

d

d

d

d

dkk

kpkN

56

Page 57: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Contd.

1

1

TTN

NW

WWxT

1

1

/

1

/11

57

Page 58: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Contd.

10

][

)1(][

1

2

iffvalidareresultsAbove

kNP

pkNP

NWN

k

ki

i

ki

i

qq

58

Page 59: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

M/M/m Queue Model

1

m

mkm

mkkk

0

Equivalently,

59

Page 60: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Use state-dependent birth-death model to determine 0, kpk

320

3

13

210

2

12

10011

3!3

22

ppp

ppp

ppp

02

2

12

0

1

11

01

!

!

!

pmm

p

pmm

p

pm

p

m

m

m

m

m

m

1

0

11

0 1

11

0

1

1)()(

1

1

1

1

m

k

mk

m

k

mk

ρm!

k!

/mρρ

/mρm!

ρ

k!

ρp

mkpm

m

mkpk

m

pkm

k

k

0

0

!

0!

)(

60

Page 61: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

M/M/m Queue system characteristics

mkpm

m

mkpk

mp

pkm

k

k

0

0

!

0!

)(

1

0

0

1

1)()(

1m

k

mk

ρm!

k!

mρp

mk

kpqueueingp ][

0)1(!

)(][ p

m

mmp

m

mNpN

pmN

smq

m

1

1

1 sq N

xN

WN

T

Where

mp

61

Page 62: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

62

Backup slides

Page 63: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

M/G/1 Queue

Poisson arrival process: customers/sec

General service process: kxxxB ,),(

queueing discipline is FCFS

1. Pollaczek-Khinchin (P-K) relations

)1(2

)1(2

1][][

22

2

22

xNWxN

WxTx

W

xxExxEx

63

Page 64: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Ex.

sec33.633.42

53.2

)3

13(4.08.0

sec33.4

3

13

)2.0(2

)3

13)(4.0(

)1(2

8.0)2)(4.0(

sec3

13

2

1

sec2

sec/4.0

2

2

3

1

22

TWxT

N

WN

W

xW

x

dxxx

x

cust

64

Page 65: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

2. P-K transform relations

a.

zs

sx

k

k

k

k

sBzB

where

zzB

zzBzQ

dxexbxbLsB

zQZpzpzQ

|)()(

)(

)1)(1()()(

)()]([)(

)]([,)(

**

*

*

0

*

1

0

b.

)(yw prob. density fn. of waiting time

0)],([)(

)(

)1()(

)]([)(

*1

*

*

*

ysWLyw

sBs

ssW

ywLsW

)(ys prob. density fn. of system time

)]([)(

)()(

)1()(

)]([)(

*1

*

*

*

sSLys

sBsBs

ssS

ysLsS

65

Page 66: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

yeys

s

s

ss

s

sss

ssS

)(

2

*

)()(

)1(

)(

)1(

)/(

)1()(

66

Page 67: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

3. Modeling

a. Imbedded Markov Chain

nq no. customers left behind by nC

nv no. customers which enter during nx

,...1,0,

0

01

1

1

1

nq

qv

qvqq

n

nn

nnn

n

Cont. –time Markov chain

b. Tagged job

)1/(

)1(

)(

)(

RW

RW

WRWxRW

R

xWRW

Residual work (residual life time)

67

Page 68: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Residual Life - R

x

z

Random Arrival

Service process:

b x x x( ), , 2

F x P Z xZ ( ) [ | system busy at time of arrival]

r = E[Z | system busy]

Intuition: r =x

2 ? Wrong!

68

Page 69: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Chances are higher that x arrives during longer periods

f x density fn. for length of service period

during which arrival occurs, given system busy

f x x) Kx b(x) (x)

f (x) d(x) K x b(x) dx = kx = 1, K =1

x

f (x) = x b(x)

x

r = x

2

x b(x)

x d(x) =

x

2x

Z

Z

Z00

Z

0

2

( )

( ) (

Residual Life - Cont’d

69

Page 70: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

R = E[Z | system busy] E[system busy]

=x

x . x =

1

2 x

W =

1

2x

x

22

22

2

1 2 1

( ) ( )

Markovian queueing Networks

N-node interconnection of queueing systems

queueing and service at each node

Exponential service times at each node

Model multi-service processes

Residual Life - Cont’d

70

Page 71: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

1

3

4

2

r11

r12

r21

r31

r32

r22

r23

r44

r43

r34

1 1 43 44 ( )r r

1 31 32 34 ( )r r r 3

1. Open Networks

N nodes

Each node – single queue, servers

Exponential service time

mi

xi

i

1

sec

71

Page 72: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

External arrivals – Poisson process (indep.) jobs/second

= P[that a job which completes service at node will proceed next

to node ]

P[that a job which completes service at node will leave

the network]

Avg. arrival rate at node from both external sources ands other

nodes (including itself)

i

rij ij

11

rijj

N

ii

i

rii

r i1

r i2

rNi

i

i

1

2i

N i i j jij

Nr

1

Flow Equations:

= [ 1 2 N

....... ]

[ ....... ]

[ ]

1 2 N

jiR r

R

72

Page 73: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Jackson’s theorem (1957)

Let p(k k k p[k jobs at node 1, k jobs at node 2, ....., k jobs at node N]

and

p k p[k jobs at node i]

Then

p(k k k p k p k p k

Each node in the network can be treated as an

M / M / m queue, m 1

1 2 N 1 2 N

i i i

1 2 N 1 1 2 2 N N

i i

, ....., )

( )

, ....., ) ( ) ( )........... ( )

73

Page 74: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

1

2

N-1

N

……………

N = N ii=1

N

= ii=1

N

T =N

74

Page 75: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Example:

1 2 3

r12 r23

I/O I/O CPU

r11 r22

r11 02 . r12 08 .

r22 04 . r23 06 .

101

1 . sec

10 05

2 . sec

10 9

3 . sec

1 job / sec

75

Page 76: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Node 1

1 11 1 1 1

11

1

1

1

1 0 2 125

01251

01429

r . .

. . N1

Node 2

2 12 1 22 2 2 2

22

2

2

2

08 125 0 4 16667

0 08331

0 0909

r r . ( . ) . .

. . N2

Node 2

3 22 2

33

3

3

3

0 6 16667 1

0 91

0 9

9 2338

9 23

r . ( . )

. .

.

. sec

N

N = N + N + N

T =N

3

1 2 3

76

Page 77: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

1

4

3

2 r12

r21

r14

r42

r22

r23

r33

r43

2. Closed Networks

N nodes; K jobs circulating through the network

No external arrivals or departures

Each node – single queue, servers Exponential service time mixi

i

1

sec

r24

r32

i ij

N

r

0 1

1 2

for each i

K K R = [r

(flow vector)

R

j=1

N

ii=1

N

ij ]

[ .......... ]

77

Page 78: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Gorjon and Newell (1967)

p(k k k 1

G(K)

x

k

{x satisfy

x x i = 1,2,....., N

G(K) =x

k

with k = (k ,k ,......., k ) and

A = set of all k vectors for which k + k +.....+k = k

(3) kk

1 2 Ni

k

i i

i

i i j

i

k

i ik

1 2 N

1 2 N

i i

i

i

, ....., )( )

( ) }

( )( )

( )

i

N

j jij

N

i

N

A

where

r

1

1

1

1

2

i i i

i i

k m

i i

ii

i

, k m

m m , k m

Utilization at node i: x

m i = 1,2, ..... , N

i i

!

!

78

Page 79: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

Example: (Application-interactive computing)

Multi-Processor

.

.

.

.

.

.

. . . . . . . .

Node 1

Nodes 2,3, …….N

K terminals k jobs

N = avg. " think" time at each terminal (exp. distribution think times)

T =K

seconds

T = avg. responce time

1

79

Page 80: Queueing theory primer - UC Davis: Networks Labnetworks.cs.ucdavis.edu/.../NDP14_QueueingTheory.pdf · Queueing theory primer Lecturer: Massimo Tornatore Original material prepared

),( M/M/1 2. kk

1k

1k

P

1,2,...k

P

mEquilibriu

k

k

P

P

0

k

0

0

2

12

01

1P

subject to

P

P

toleads This

k

k

k PP

PP

P

80