41
The M/G/1 Queue and others

Lecture 4 MG1 Queue

Embed Size (px)

Citation preview

Page 1: Lecture 4 MG1 Queue

The M/G/1 Queue

and others

Page 2: Lecture 4 MG1 Queue

Telephone Line Problem

Callers queue for outgoing lines

This system will allow only eight outgoing connections

Page 3: Lecture 4 MG1 Queue

Telephone Line Problem

• The outgoing telephone lines could be physical, as in the original version, or virtual, as in ATM, and the decision of the CAC function would decide the number of connections available

• This is modeled as a M/M/N/N queue (N servers, no waiting room)

Page 4: Lecture 4 MG1 Queue

Telephone Line Problem

• The arrival process is simple Poisson• If there are n < N customers in the

queue, then they are all being serviced• The service rate for a single line is

(average duration of phone call = 1/)• So the service rate for the whole

queue is n for 0 < n ≤ N

Page 5: Lecture 4 MG1 Queue

Telephone Line Problem

• As before, the average flow between states must be zero

npn = n+1pn+1 for 0 < n ≤ N• This gives us pn = (n+1)pn+1

• or

• where = /

nn pn

p11

Page 6: Lecture 4 MG1 Queue

Telephone Line Problem

• This gives us

• Since we also require pn = 1, we also get

!0 npp

n

n

N

n

n

n

p

0

0

!

1

Page 7: Lecture 4 MG1 Queue

Telephone Line Problem

• The designer of the system is interested in the blocking probability

• This is simply the probability that n = N, or pN

N

n

n

N

B

nN

P

0 !!

Page 8: Lecture 4 MG1 Queue

Erlang Formula

• The formula on the last slide is called the Erlang-B distribution after the pioneering Danish engineer, AK Erlang

• He has given his name to the units we use for traffic intensity, which corresponds to

Page 9: Lecture 4 MG1 Queue

Telephone Line Problem

• The average number of calls in progress is

B

N

n

Nn

N

n

n

N

n

nN

nn

P

Nnp

np

n

npnpnE

1

!!

)!1(

!)(

00

1

1

0

1

0

0

Page 10: Lecture 4 MG1 Queue

Telephone Line Problem

• We would generally expect to be designing systems where PB is low, so E(n) ≈

• The average number of calls put through per unit time, is

B

N

nnn

N

nn

P

nEpnp

1

)(00

Page 11: Lecture 4 MG1 Queue

Design Problem

• You have 1,000 incoming telephone lines, and over an eight hour period, each subscriber makes four phone calls, on the average. The phone calls average five minutes in length. How many outgoing lines must you provide to give a blocking probability of (a) 10% (b) 1%? How many calls would be in progress on the average?

Page 12: Lecture 4 MG1 Queue

Design Problem

= 1000x4/(8x60) = 8.33 calls per minute

= 1/5 = 0.2 calls per minute = / = 8.33/0.2 = 41.67• Blocking probability

N

n

n

N

B

nN

P

0 !!

Page 13: Lecture 4 MG1 Queue

Design Problem

• After a spreadsheet calculation, we find that we need at least 43 servers to give less than a 10% chance of blocking, and at least 55 servers to give less than a 1% chance of blocking

• The corresponding calls in progress is 37.7 for 43 servers and 41.3 for 55 servers

Page 14: Lecture 4 MG1 Queue

M/G/1 Queue

• A memoryless, Poisson process always gives an exponential distribution for inter-arrival or inter-service times

• However there are cases where the service process times are not exponentially distributed

• For example …

Page 15: Lecture 4 MG1 Queue

M/G/1 Queue

• For example, a packet switching system may handle only two different types of packet, one with 100 bytes, and one with 2,000 bytes

• The big packets will take longer to serve (transmit)

• This gives a dumbell distribution

Page 16: Lecture 4 MG1 Queue

M/G/1 Queue

• The service times of the small packets would cluster around a low value, and there would be a cluster at a longer time for the larger packets

Service time, t

F(t)

Page 17: Lecture 4 MG1 Queue

M/G/1 Queue

• Another example would be a server (computer) which has to perform different operations on packets, depending on what type of packet it is

• Possible operations are encrypting, processing for an on-line game, and simple transmission

Page 18: Lecture 4 MG1 Queue

M/G/1 Queue

• And another example would be within an ATM switch, where all packets (or “cells”) are the same size, and thus take the same time to transmit

• In these cases, the service time distribution is said to be “general”, and we describe the queue as M/G/1

Page 19: Lecture 4 MG1 Queue

M/G/1 Queue

• Packet j is completed at time, tj

• The number of packets in the queue at time tj

+ is nj

timetj-1 tj tj+1

Service time, customer j

nj-1 nj nj+1

Page 20: Lecture 4 MG1 Queue

M/G/1 Queue

• During servicing of customer j, a number of packets, j, arrives

• Then the number of packets in the queue after servicing of packet j is

• nj = nj-1 -1 +j for nj-1 > 0

• nj =j for nj-1 = 0

Page 21: Lecture 4 MG1 Queue

M/G/1 Queue

• These equations can be written using a unit step function

• nj = nj-1 – u(nj-1) + j

where u(x) = 1 for x ≥ 1 = 0 for x ≤ 0

• The expected values of nj and nj-1 are the same

Page 22: Lecture 4 MG1 Queue

M/G/1 Queue

• So we must have E() = E(u(n))

• The average value of arrivals, E() must be less than unity for a stable queue, and in fact, must be equal to the utilisation, , by definition,

Page 23: Lecture 4 MG1 Queue

M/G/1 Queue

• Then we have by definition

• Therefore we have

• p0 = 1 – as before (M/M/1)

0)()(1

nPpnuEEn

n

Page 24: Lecture 4 MG1 Queue

M/G/1 Queue

• For the next proof, we need some intermediate results or definitions

• Firstly, the definition of the variance of is

22

222

22

2222

2

2

2)(

E

E

EE

EE

Page 25: Lecture 4 MG1 Queue

M/G/1 Queue

• Secondly, E(u2(n)) = E(u(n)) = E() =

• Thirdly, we assume that j and nj-1 are independent, so that E(jnj-1) = E(j)E(nj-1) = E(nj-1)

• We begin the proof with the equation relating nj and nj-1

• nj = nj-1 – u(nj-1) + j

Page 26: Lecture 4 MG1 Queue

M/G/1 Queue

• We square both sides of the equation nj

2 = nj-12 + u2(nj-1) + j

2 – 2nj-1u(nj-1) – 2u(nj-1)j + 2jnj-1

• We now take the expected value of both sides

+ E(2) – 2E(n) – 22 + 2E(n) = 0• We now substitute for E(2)

Page 27: Lecture 4 MG1 Queue

M/G/1 Queue

• 2E(n) (1 – ) = - 22 + 2 + 2

= (1 – ) +

2

• This finally gives us

)1(22)(

2

nE

Page 28: Lecture 4 MG1 Queue

Expected service time

• The average service time is E(), so the average service rate is 1/E()

• The utilisation, , is the ratio of average arrival rate to average service rate

• So = E()• That is E() = /

Page 29: Lecture 4 MG1 Queue

Queue Size

• To find E(n), we still need to find 2

• We will need a result from the distribution of service times, 2

2 = E[( – /)2]• = E(2 – 2/ + 2/2)• = E(2) – 2/x / + 2/2

• So E(2) = 2 + 2/2

Page 30: Lecture 4 MG1 Queue

Queue Size (find 2)

dfk

ekk

dfkPk

kPk

kEEkE

k

k

k

k

)(!

)()2(

)()|()(

)()(

)())((

00

22

00

2

0

2

222

Page 31: Lecture 4 MG1 Queue

Queue Size (find 2)

• We reverse the order of summation and integration

df

dfkkk

e

dfk

kkkke

k k k

kkk

k

k

)()21()(

)(!

)(

)!1(

)()21(

)!2(

)()(

)(!

)(2)1(

0

22

2 1 0

212

2

0

0

2

0

2

Page 32: Lecture 4 MG1 Queue

Queue Size (find 2)

22

22

222

2222

)21(

)()21()(

EE

Page 33: Lecture 4 MG1 Queue

Queue Size

• We can now substitute back into the formula for E(n), defining = /

• We get

• This formula gives expected queue size in terms of server statistics

)1(

21

1)( 22

nE

Page 34: Lecture 4 MG1 Queue

Queue Size

• This formula collapses to /(1-) for the exponential service distribution

• If we know exactly what the service time will be (eg for ATM cells at a switch), then 2 = 0 and

21

1)(

nE

Page 35: Lecture 4 MG1 Queue

Queue Size

• This is called a deterministic service time, and the queue is then M/D/1

• This gives the lowest possible average queue

• The higher the value of 2, the longer the average queue will be

• The term 1/(1-) dominates for high

Page 36: Lecture 4 MG1 Queue

Time Delay

• Average time delay can be found using Little’s formula, so that

• E(T) = E(n)/

Page 37: Lecture 4 MG1 Queue

Problem

• Three queuing systems, with Poisson arrivals, are alike, except that the servicing distributions are (a) Poisson (b) deterministic and (c) composed of 50% with a service time of 0.1, and 50% with a service time of 1.0. Compare the average queue levels for all cases when = 0.5

Page 38: Lecture 4 MG1 Queue

Problem

• For case (c) the average service time is 1.1/2 = 0.55. So = 1.81818

2 = 0.5(0.1 – 0.55)2 + 0.5(1.0 – 0.55)2

• = 0.2025• From the formula• E(n)=(0.5/0.5)(1–0.25(1-1.82x0.2025))

= 1.083

Page 39: Lecture 4 MG1 Queue

Problem

• For case (a) E(n) = 0.5/0.5 = 1• For case (b) E(n) = 0.5/0.5x(1-

0.5/2) = 0.75• The distribution of case (c) gives a

high variance, and this results in a larger average queue

Page 40: Lecture 4 MG1 Queue

Tutorial Problems

Page 41: Lecture 4 MG1 Queue