M/G/1 variants and Priority Queue

Download Report

Transcript M/G/1 variants and Priority Queue

M/G/1 variants and Priority Queue

Cheng-Fu Chou

Cheng-Fu Chou, CMLab, CSIE, NTU

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 q v n n be the number of customers remaining after the nth service instant. Let 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 = l x/2

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 2

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

– Find Q(z) in term of B*(.), p 0 , p 1 = P(q=1) – Express p 1 Ans: (a) E[q]= r in terms of p 0 + (2(1-p 0 )+ l 2 E[x 2 ]-4 r 2 )/(4(1 r )) (b) Q(z)= B*( l l z) (p 0 (1-z 2 )+p 1 z(1-z))/(B*( l l z)-z 2 ) (c) p1 = 2(1-p 0 r )

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 3

(a) Clearly we can write

q n

 1   

q q v n n n

  2 1  

v v n n

 1  1

q n q n

 1

q n

   2 1 0 Introducin g the function  2, k  2 k k 0   2 k  2 We have q n  1  q n  2, q n  v n  1 , letting n   and taking expection q  q E[  2, q ]  v But E[  2, q ] 

k

   0  2 ,

k P

[

q

k

]  P[q  1]  k    2 2P[q  p 1  2(1 p 0 p 1 )  k] So, v  E[  2, q ]  2 2p 0 p 1

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 4

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

P. 5 Cheng-Fu Chou, CMLAB, CSIE, NTU

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 –

F

(

z

) 

j

   1

f j z j

be the z-transform for the number of customers awaiting service when the server returns from vacation to find at least one customer waiting

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 6

(a) Derive an expression which gives q n+1 v n+1 and j (b) Derive Q(z) in term of p (c) Show that p 0 = (1 r )/F 1 0 (1), r = l x in term of q (d) Assume now that the service vacation will end 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.

n , whenever a new customer enters the empty system.

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 7

(a) Clearly, if q n  0, q n  1  q n  1  v n  1 as for the usual M/G/1 system If q n  0 the server goes on vacatio n and does not begin serving until there are f  1 in the system.

Thus, q n  1  f 1  v n  1 for q n  0.

Let  f, k    k k f k   0 0 So, q n  1   f, k  1  v n  1

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 8

(b) We have Q n  1 (z)  E[z q n  1 ]  E[z  f, q n 1  v n  1 ]  E[z v n  1  1 ]E[z  f, q n ] by indepenede nce of v n  1 , f, q n .

Letting n   we find Q(z)  V(z) z

E

[ z  f, q ] and

E

[ z  f, q ]  E[z f ]p[q  0]  k    1

z k

 F(z)p 0  [Q(z) p 0 ]

p

[

q

k

] Q(z)  V(z) p 0 (1 F(z)) and V(z)  B * ( l V(z) z l z) Q(z)  B * ( l l z) B p * (1 0 ( l F(z)) l z) z

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 9

(c) From (b), we have Q(z)  V(z) p 0 (1 F(z)) V(z) z To determine p 0 , we evaluate the above eqn.

at z  1 (using L' Hospital rule).

Then, 1  Q(z) V(z)  lim

z

 1 B p * (1 0 ( l F(z)) l z) z  p 0 (-F (1) (1)) B * (1) (0)( l ) 1 p 0  1 F (1) r (1)  p 0 F (1) 1 l (1) x

P. 10 Cheng-Fu Chou, CMLAB, CSIE, NTU

(d) In this case, f

1 

1 and f

k 

0 for k

1.

So, F(z)

z and F

(1)

(1)

1, Q(z)

B * (

l

-

l

z) (1 B *

r

)(1 (

l

p

0 

1 -

l

z) z) z

r

.

whic h is the P K transfor m equation for M/G/1

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 11

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. 12

  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. 13

 By using the same graphical argument r t x 1 x 1 x 2 v 1 v 2 x M(t) time t

P. 14 Cheng-Fu Chou, CMLAB, CSIE, NTU

 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

R

t

1

t

0 

r

( t )

d

t 

t

1

M i

 ( )  1

t

1 2

x i

2 

t

1

L i

(  )

t

 1 1 2

v i

2 

M(t) t M i

 ( )

t

 1 1 2

x i

2

M(t)

L

(

t

)

t L i

(  )

t

 1 1 2

v i

2

L

(

t

)  *

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 15

Taking limit as t   M(t) t L(t) t  l  1 

v

r ,  t(1 L(t) r ) 

v

R

*

λ x

2 2 

(

1 

ρ)

2

v v

2

W

R

1  r 

λ x

2 2 ( 1  r ) 

v

2 2

v

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 16

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 (a) Find B* T (s) in term of B*(s), p and q (b) Find Q systsem T (z) (c) Find N, the average number of customer in the

P. 17 Cheng-Fu Chou, CMLAB, CSIE, NTU

(a) Conditioni ng on the number of return tri ps, we have B * T (

s

| exactly n return tri ps)  (B * (s)) n  1 Uncon ditioning yields B * T (

s

) 

n

   0

B T

* (

s

| exactly n return tri  n    0 ( B * (s)) n  1

qp n

 ps)p(exact ly n resturn tr ips)

qB

* (

s

)

n

   0 [

pB

* (

s

)]

n

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 18

(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. 19

Q T

(

z

)

where B

* T

B T

* 

(

l

1

 l

z

) ( 1

B T

* 

(

l r

T

)( 1

l

z

)

 

z

)

z

qB

*

(

pB

*

s

) (

s

) and

r

T

 l

x q

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 20

(c) For M/G/1, N

 r  l 2

2 ( 1

x

2 r

) .

So, N

 r

T

 l 2

2 ( 1

x T

r 2

T

)

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 21

Priority Queue

 M/G/1 system with n different priority classes – class 1 > class 2 > class 3 >… – Arrival rate: l k – Mean service time: x k = 1/ m k – Second moment of service time:

x i

2

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 22

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 – N Q k : average number on queue for class k – W k : average queueing time for class k – r k = l k / m k : system utilization for class k – R: mean residual service time

P. 23 Cheng-Fu Chou, CMLAB, CSIE, NTU

 Assume that overall system utilization is less than 1, i.e., r 1  r 2  ...  r n < 1 

W

1 

R

 1

μ

1

N

1

Q

By Little' s result

N

1

Q

similarly, 

λ

1

W

1

,

W

1  1 

R ρ

1

W

2

W

2  

R R

 1

N μ

1 

ρ

1

W

1 1

Q

1

1

2  1

μ

2

N Q

2  1

μ

1

λ

1

W

2

W

2 

R (

1

1

)(

1

1

2

)

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 24

The derivation is similar for all priority classes k  1 W k  (1 r 1 r 2 ...

r R k 1 )(1  The avg.

delay per customer r 1 ...

r k ) of class k is T k  1 m k 

w k

Moreover, the mean residual service time R R  1 2

i n

  1 l

i x i

2  W k  2 (1 r 1 r 2 ...

i n

  1 r l

i

k 1

x i

2 )(1 r 1 ...

r k )

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 25

HW

 Consider a nonpreemptive system and 2 customer classes A and B with respective arrival and service rate l A , m A , and l B , m B .

If m A (avg. over both classes) T = l A > T m A B + show that the average delay per customer l B T B /( l A + l B ) 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. 26

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. 27

1 1.

m k 2 .

1 r 1 R k ...

r k , where R k 3 .

T k  1 m k  1 r 1 R k ...

r k 

i k

  1 l

i x i

2 2   

i

 1

k

  1 r

i

 

T k T

1  1 m 1  1  r 1  

R

1 1  r 1 ,

T k

  1  1 r 1 m k   1  ...

...

r 1  ...

...

r k 1  1  r k r 1  

R k

 ...

...

r k 

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 28

CASE Study

   DTMC for Slotted Aloha CTMC for Wireless handoff model DTMC for 802.11 Model

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 29

Slotted Aloha Model

 The Aloha network was developed to provide radio based data communication.

– Slotted system – Collision or perfect reception – Consider m users, n of which are currently backlogged. Each of the m-n unbacklogged users is assumed to transmit independently in each slot with probability a, while each backlogged user transmits independently in each slot with probability b

P. 30 Cheng-Fu Chou, CMLAB, CSIE, NTU

DTMC for Slotted Aloha

Let the number of backlogged users, n, denote the state of the DTMC.

Let A(i, n) denote the probabilit y that i unbacklogg ed users attempt to transmit in a slot when the DTMC is in state n and B(i, n) be the correspond ing probabilit y for backlogged users.

A

(

i

,

n

) 

i n

   1 

a

m

n

i a i

, 0 

i

m-n B

(

i

,

n

)   

n i

   1 

b

n

i b i

, 0 

i

n

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 31

DTMC for Slotted Aloha

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 32

Wireless Handoff Model

 Consider the performance model of a single cell in a cellular wireless communication network. – New calls arrive in a Poisson stream at the rate l 2 at the rate the rate m 2 m 1 l 1 – Handoff calls arrive in a Poisson stream at the rate – An ongoing call (new or handoff) completes service – The mobile engaged in the call departs the cell at

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 33

More…

   There are a limited number of channels, n, in the channel pool.

When a handoff call arrives and an idle channel is available in the channel pool, the call is accepted and a channel is assigned to it. Otherwise, the handoff call is dropped.

When a new call arrives, it is accepted provided g+1 or more channel are available in the channel pool; otherwise the new call is blocked. Here, g is the number of guard channels used to give priority to handoff calls.

P. 34 Cheng-Fu Chou, CMLAB, CSIE, NTU

CTMC for Handoff Model

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 35

   

DTMC for Memory Interference in Multiprocessor System

The processors’ ability to share the entire memory space provides a convenient means of sharing information and provides flexibility in memory allocation The price of sharing is the contention for the shared resource To reduce contention, the memory is usually split up into modules, which can be accessed independently and concurrently with other modules When more than one processor attempts to access to the same module, only one processor can be granted access, while other processors must await their turn in a queue.

P. 36 Cheng-Fu Chou, CMLAB, CSIE, NTU

 The effect of such contention, or interference, is to increase the average memory access time.

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 37

M 1 Memory modules ● ● ● M j ● ● ● M m Interconnection network P 1 ● ● ● P i ● ● ● Processors P n

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 38

Assumptions

   The time to complete a memory access is a constant and all modules are synchronized Processors are assumed to be fast enough to generate a new request as soon as their current request is satisfied A processor cannot generate a new request when it is waiting for the current request to be completed

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 39

 The operation of the system can be visualized as a discrete-time queueing network

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 40

   The memory modules are the servers and the fixed number, n, of processors constitute the jobs or customers circulating in this closing queueing network.

Let qi denotes the probability that a processor generated request is directed at memory modules i, i= 1, 2, …, m. Consider a system with 2 memory and 2 processors

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 41

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 42

Memory Referencing Behavior

  In the renewal model, the successive intervals between references to a given page were assumed to be i.i.d. r.v..

We consider a special case of the renewal model, where the intervals are geometrically distributed. This is known as the independent reference model (IRM) of program behavior.

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 43

Independent Reference Model

    A program’s address space typically consists of continuous pages represented by the indices 1,2,…,n.

To study a program’s reference behavior, it can be represented by the reference string w=x 1 , x 2 ,…,x t .

Successive references are assumed to form a sequence of i.i.d. r.v. with P(x t = i) = b i , 1  i  n. The interval between 2 successive references to page i is geometrically distributed with parameter b i .

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 44

LRU model

   Assume that a fixed number, m (1  m  n), of page frames have been allocated to the program.

The state of the paging algorithm at time t, denoted by q(t), is an ordered list of the m pages in main memory.

If the next page referenced (x the ordered list q(t) t+1 ) is not in main memory, then a page fault occurs. This will, in general, require the replacement of an existing page from main memory. We will assume that the rightmost page in

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 45

LRU model (cont.)

   If the next page referenced (x updated to q(t+1) t+1 ) is in main memory, no page fault (and replacement) occurs, but the q(t) is We can see that the sequence of states q(0), q(1), …,q(t),… forms a DTMC with the state space consisting of n!/(n-m)! Permutations over {1,2,…,n} Assume that the main memory is preloaded initially with m pages.

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 46

LRU model Example

  Consider the LRU paging algorithm with n=3 and m=2.

Let q(t) be ordered by the recency of usage, so that q(t) = (i,j) implies that page indexed i was more recently used than page j, and page j will be the candidate for replacement.

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 47

Cheng-Fu Chou, CMLAB, CSIE, NTU P. 48