m/g/1 variants and priority queue -...

28
Cheng-Fu Chou, CMLab, CSIE, NTU M/G/1 variants and Priority Queue Cheng-Fu Chou

Upload: others

Post on 03-Sep-2019

2 views

Category:

Documents


0 download

TRANSCRIPT

Cheng-Fu Chou, CMLab, CSIE, NTU

M/G/1 variants and Priority Queue

Cheng-Fu Chou

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 2

HW. 1 M/G/1 with bulk service

Consider an M/G/1 system with bulk service. Whenever the server becomes free, he accepts 2 customers from the queue into service simultaneously, or , if only one is on queue, he accepts that one; in either case, the service time for the group (of size 1 or 2) is taken from B(x). Let qn be the number of customers remaining after the nth service instant. Let vn be the number arrivals during the nth service. Define B*(s), Q(z), and V(z) as transforms associated with the random variables x, q, v as usual. Let r= lx/2

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 3

– Using the method of imbedded Markov chain, find E(q) in term of r, P(q=0) =p0.

– Find Q(z) in term of B*(.), p0, p1= P(q=1)

– Express p1 in terms of p0

Ans:

(a) E[q]= r + (2(1-p0)+l2E[x2]-4r2)/(4(1-r))

(b) Q(z)= B*(l-lz) (p0(1-z2)+p1z(1-z))/(B*(l-lz)-z2)

(c) p1 = 2(1-p0-r)

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 4

10q2,

101

2k

0

,2q2,

q2,

1nq2,n1n

k2,

1

1

1

1

p-2p - 2 ]E[ v So,

)p-p-2(1 p

k]2P[q 1]P[q

][]E[

But

v ]E[ - q q

expection taking

and n letting ,v- q q have We

2k0k

2k 2

function thegIntroducin

0

1 1

2 2

can write Clearly we (a)

n

k

k

nn

nnn

nnn

n

kqP

qv

qvq

qvq

q

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 5

HW2 M/G/1 (service time)

Consider an M/G/1 queueing system in which service is given as follows. Upon entry into service, a coin is tossed, which has probability p of giving Heads. If the result is Heads, the service time for that customer is 0 seconds. If Tails, his service time is drawn from the following uniform distribution: f(x)=1/(b-a), if a<x<b; otherwise f(x)=0

– Find the average service time x

– Find the variance of service time

– Find the expected waiting time

– Find W*(s)

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 6

M/G/1 with vacations

Consider a first-come-first-served M/G/1 queue with the following changes. The server serves the queue as long as someone is in the system. Whenever the system empties the server goes away on vacation for a certain length of time, which may be a random variable. At the end of his vacation the server returns and begins to serve customers again: if he returns to an empty system then he goes away on vacation. Let

– be the z-transform for the number

of customers awaiting service when the server returns from vacation to find at least one customer waiting

1

)(j

j

j zfzF

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 7

(a) Derive an expression which gives qn+1 in term of qn, vn+1 and j

(b) Derive Q(z) in term of p0

(c) Show that p0 = (1-r)/F1(1), r = lx

(d) Assume now that the service vacation will end whenever a new customer enters the empty system. For this case find F(z) and show that when we substitute it back into our answer for (b) then we arrive at the classical M/G/1 solution.

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 8 1nkf,1n

kf,

n1n1n

n

1nn 1nn

v1 q

So,

0k f

0k k Let

0. qfor v 1 - f q Thus,

system. in the 1 f are thereuntil servingbegin not

does andn on vacatio goesserver the0q If

system M/G/1 usual for the as

v1q q 0,q if Clearly, (a)

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 9 z - z)-(*B

F(z))-(1pz)-(*B Q(z)

z)-(*B V(z) and z - V(z)

F(z))-(1pV(z) Q(z)

]p-[Q(z) F(z)p

][ 0]]p[qE[z ]z[ and

]z[z

V(z) Q(z)

find wen Letting .qf,, vof nceindepenedeby

]]E[zE[z

]E[z ]E[z (z)Q

have We(b)

0

0

00

1k

f

n1n

1v

v1-q

1n

qf,

qf,

qnf,1n

1nqnf,1n

llll

ll

kqpzE

E

k

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 10 (1)F

-1 p

x-1

(1)Fp

1 - )(0)(-*B

(1))(-Fp

z - z)-(*B

F(z))-(1plim

V(z)

Q(z) 1

Then, rule). HospitalL' (using

1 zat eqn. above theevaluate we,p determine To

z - V(z)

F(z))-(1pV(z) Q(z)

have we(b), From (c)

(1)0

(1)

0

(1)

(1)

0

0

1

0

0

r

ll

ll

z

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 11

M/G/1for equation mK transfor-P theish whic

z-z)-(*B

z)-)(1-(1z)-(*B Q(z)

.-1 p1, (1)F and z F(z) So,

1.k for 0f and 1f case, In this (d)

0

(1)

k1

ll

rll

r

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 12

M/G/1 with vacations

At the end of each busy period, the server goes on vacation for some random interval of time

A new arrival to an idle system rather than going into service immediately, waits for the end of the vacation

x1 x2 x3 x4 v1 v2 v3 x5

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 13

Let v1, v2, …, be the duration of successive vacations taken by the server and they are i.i.d. r.v.

Observation

– A new arrival to the system, waits for the completion of the current service or vacation

o So, the waiting time formula W = R/(1-r) is still valid

– R is the mean residual time for completion of the service or vacation

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 14

By using the same graphical argument

x1

x1

x2 xM(t)

rt

time t v1 v2

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 15

Residual service time for an M/G/1 system with vacations

– M(t): # of services completed by time t

– L(t) : # of vacations completed by time t

*)(

2

1

)(2

1

2

11

2

11)(

1

2)(

1

)(

1

2

2)(

1

)(

1

2

0

tL

v

t

tL

M(t)

x

t

M(t)

vt

xt

drt

R

i

tL

i

tM

i

i

i

tL

i

tM

i

i

t

tt

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 16

v

vxλR W

v

vρ)(xλ * R

vv

2)1(21

2

1

2

L(t)

)-t(1 ,

1

t

L(t)

t

M(t)

taslimit Taking

22

22

rr

rr

l

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 17

M/G/1 with feedback queue

Consider an M/G/1 system in which a departing customer immediately joins the queue again with probability p, or departs forever with probability q = 1- p. Service is FCFS, and the service time for a returning customer is independent of his previous service time. Let B*(s) be the transform for the service time pdf and let B*T(s) be the transform for a customer’s total service time pdf.

(a) Find B*T(s) in term of B*(s), p and q

(b) Find QT(z)

(c) Find N, the average number of customer in the systsem

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 18

0

**1n*

0n

0

**

T

1n**

T

)]([)((s))B(

ips)resturn trn ly ps)p(exactreturn trin exactly |()(B

yields ditioning Uncon

(s))(B ps)return trin exactly |(B

have weps,return tri ofnumber on the ngConditioni (a)

n

nn

n

T

spBsqBqp

sBs

s

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 19

(b) In determining the number in the system, we may assume that a customer cycles backs directly into service instead of to the tail of the queue. This is allowed due to the “memoryless” selection of a new service time each time a customer returns in addition to the independence of the feedback decision. Thus, we may consider our queue as an M/G/1 system with B*T(s) as the transform for the service time.

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 20

q

x

spB

sqB

zzB

zzBzQ

T

T

TTT

lr

ll

rll

and )(1

)(B where

)(

)1)(1()()(

*

**

T

*

*

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 21

)1(2N So,

.)1(2

N M/G/1,For (c)

22

22

T

TT

x

x

r

lr

r

lr

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 22

Priority Queue

M/G/1 system with n different priority classes

– class 1 > class 2 > class 3 >…

– Arrival rate: lk

– Mean service time: xk = 1/mk

– Second moment of service time: 2

ix

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 23

Nonpreemptive priority

A customer undergoing service is allowed to complete service without interruption even if a customer of higher priority arrives in the meantime. A separate queue is maintained for each priority class

– Goal: find an equation for average delay for each priority class

– Total n classes

– NQk: average number on queue for class k

– Wk: average queueing time for class k

– rk = lk/mk: system utilization for class k

– R: mean residual service time

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 24

Assume that overall system utilization is less than 1, i.e., r1

r2 ... rn < 1

)-ρ-ρ)(-ρ(

R W

-ρ-ρ

W ρR W

Wλμ

R W

ρ

RW,WλN

R W

QQ

Q

Q

211

2

21

112

21

1

2

2

1

1

2

1

111

1

1

1

1

11

1

111

similarly,

1

result sLittle'By

1

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 25 )-...--)(1-...---(12

W

2

1 R

R timeservice residualmean theMoreover,

1 T

isk class ofcustomer per delay avg. The

)-...--)(1-...---(1

R W

1 k classespriority allfor similar is derivation The

k11-k21

1

2

k

1

2

k

k

k11-k21

k

rrrrr

l

l

m

rrrrr

n

i

ii

n

i

ii

k

x

x

w

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 26

HW

Consider a nonpreemptive system and 2 customer classes A and B with respective arrival and service rate lA, mA, and lB, mB .

If mA > mB show that the average delay per customer (avg. over both classes)

T = lATA + lBTB/(lA+lB) is smaller when class A with higher priority (class A > class B) than the case when class B with higher priority ( class B > class A)

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 27

Preemptive resume priority

Service of a customer is interrupted when a higher priority customer arrives and is resumed from the point of interruption once all customers of high priority have been served.

Cheng-Fu Chou, CMLAB, CSIE, NTU

P. 28

k11-k1

k1

k

1

11

11

1

1k1

k

k

k

1

2

k

k1

k

k

-......1-......1

-......11

,1

11

-...--1

R1T .3

2R where,

-...--1

R .2

1 1.

rrrr

rrm

r

rm

rrrm

l

rr

m

k

k

k

k

i

i

k

i

ii

R

T

R

T

T

x