s-38.3143 queueing theory - tkk · s-38.3143 queueing theory, ii/2007 virtamo / penttinen hence,...

27
S-38.3143 Queueing Theory, II/2007 Exercises Virtamo / Penttinen 10th December 2007 μ μ μ Contents 1 Discrete and Continuous Distributions 1 2 Distributions and Markov Chains 5 3 Birth&death- and Poisson-processes, Little’s result 8 4 Loss Systems 12 5 Queuing Systems 16 6 Priority queues, queuing networks 20 AB TEKNILLINEN KORKEAKOULU

Upload: others

Post on 09-Oct-2020

14 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007Exercises

Virtamo / Penttinen

10th December 2007

µ

µ

µ

Contents

1 Discrete and Continuous Distributions 1

2 Distributions and Markov Chains 5

3 Birth&death- and Poisson-processes, Little’s result 8

4 Loss Systems 12

5 Queuing Systems 16

6 Priority queues, queuing networks 20

AB TEKNILLINEN KORKEAKOULU

Page 2: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Helsinki University of TechnologyDepartment of Electrical and Communications EngineeringNetworking LaboratoryP.O. Box 3000FIN-02015 HUT

Page 3: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 1 DISCRETE AND CONTINUOUS DISTRIBUTIONS

EX 1: Discrete and Continuous Distributions

1. There are two coins one of which is normal and the other one has head on both sides. One ofthe coins is chosen randomly and tossedm times and each time the result is head. What isthe probability that the chosen coin is the normal one. Calculate also the numerical value form = 1, 2, 3.

Solution:

Denote the possible event with the following symbols:

X the normal coin is chosen,P{X} = 1/2

Y the fake coin is chosen,P{Y } = 1/2

Cm tossing the chosen coinm times givesm heads in a row

Then the conditional probabilities for gettingm heads in a row are

P{Cm|X} = (1/2)m,

P{Cm|Y } = 1.

The asked quantity isP{X|Cm}, so we can apply the Bayes formula:

P{Aj |B} =P{B|Aj}P{Aj}∑i P{B|Ai}P{Ai} ,

where⋃

i Ai = S andAi⋂

Aj = ∅ ∀i 6= j. So in this case we get

P{X|Cm} =P{Cm|X}P{X}

P{Cm|X}P{X} + P{Cm|Y }P{Y } =(1/2)m · (1/2)

(1/2)m · (1/2) + 1 · (1/2) =1

2m + 1.

Form = 1, 2, 3 we get

m P{X|Cm}1 1/32 1/53 1/9

2. In a Bernoulli trial 1 is obtained with probability p and 0 with probability q = 1 − p. The valueof p is unknown, but it is known that it is drawn from a uniform distribution in (0,1), i.e. all valuesin this interval are a priori equally likely. The Bernoulli trial is repeated in order to estimate thereal value ofp. In the trials result 0 occurs n0 times and result 1n1 times. What is theposteriordistribution (Bayes) of p according to the trials? Where is the maximum of the distribution?

Solution:

Let n = n0 + n1. The probability, that aftern trials we have gotten result1 exactlyn1 times is

P{n1|p} =(

n

n1

)pn1(1 − p)n−n1

Denote withf(p) the conditional pdf ofp and withf0(p) the a priori pdf of p. THe Bayes formulagives

f(p) =P{n1|p}f0(p)∫ 1

0 P{n1|p}f0(p)dp=

P{n1|p}∫ 10 P{n1|p}dp

=pn1(1 − p)n−n1∫ 1

0 pn1(1 − p)n−n1dp,

asf0(p) = 1 (uniform distribution). DenoteC(n1, n) =∫ 10 pn1(1 − p)n−n1 dp, when

f(p) =pn1(1 − p)n−n1

C(n1, n).

1

Page 4: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

The maximum of distribution is obtained by taking the derivate:

f ′(p) =1C

[n1p

n1−1(1 − p)n0 − n0pn1(1 − p)n0−1

]f ′(p∗) = 0 ⇒ n1(1 − p∗) = n0p

∗ ⇒ p∗ =n1

n0 + n1.

Next we deduceC(n1, n):

n∑n1=0

(n

n1

)C(n1, n)zn1 =

∫ 1

0

n∑n1=0

(n

n1

)(zp)n1(1 − p)n−n1 dp

=∫ 1

0((zp) + (1 − p))n dp =

∫ 1

0((z − 1)p + 1)n dp

=1/

0

1n + 1

1z − 1

((z − 1)p + 1)n+1

=1

n + 1

(zn+1 − 1

z − 1

)=

1n + 1

n∑n1=0

zn1 ,

and comparing the factors ofzn one sees that

C(n1, n) =1

n + 11(nn1

) =n1!(n − n1)!

(n + 1)!=[(n + 1)

(n

n1

)]−1

.

Hence, the conditional distribution ofp is

f(p) = (n + 1)(

n

n1

)pn1(1 − p)n0 .

Furthermore, the expected value ofp on condition thatn1 is known, is

E [p|n1] =∫ 1

0p f(p) dp = (n + 1)

(n

n1

) =C(n1+1,n+1)︷ ︸︸ ︷∫ 1

0pn1+1(1 − p)n−n1 dp

=(n + 1)

( nn1

)(n + 2)

( n+1n1+1

) =(n + 1)n!(n1 + 1)!(n − n1)!(n + 2)n1!(n − n1)!(n + 1)!

=n1 + 1n + 2

.

3. Apply the conditioning rules

E [X] = E [E [X|Y ]]

V [X] = E [V [X|Y ]] + V [E [X|Y ]]

to the caseX = X1 + . . . + XN , where theXi are independent and identically distributed(i.i.d.) random variables with mean m and variance σ2, and N is a positive integer valuedrandom variable with mean n and varianceν2. Hint: Condition on the value of N .

Solution:

By applying the given conditioning rules we get

E [X] = E [E [X|N ]] = E [Nm] = nm.

V [X] = E [V [X|N ]] + V [E [X|N ]] = E[σ2N

]+ V [mN ] = nσ2 + m2ν2.

2

Page 5: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 1 DISCRETE AND CONTINUOUS DISTRIBUTIONS

4. Five different applications are transmitting packets in a LAN. For each application i, i =1, . . . , 5, measurements are carried out to determine the mean,mi, and the standard devia-tion, σi, of the packet lengths. The measurements provide also a classification of the packetsgiving the proportion of packets belonging to each applicationi (denoted bypi). The results ofthe measurements are summarized in the following table. Compute the mean and the standarddeviation of the lengths of all packets in the network.

application pi mi σi

1 0.30 100 102 0.15 120 123 0.40 200 204 0.10 75 55 0.05 300 25

Solution:

Let the random variableX denote the packet length andY denote the application in which the packetbelongs to. Apply the chain rule of expectation and variance:

E [X] = E[

mi︷ ︸︸ ︷E [X|Y ]] =

∑i

pimi = 150.5

V [X] = E[

σ2i︷ ︸︸ ︷

V [X|Y ]] + V[

mi︷ ︸︸ ︷E [X|Y ]]

=∑

i

piσ2i +

∑i

pim2i −

(∑i

pimi

)2

= 245.35 + 26222.5 − 22650.25 = 3817.6.

Thus the packet length in the network has the mean150.5 and standard deviation61.8.

5. Assume that the traffic process in a LAN is stationary, whence periods of equal length are sta-tistically identical. Denote the amount of traffic (kB) carried in the network in consecutive 10min periods by X1, X2 and X3 (random variables). In measurements over a long time one hasobserved that the variance of the traffic in periods of 10 min, 20 min and 30 min arev1, v2 jav3, respectively. In other words,v1 = V [X1] = V [X2] = V [X3], v2 = V [X1 + X2] =V [X2 + X3] and v3 = V [X1 + X2 + X3]. DetermineCov[X1, X2] = Cov[X2, X3] andCov[X1, X3] in terms of v1, v2 andv3. Hint: e.g. the previous one can be obtained by expandingv2 = V [X1 + X2] = Cov[X1 + X2, X1 + X2].

Solution:

X 1 X 2 X 3

Definition: Cov[A,B] = E [(A − E [A]) · (B − E [B])] = E [AB] − E [A] E [B].Thus e.g.Cov[A + B,C] = E [AC + BC]− E [A + B] E [C] = Cov[A,C] + Cov[B,C] etc.

(i) Stationary⇒ Cov[X1,X2] = Cov[X2,X3]

v2 = Cov[X1 + X2,X1 + X2] = Cov[X1,X1] + 2Cov[X1,X2] + Cov[X2,X2]= 2v1 + 2Cov[X1,X2] ⇒ Cov[X1,X2] = v2/2 − v1.

(ii)

v3 = Cov[X1 + X2 + X3,X1 + X2 + X3]= V [X1] + V [X2] + V [X3] + 2Cov[X1,X2] + 2Cov[X2,X3] + 2Cov[X1,X3]= 3v1 + 4(v2/2 − v1) + 2Cov[X1,X3] ⇒ Cov[X1,X3] = v1/2 − v2 + v3/2.

3

Page 6: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

Hence, measuring variancesv1, v2 andv3 is enough to determine covariances.

6. The length of the packet (in bytes) arriving to a router is assumed to obey geometric distribution.The mean length of packet is 100 bytes. Each packet is first read into an input buffer. How largethe input buffer should be in order that an arriving packet fits there with probability of 95 % orhigher?

Solution:

Let random variableX denote the length of the packet. The packet length was assumed to obey ageometric distribution with mean100, and thus

P{X = n} = (1 − p)n−1 · p = qn−1 · p,

wherep = 1/100. Let the input buffer length beN . The probability that a random packet overflows isthen,

P{X ≤ N} =N∑

i=1

qi−1 p = p

n−1∑i=0

qi = p1 − qN

1 − q= 1 − qN

from whatN can be obtained:

P{X ≤ N} ≥ 0.95qN ≤ 0.05

N ln q ≤ ln 0.05 (ln q < 0)N ≥ ln 0.05/ ln q ≈ 298.1,

thus when the buffer length is299 bytes or more, the arriving packet fits in the buffer with probabilityof 95 % or more.

4

Page 7: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 2 DISTRIBUTIONS AND MARKOV CHAINS

EX 2: Distributions and Markov Chains

1. Let S = X1 + . . . + XN , whereXi ∼ Exp(µ), be i.i.d. andN an independent geometricallydistributed random variable, P{N = k} = (1 − p)pk−1, k = 1, 2, . . .. Determine the taildistribution of S, G(x) = P{S > x}.

Solution:

First we derive the generating function of geometrical distribution:

GN (z) =∞∑

k=1

zk(1 − p)pk−1 =(

1 − p

p

) ∞∑k=1

(pz)k =1 − p

p

pz

1 − pz= z

1 − p

1 − pz.

Similarly, the generating function of exponential distribution is

GX(s) =∫ ∞

0µe−µte−st dt =

∫ ∞

0µe−(µ+s)tdt =

µ

µ + s.

The generating function of random sum is

S(s) = GN (GX(s)) = (1 − p)µ

µ+s

1 − p µµ+s

= (1 − p)µ

µ + s − pµ=

(1 − p)µ(1 − p)µ + s

.

In other words, the sumS obeys the exponential distribution with parameter(1 − p)µ. Hence, the taildistribution is

P{S > x} =∫ ∞

x(1 − p)µe−(1−p)µt dt =

∞/x

e−(1−p)µt = e−(1−p)µx.

2. Prove (without using the generating function), that the sum of two Poisson random variables,N1 ∼ Poisson(a1) andN2 ∼ Poisson(a2), is also Poisson distributed:(N1+N2) ∼ Poisson(a1+a2). Prove the same result with the aid of generating functions.

Solution:

Poisson-distribution:P{Ni = n} = (ai)n

n! · e−ai .

P{N = n} = P{N1 + N2 = n} =n∑

j=0

P{N1 = j} · P{N2 = n − j}

=n∑

j=0

(a1)j

j!· e−a1 · (a2)n−j

(n − j)!· e−a2 =

e−(a1+a2)

n!

n∑j=0

n!j!(n − j)!

· (a1)j(a2)n−j

=(a1 + a2)n·

n!· e−(a1+a2), (binomial theorem)

thus the sumN = N1 + N2 is Poisson(a1 + a2).

On the other hand, letX ∼ Poisson(a). Then the generating function of the random variableX is

GX(z) = E[zX ] =∞∑

j=0

zj aj

j!e−a = e−a

∞∑j=0

(az)j

j!= e−aeaz = e(z−1)a.

Let N(z) denote the generating function of sumN1 + N2, for which we obtain

N(z) = N1(z) · N2(z) = e(z−1)a1 · e(z−1)a2 = e(z−1)(a1+a2).

Hence,N obeys Poisson distribution with parametera1 + a2.

5

Page 8: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

3. Let X be an exponential random variable. Without any computations, tell which one of thefollowing is correct. Explain your answer.

a) E[X2|X > 1

]= E

[(X + 1)2

]b) E

[X2|X > 1

]= E

[X2]+ 1

c) E[X2|X > 1

]= (1 + E [X])2

Solution:

Clearly a) is true, as from the lack of memory property of exponential distribution it follows that onconditionX > 1 the random variableX is similarly distributed asX + 1.

4. The transition probability matrix of a four state Markov chain is

P =

0BB@

0 0 1/2 1/21 0 0 00 1 0 00 1 0 0

1CCA.

Draw the state transition diagram of the chain and deduce which states are transient and whichare recurrent.

Solution:

Clearly, all the states of the chain are recurrent (process returns to eachstate with probability of1) and there are no transient states (probabilityof return is less than1). Formally, let

pndef= P{ chain returns to state3 during3n steps}.

Thus,4 2

31

1

11

0.5

0.5

p1 =12

p2 =12

+ (1 − 12) · 1

2=

12

+(

12

)2

⇒ pn =n∑

i=1

(12

)i

and at the limitn → ∞ we get,

p =12

∞∑i=0

(12

)i

=12

11 − 1/2

= 1.

Thus the chain returns to state3 with probability of1 and the state is recurrent. Similarly for state4.

5. Time to absorption. A three state Markov chain (with statesi = 1, . . . , 3) has the state transitionprobability matrix:

P =0@

1/4 1/2 1/41/2 1/4 1/40 0 1

1A.

State 3 is an absorbing state. LetTi denote the average time (number of steps) needed by a systemin state i to reach the absorbing state 3 (T3 = 0). Write equations for Ti, i = 1, 2, based on thefacts that the next transition i → j takes one step and due to the Markovian property it takesTj

steps on the average to reach the absorbing state from statej. Solve the equations.

6

Page 9: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 2 DISTRIBUTIONS AND MARKOV CHAINS

Solution:

From symmetry it follows thatT1 = T2, and thus

T1 = p11 · (1 + T1) + p12 · (1 + T2) + p13 · (1 + T3)= 1 + p11T1 + p12T1 (symmetry)

= 1 +34T1 ⇒ T1 = 4.

1/41/4

1

1/4 1/4

1/2

1/2

6. Define the state of the system at thenth trial of an infinite sequence of Bernoulli(p) trials to bethe number of consecutive succesful trials preceeding and the current trial, i.e. the state is thedistance to previous unsuccesful trial. If thenth trial is unsuccesful, thenXn = 0; if it succeedsbut the previous one was unsuccesful, thenXn = 1, etc. a) What is the state space of the system?b) Argue that Xn forms a Markov chain. c) Write down the transition probability matrix of theMarkov chain (give its structure).

Solution:

(a) Xn can be any integer from0 to∞(b) The experiments are independent:

Xn+1 ={

Xn + 1 with probability ofp,0 with probability of1 − p,

that is the state of the system at timen+1 depends only on the state at timen. That is the Markovproperty and hence the system is a Markov chain.

(c)

P =

1 − p p 0 0 · · ·1 − p 0 p 0 · · ·1 − p 0 0 p · · ·

......

......

. ..

7

Page 10: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

EX 3: Birth&death- and Poisson-processes, Little’s result

1. Determine the probability distribution in equilibrium for birth-death processes (state spacei =0, 1, 2, . . . ), which transition intensities are a)λi = λ, µi = iµ, b) λi = λ/(i + 1), µi = µ,whereλ and µ are constants.

Solution:

i+1i i+1iµ(i+1)

λ

µ

i+1λ

Figure 1: Transition intensities between the states i and i + 1.

(a) From fig. it can be seen that

(i + 1)µπi+1 = λπi ⇒ πi+1 =1

i + 1λ

µπi =

a

i + 1πi.

That is

π1 = aπ0,

π2 =a

2π1 =

a2

2!π0,

...

πi =ai

i!π0.

Furthermore,∑

i πi = 1, i.e.

∑i

πi = π0

∑i

ai

i!= π0e

a ⇒ π0 = e−a.

So

πi =ai

i!e−a.

(that is a Poisson-distribution with parametera = λ/µ)

(b) In this case we obtain

λ

i + 1πi = µπi+1 ⇔ πi+1 =

a

i + 1πi

that is the probability distribution in equilibrium is the same as in (a).

2. In a game audio signals arrive in the interval(0, T ) according to a Poisson process with rateλ,where T > 1/λ. The player wins only if there will be at least one audio signal in that intervaland he pushes a button (only one push allowed) upon the last of the signals. The player uses thefollowing strategy: he pushes the button upon the arrival of the first (if any) signal after a fixedtime s ≤ T .

a) What is the probability that the player wins?

b) What value of s maximizes the probability of winning, and what is the probability in thiscase?

8

Page 11: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 3 BIRTH&DEATH- AND POISSON-PROCESSES, LITTLE’S RESULT

Solution:

Player bets on that during the time(s, T ) there is exactly one arrival (what happened during(0, s) hasno effect here). Letτ = T − s, when the number of arrivals obeys Poisson distribution with parametera = λτ . Here,0 ≤ τ ≤ T , i.e.0 ≤ a ≤ λT whereλT > 1.

a) pv = P{N(T ) − N(s) = 1} =a1

1!e−a = ae−a, wherea = λ(T − s).

b) Maximum can be found by taking the first derivate in relative toa:

d

dapv(a) = e−a − ae−a = (1 − a)e−a.

The derivate has clearly exactly one root,a = 1, which is also the maximum of the function (firststrictly increasing and then stricly decreasing function).

a = 1 ⇒ λ(T − s) = 1 ⇒ s = T − 1/λ,

which also lies inside the allowed interval. The maximum probability of winning is hence1/e.

3. It has been observed that in the interval(0, t) one arrival has occurred from a Poisson process,i.e. N(0, t) = 1. Prove that conditioned on this information, the arrival time τ is uniformlydistributed in (0, t). Hint: determine the conditional cumulative distribution function of thearrival time P{τ ≤ s | one arrival during (0, t)}.

Solution:

P{τ ≤ s|N(0, t) = 1} =P{τ ≤ s andN(0, t) = 1}

P{N(0, t) = 1} =P{N(0, s) = 1 andN(s, t) = 0}

P{N(0, t) = 1}

=

λs

1!e−λs · (λ(t − s))0

0!e−λ(t−s)

λt

1!e−λt

= s/t, Thus,τ ∼ Uniform(0, t).

4. Customers arrive at the system according to a Poisson process with the intensityλ. Each cus-tomer brings in a revenueY (independently of other customers), which is assumed be an integerwith the distribution pi = P{Y = i}, i = 1, 2, . . .. Let Xt denote the total revenue gainedduring the time interval (0, t).

a) Derive expressions forE [Xt] and V [Xt].

b) Deduce thatXt ∼ E1 + 2E2 + 3E3 + · · · , where theEi are independent random variableswith the distributions Ei ∼ Poisson(piλt).

Solution:

DenoteXt = total revenue on the interval(0, t),Nt = number of customers on the interval(0, t), Nt ∼ Poisson(λt).

(a) Clearly, the system revenue is a random sum

Xt = Y1 + . . . + YNt ,

9

Page 12: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

where theYi are i.i.d. random variables. Conditioning on the value ofNt we can apply the chainrules for expectation and variance:

E [Xt] = E [E [Xt|Nt]] = E[NtY

]= E [Nt] E [Y ] = λt E [Y ] .

Variance:

V [Xt] = V [E [Xt|Nt]] + E [V [Xt|Nt]] = V[NtY

]+ E [NtV [Y ]]

= V [Nt] E [Y ]2 + E [Nt] V [Y ] = λt(E [Y ]2 + V [Y ]

)= λt E

[Y 2].

t

t

t

λt

λt

λt

p1

2p

Figure 2: Random splitting of the Poisson process

(b) On the interval(0, t) the customers arrive according to the Poisson processNt. Random splitting1

of this process with probabilitiespi leads to new independent Poisson processesEi with therespective parameterspi · λt. The customers of "classi" brought in the revenuei. Thus,

Xt =∑

i

i · Ei.

5. Million ( 106) data packets per second arrive at a network from different sources. The lengthsof routes, defined by the source and destination addresses, vary considerably. The time a packetspends in the network depends on the length of the route, but also on the congestion of the net-work. The distribution of the time a packet spends in the network is assumed to have the follow-ing distribution: 1 ms (90 %), 10 ms (7 %), 100 ms (3 %). How many packets there are in thenetwork on average?

Solution:

transport delay proportion arrival intensity1ms 90% 0.9 · 106 /s

10ms 7% 0.07 · 106 /s100ms 3% 0.03 · 106 /s

So arrival intensity and average transport delay is known for for each traffic class. Next Little’s result,N = λT , can be applied:

N1 = 1 ms · 0.9 · 106 /s = 900,N2 = 10 ms · 0.07 · 106 /s = 700,N3 = 100 ms · 0.03 · 106 /s = 3000,

⇒ 4600.

1The process is first split into two processes with the probabilityp1 of which the latter is split again with the probabilityp2/X

i≥2

pi

etc.

10

Page 13: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 3 BIRTH&DEATH- AND POISSON-PROCESSES, LITTLE’S RESULT

6. The states of some irreducible Markov-process, which steady state probabilitiesπi are assumedto be known, can be partioned into two disjoint sets,A = {1, 2, . . . , n} and B = {n + 1, n +2, . . .}, so that the transition rates between the sets are non-zero only from staten to staten+1and the opposite direction, i.e.qn,n+1 = λ and qn+1,n = µ.

Using the Little’s result write down an equation for the average time it takes from the transitionn → n + 1 to the time the system returns back to setA (transition n + 1 → n), i.e. for theaverage time the system spends at setB.

Solution:

Define a new system to which a “customer” arriveswhen the original system moves from staten to staten + 1, i.e. a transitionA → B is interpreted as an ar-rival of a customer in a new system. Similarly, the tran-sition B → A in the original system is interpreted as adeparture of the customer in the new system.

n+1

A B

n

λ

µ

Little’s formula: N = λ′ · T , whereλ′ is the arrival rate of customers.

In the new system the average number of customers is clearly,

N = 1 · P{B} =∞∑

i=n+1

πi.

Similarly, the average sojourn timeT in the new system is the time from eventA → B to eventB → A,i.e. the quantity asked. The arrival intensity of the customers,λ′, is

λ′ = λπn.

Thus,

T =N

λ′ =∑∞

i=n+1 πi

λπn=

1 −∑ni=1 πi

λπn.

11

Page 14: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

EX 4: Loss Systems

1. Consider a car-inspection center where cars arrive at a rate of one every 50 seconds and waitfor an average of 15 minutes (inclusive of inspection time) to receive their inspections. After aninspection, 20 % of the car owners stay back an average of 10 minutes having their meals atthe center’s cafeteria. What is the average number of cars within the premises of the inspectioncenter (inclusive of the cafeteria)?

Solution:

Little’s theorem:N = λW .

The average time spent in the system isW = 15min + 0.2 · 10min = 17min, and thus,

N =1

50s· 17min =

65min

· 17min ≈ 20.4.

2. Consider a communications link with unbounded capacity. Att = 0 the link is empty andcalls start arriving according to Poisson process with the intensityλ. The call holding timesare assumed to be independent and exponentially distributed with the mean1/µ. Consider thenumber of on-going callsNt at the time instant t ≥ 0. Determine the distribution of Nt and,in particular, its mean as a function of time t. Hint: The number of on-going calls equals thenumber of arrivals between(0, t) from a certain inhomogeneous Poisson process, which can beobtained from the original Poisson process with a suitable random selection.

Solution:

1

2

p(x)

0 t

Figure 3: Random selection from a Poisson process.

The original process is a Poisson process with the intensityλ. We make a random selection of theoriginal process by selecting calls with the probability that they are still in the system at the timet. Inother words,

p(x) = P{call arriving at timex is still in the system at timet} = e−µ(t−x).

The resulting inhomogeneous Poisson process2 has the intensity

λ2(t) = λ p(x) = λe−µ(t−x).

According to the lecture notes, the number of arrivals on an interval(0, t) in an inhomogeneous Poissonprocess obeys the Poisson distribution with the parameter

a(t) =∫ t

0λe−µ(t−x)dx = λe−µt

t/0

eµx =λ

µe−µt

(eµt − 1

)=

λ

µ

(1 − e−µt

).

The mean of the distribution is the parameter itself, so the mean number of active calls at timet is givenby λ

µ

(1 − e−µt

), which has the limit valueλµ , as it should.

2arrival intesity is a deterministic function of time

12

Page 15: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 4 LOSS SYSTEMS

3. A mail order company has 3 persons serving incoming calls. The calls arrive according to aPoisson process with intensity of 1/min and the average call duration is 2 min.

a) What is the probability that an incoming call is blocked, when blocked calls are lost?

b) Is it profitable to hire a 4th person if the total expenses per person are 100€/h and theaverage revenue per order is 20€?

Solution:

The system is Erlang’s loss system with 3 or 4 servers (M/M/K/K-system, whereK = 3 or 4). Theoffered loada is a = λ · x = 1/min · 2 min = 2. Because we are considering a Poisson process, thecall blocking and time blocking are the same.

a) The probability of state3 (K = 3) can be obtained by calculating or by looking from a graphapproximately:

E(3, a) =a3/3!

1 + a/1! + a2/2! + a3/3!=

419

≈ 0.211

b) In this caseK = 4. The fourth person is useful when there are4 persons in service. Theprobability of system being in state4 is

E(4, a) =a4/4!

1 + a/1! + a2/2! + a3/3! + a4/4!=

221

≈ 0.095

The blocked traffic lowers, i.e. the served traffic grows, with amountλ · (E(3, a) − E(4, a)).Thus, the net change is

∆ = λ · (E(3, a) − E(4, a)) · 20 € − 100 €/h ≈ 38.3 €/h.

Hence, the4th person is worth hiring.

4. Use recursive Erlang’s blocking formula to calculateE(n, 6) for n = 0, . . . , 6.

Solution:

Recursive Erlang’s blocking formula: E(n, a) =a · E(n − 1, a)

n + a · E(n − 1, a), andE(0, a) = 1.

Applying the recursive formula gives:

E(0, 6) = 1, E(4, 6) = 6·36/614+6·36/61 = 54/115,

E(1, 6) = 61+6 = 6/7, E(5, 6) = 6·54/115

5+6·54/115 = 324/899,

E(2, 6) = 6·6/72+6·6/7 = 18/25, E(6, 6) = 6·324/899

6+6·324/899 = 324/1223.

E(3, 6) = 6·18/253+6·18/25 = 36/61,

5. Consider Erlang’s loss system withn servers, where the intensity of the offered traffic isa.

a) Show by direct calculations based on the steady state probabilities, that the mean number ofcustomers in the systemN is equal to(1−E(n, a))a. Explain this by using Little’s theorem.

b) By using Little’s theorem, deduce the mean time the system stays at stateN = n at a time.(Hint: How often the system moves to stateN = n? The mean number of customers ina given state is the same as steady state probability of the same state; the system either isin that particular state or not.) Deduce the same result directly from the properties of theexponential distribution.

13

Page 16: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

Solution:

a) For the steady state distribution of Erlang’s blocking system it holds that

πk =ak/k!∑nj=0 aj/j!

ForN one gets,

N =n∑

k=0

k · πk =n∑

k=0

k · ak/k!∑nj=0 aj/j!

=∑n

k=0 k · ak/k!∑nj=0 aj/j!

=∑n

k=1 ak/(k − 1)!∑nj=0 aj/j!

=∑n−1

k=0 ak+1/k!∑nj=0 aj/j!

=a∑n

k=0 ak/k! − an+1/n!∑nj=0 aj/j!

= a − a · an/n!∑nj=0 aj/j!

= a(1 − E(n, a)).

b) Define first a new stochastic processYt as follows. LetXt denote the state of the original system attime t and letYt denote the “occupancy” of staten:

Yt ={

1, whenXt = n,0, otherwise.

Then, a transition to staten in the original processXt corresponds to an “arrival” inYt, and similarly atransition away from staten corresponds to a depar-ture inYt. In the equilibrium the “arriving traffic” tostaten is λY = πn−1λ. On the hand, the average“occupancy” of processYt is

NY = 0 · (1 − πn) + 1 · πn = πn.

For this we can apply Little’s result:N = λW

ππ

λ

nn−1 µn

n−1 n

Figure 4: Transitions to and from state n.

πn = πn−1λ · WY

WY =πn

πn−1λ=

an/n!Pnj=0 aj/j!

an−1/n−1!Pnj=0 aj/j!

λ=

an/n!an−1/n − 1!

λ =a

nλ=

1nµ

.

On the other hand, the sojourn time in staten is exponentially distributed with parameternµ (nohigher states), and thus the mean sojourn time must be equal,WY = 1

nµ .

6. Consider 2 × 1- and 4 × 2-concentrators, where for each input port calls arrive according toindependent Poisson-processes with intensitiesγ. The mean call holding time is denoted by1/µand the offered load bya = γ/µ = 0.1. Compare in these two concentrators the probabilitiesthat a call arriving to a free input port gets blocked because all the output ports are busy.

Solution:

The system corresponds to an Engset’s system withn sources ands servers,0 ≤ s ≤ n. Let πj[n],j = 0, . . . , s, denote the steady state probabilities. Similarly, letπ∗

j [n], j = 0, . . . , s, denote the stateprobabilities seen by an arriving customer.

14

Page 17: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 4 LOSS SYSTEMS

Time blockingin Engset’s system is generally the same as the steady state probability of states,

πs[n] =

(n

s

)as

s∑k=0

(n

k

)ak

=

(n

s

)ps(1 − p)n−s

s∑k=0

(n

k

)pk(1 − p)n−k

, wherep =a

1 + a.

Similarly, for call blockingit holds that

π∗s [n] = πs[n − 1] =

(n − 1

s

)as

s∑k=0

(n − 1

k

)ak

.

Substitutingn ands to above gives (p ≈ 0.091)

n s time blocking call blocking2 1 16.7% 9.1%4 2 4.1% 2.3%

15

Page 18: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

EX 5: Queuing Systems

1. Assume that there is always one doctor at a clinic (24 hours a day) and that customers arriveaccording to a Poisson process with intensityλ. The service time of each customer obeys anexponential distribution with mean 30 minutes. Determine the maximum arrival intensity thatallows 95% of the customers to be served within 72 hours from (the first) arrival.

Solution:

For the M/M/1 queue, we know that (see lectures)

P{W > t} = ρ · e−(µ−λ)t,

which now yields the constraint

P{W > 72} = λ/2 · e−(2−λ)·72 ≤ 5/100

⇔ λe72λ ≤ e144/10.

The maximumλ is obtained from the corresponding equality which can be solved numerically (it maybe wise to take the logarithm on both sides of the equality first). The solution is

λmax ≈ 1.9587

2. Show that in an M/G/1-LIFO queue the equilibrium distribution of the queue length, πn =(1 − ρ)ρn, is insensitive to the holding time distribution. Hint: Reason that a customer whoupon arrival finds j − 1 customers in the system will be exclusively served when the system is instateN = j. Thus, the time the system spends in the stateN = j is completely composed of thefull service times of the customers who arrive to the system in the stateN = j − 1. How manysuch arrivals occur in a long interval of time T ?

Solution:

During a long time intervalT there is on averageλπj−1T arrivals to the statej . Because thosecustomers are only served when the system is in statej, the system remains in that state on average thetimeλπj−1TS, whereS is the average service time of one customer. That must be the sameTπj, andit follows that

Tπj = λπj−1TS ⇒ πj = ρπj−1,

which is the same as with the ordinary M/M/1-queue.

3. Consider an M/M/1/K queue with states0, 1, . . . , K. Find the probability Pn that the queuewhich initially is in the state n becomes empty before flowing over. Hint: Add an imaginary stateK + 1 to the system; a transition to the stateK + 1 corresponds to the queue flowing over. WehaveP0 = 1 and PK+1 = 0. For statesn = 1, . . . , K, write the probability Pn in terms ofPn−1 ja Pn+1. Solve the equations.

Solution:

Staten is followed by staten − 1 with probability µ/(λ + µ) and by staten + 1 with probabilityλ/(λ + µ). By the Markov property, conditioning on the next state yields

Pn =µ

λ + µPn−1 +

λ

λ + µPn+1 ⇔ λ(Pn − Pn+1) = µ(Pn−1 − Pn).

16

Page 19: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 5 QUEUING SYSTEMS

DefiningDn = Pn − Pn+1 allows writing this in the form

Dn−1 =λ

µDn = ρDn ⇒ DK−i = ρiDK .

On the other hand, we have

K−n∑i=0

DK−i = (PK − PK+1) + (PK−1 − PK) + . . . + (Pn+1 − Pn+2) + (Pn − Pn+1) = Pn − PK+1

= Pn = DK

K−n∑i=0

ρi,

which, when written forP0, allows determiningDK :

DK

K∑i=0

ρi = P0 = 1 ⇔ DK =

{1−ρ

1−ρK+1 , ρ 6= 11

K+1 , ρ = 1.

4. Customers arrive at a two-server system according to a Poisson process having rateλ = 5/min.An arrival finding server 1 free will begin service with that server. An arrival finding server 1busy and server 2 free will enter service with server 2. An arrival finding both servers busy goesaway. Once a customer is served by either server, he departs the system. The service times of theservers are exponential with ratesµ1 = 4/min and µ2 = 2/min. a) What is the average time anentering customer spends in the system? b) What proportion of time is server 2 busy?

Solution:

From the Fig. it can obtained the following equa-tions:

2(π2 + π3) = 5π1 (5.1)

4(π1 + π3) = 5(π0 + π2) (5.2)

2π2 + 4π1 = 5π0 (5.3)

1

1

22

1

2

µ

0

3

µ µλ

λ

µλ

Furthermore, the normalization condition,

π0 + π1 + π2 + π3 = 1 (5.4)

By combining (5.2) and (5.4) one gets3

4(π1 + π3) = 5(1 − (π1 + π3))π1 + π3 = 5/9 ⇒ π0 + π2 = 4/9.

Similarly from (5.1) gives,

2(π2 + π3) = 5π1

2 − 2(π0 + π1) = 5π1 ⇒ 2π0 + 7π1 = 2,

3Server 1 itself behaves like normal M/M/1/1 system.

17

Page 20: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

and from (5.1) and (5.4),

2π2 + 4π1 = 5π0

2(π0 + π2) + 4π1 = 7π0

8/9 + 4π1 = 7π0

16 + 72π1 = 126π0

16 + 72π1 = 126 − 441π1 ⇒ π1 =110513

.

From what it follows,

π0 =128513

, π2 =100513

and π3 =175513

.

a) The average time spent in system:

T =

128 + 100513

· 14

+110513

· 12

128 + 100513

+110513

=57 + 55

228 + 110=

112338

=56169

≈ 0.33.

b) The server 2 is reserved:

π2 + π3 =275513

≈ 0.536.

5. Customers arrive at anM/Erlang(k, µ)/1 system according to a Poisson process with rateλ.Find the mean waiting and sojourn times of a customer in the system?

Solution:

Erlang(k, µ)-distributed random variable is a sum ofk Exp(µ)-random variables. Thus,

E [X ] = k/µ,

V [X ] = k/µ2,

E[X2

]= V [X ] + E [X ]2 = k/µ2 + k2/µ2 = (k + k2)/µ.

In this case we have a M/G/1-queue so we can apply Pollaczek-Khinchin mean value formulas. Theoffered load isρ = λX = k λ

µ and thus the mean sojourn time is

T = x +λX2

2(1 − ρ)=

k

µ+

λk2+kµ2 µ

2(µ − kλ)=

k

µ

(1 +

12

λ(k + 1)µ − kλ

).

Similarly, the mean waiting time is

W =λX2

2(1 − ρ)=

λk2+kµ2 µ

2(µ − kλ)=

λk(k + 1)2µ(µ − kλ)

.

6. If in a single server system each customer has to pay a fee to the system according to some rule,then the average revenue rate of the system =λ · (average fee), where λ is the mean rate ofarriving customers.

Apply this to the M/G/1 system with the following charging rule: each customer in the systempays at rate which is the same as the customer’s remaining service time. What is the average fee?Show by equating the above average revenue rate with the average charging rate (time charging)that

W = λ (X W + X2/2),

whereW and X are the waiting and service times. SolveW . What is this result?

18

Page 21: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 5 QUEUING SYSTEMS

Solution:

Let, {W unfinished work in the queue when customer arrives, andU unfinished work in the queue at an arbitary moment.

We have a M/G/1 queue and the fee rate is equal to the remaining service time. The average fee is

X · W +12X2,

whereX and W are independent random variables (the fee rate during the waiting is equal to theservice time, and the fee rate drops linearly to zero when customer is under service) and thus theaverage revenue rate isλ(X · W + 1

2X2). On the other hand, this is the same as the virtual waitingtime, i.e. the waiting time of the customer if he would arrive to the system at the given moment of time.

It follows from the PASTA property that the real waiting timesW obey the same distribution, i.e.U ∼ W andU = W . Thus,

W = U = λ(X · W +12X2),

from which it can be deduced that

W (1 − λX) =λX2

2⇒ W =

λX2

2(1 − λX)=

λX2

2(1 − ρ),

which is P-K mean value formula.

19

Page 22: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

EX 6: Priority queues, queuing networks

1. Carloads of customers arrive at a single-server station in accordance with a Poisson process withrate 4 per hour. The service times are exponentially distributed with mean 3 min. If each carloadcontains either 1, 2, or 3 customers with respective probabilities1

4, 1

2, 1

4, compute the average

customer waiting time in the queue. Hint: The waiting time of the first customer of each groupcan be obtained from an appropriateM/G/1 queue. Consider separately the “internal” waitingtime in the group.

Solution:

Consider first the whole batch as one unit and later the waiting time inside batch can be added to it. Forthe whole batch one can apply M/G/1-queue model. It was given that

λ = 4/h = 1/15min, and 1/µ = 3min.

The service time of the batch is,

S = X1 + . . . + XN , whereN is 1, 2 or 3.

For the number of customers,N , in one group it holds that,

E [N ] = 1 · (1/4) + 2 · (1/2) + 3 · (1/4) = 2

V [N ] = E[(N − E [N ])2

]= 1 · (1/4) + 0 · (1/2) + 1 · (1/4) = 1/2.

from which, by using the conditioning rule (or tower property), one gets for the service timeS that,

E [S] = E [E [S|N ]] = E [N · 3min] = 6min,

V [S] = E [V [S|N ]] + V [E [S|N ]] = E[N · 9min2

]+ V [N · 3min]

= 18min2 +92min2 = 45/2min2

E[S2]

= V [S] + E [S]2 = 45/2min2 + 36min2 =1172

min2.

The average waiting time of batch can be obtained by using the Pollaczek-Khinchin formula,

E [Wg] =λE[S2]

2(1 − λE [S])=

115min

1172 min2

2(1 − 115min6min)

=1173065

min =134

min = 3min 15s.

In addition the customer sometimes have to wait within his batch. This is easiest to obtain by deter-mining the total waiting time inside one batch and then dividing that by the average size of the batch:

E [Wc] = (1/4 · 0 + 1/2 · 1 + 1/4 · 3) · 3min/2 = 15/8min = 1min 52.5s.

(Note. When batch size is 3, the average waiting time is(0 + 1 + 2) · 3min = 3 · 3min.)

By adding the waiting times together one gets the total average waiting time of customer, which is

E [W ] = E [Wg] + E [Wc] = 5min 7.5s.

2. Persons arrive at a copying machine according to a Poisson process with rate 1/min. The numberof copies to be made by each person is uniformly distributed between 1 and 10. Each copy takes3 s. Find the average waiting time in the queue when

a) Each person uses the machine on a first-come first-served basis.b) Persons with no more than 2 copies to make are given non-preemptive priority over other

persons.

20

Page 23: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 6 PRIORITY QUEUES, QUEUING NETWORKS

Solution:

a) We will apply the P-K formula. NowS = X · 3s, whereX is the number of copies needed. Wehave

E [S] = E [X] · 3s =10 + 1

23s =

332

s,

E[S2]

= E[X2] · 9s2 =

110

10∑i=1

i2 · 9s2 =77 · 9

2s2.

The load of the system is

ρ = λ · E [S] =160

· 332

=1140

,

and the average waiting time of a customer isW = R/(1 − ρ), whereR = λE[S2]/2 =

77 · 9/(2 · 2 · 60)s = 231/80s is the average amount of unfinished work (service time) in theserver. Thus,

W =23180

1 − 1140

s =23158

s≈ 3.98s.

b) Customers have two priority classes (m = 0, n = 2 andm = 2, n = 8):

λk E [Sk] ρk

class1 1300 s

92 3/200

class2 4300 s 3(2 + 9

2) = 392 156/600 = 13/50

In the prioritized system, the class-specific mean waiting times are

W 1 =R

1 − ρ1≈ 2.93s,

W 2 =R

(1 − ρ1)(1 − ρ1 − ρ2)= W1 · 1

1 − ρ1 − ρ2≈ 4.04s.

(R is the same as above; the order in which customers are served does not affect the averageresidual work.) The average waiting time is

W =λ1W 1 + λ2W 2

λ1 + λ2≈ 3.82s.

3. Consider a priority queue with two classes and preemptive resume priority. Customers arriveaccording to two independent Poisson processes with intensitiesλ1 and λ2. Service times in bothclasses are independent and exponentially distributed with a joint mean1/µ. Determine themean sojourn timesT1 and T2 for both classes.

Solution:

For preemptive priority queue it holds that (cf. lecture notes),

T 1 =(1 − ρ1)S1 + R1

1 − ρ1,

T 2 =(1 − ρ1 − ρ2)S2 + R2

(1 − ρ1)(1 − ρ1 − ρ2),

21

Page 24: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

whereRk = 12

∑ki=1 λi · S2

i . In this case,

S1 = S2 = 1/µ, ρ1 = λ1/µ,

S21 = S2

2 = 2/µ2, ρ2 = λ2/µ,

and thus,

R1 =12λ1 · 2/µ2 = λ1/µ

2,

R2 =12(λ1 · 2/µ2 + λ2 · 2/µ2

)= (λ1 + λ2)/µ2,

from what one obtains,

T 1 =(1 − λ1/µ)(1/µ) + λ1/µ

2

1 − λ1/µ=

µ − λ1 + λ1

µ2 − λ1µ=

1µ − λ1

,

T 2 =(1 − (λ1 + λ2)/µ)(1/µ) + (λ1 + λ2)/µ2

(1 − λ1/µ)(1 − (λ1 + λ2)/µ)=

µ − λ1 − λ2 + λ1 + λ2

(µ − λ1)(µ − λ1 − λ2)

(µ − λ1)(µ − λ1 − λ2).

Note thatT 1 is equal to the mean sojourn time in M/M/1-queue, as it should be.

4. The Pollaczek-Khinchin formula for the Laplace transform of the waiting time W is

W ∗(s) =s(1 − ρ)

s − λ + λS∗(s)

where S∗(s) is the Laplace transform of the service timeS and ρ = λS. Using this result,rederive the PK mean formula for the waiting time.

Solution:

The mean of random variableW is

W =[− d

dsW ∗(s)

]s=0

Similarly, for the service timeS it holds that

S =[− d

dsS∗(s)

]s=0

and S2 =[

d

ds2S∗(s)

]s=0

.

Taylor serie ofS∗(s) is

S∗(s) ≈ S∗(0)︸ ︷︷ ︸=1

+[

d

dsS∗(s)

]s=0︸ ︷︷ ︸

=−S

·s +12

[d

ds2S∗(s)

]s=0︸ ︷︷ ︸

=S2

·s2 = 1 − S · s +12S2 · s2

Thus,

W ∗(s) =s(1 − ρ)

s − λ + λS∗(s)=

s(1 − ρ)s − λ + λ(1 − S · s + 1

2S2 · s2)

=s(1 − ρ)

s(1 − ρ) + 12λS2 · s2

=1

1 + 12

λS2

1−ρ · s,

from which it follows that

W =[− d

dsW ∗(s)

]s=0

=12

λS2

1 − ρ.

22

Page 25: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 6 PRIORITY QUEUES, QUEUING NETWORKS

5. Queues 1 and 2 of the open Jackson queueing network depicted in the figure receive Poissonianarrival streams with rates 2 and 1 (customers/s). Service times are exponentially distributedwith the given rates (customers/s). Calculate a) customer streams through each of the queues, b)average occupancies of the queues and the average total number of customers in the network, c)mean delays in the network of customers arriving at queues 1 and 2 as well as the delay of anarriving customer chosen at random.

2

1/2

1/2

1

queue 2

queue 1

6

3

10

queue 3

Solution:

a) Let the traffic stream fed back to system bex customers per second. Then the traffic stream toserver 3 is2x, from which half goes out. The traffic flow in and out of the system must be equal.Hence,x = 3 and

λ1 = 2λ2 = 4λ3 = 6

ρ1 = 2/3ρ2 = 2/3ρ3 = 3/5

b) Jacksons theorem states that queues of the network behave like they were independent and theoffered traffic were Poissonian, i.e.

P{N = n} =∏

i

P{Ni = ni}, where P{Ni = ni} = (1 − ρi)ρnii .

In this problem, {P{N1 = i} = P{N2 = i} = 1

3 · (23

)i,

P{N3 = i} = 15 · (3

5

)i,

so the average number of customers in each server are{N1 = N2 = ρ1

1−ρ1= 2,

N3 = ρ3

1−ρ3= 3/2.

⇒ N = N1 + N2 + N3 = 11/2.

c) The average sojourn times in each network node is

T i =Ni

λi⇒

T 1 = 1T 2 = 1/2T 3 = 1/4

A customer arriving to the queuei sojourn time in the network isT i,d, for which it holds that

T i,d = T i +∑

j

qijT j,d,

whereqij is the probability that a customer leaving from queuei enters to queuej. DenoteT i,d = {a, b, c }. Then the set of linear equations can be written as

a = 1 + c

b = 12 + c

c = 14 + 1

2b

T 1,d = 2T 2,d = 3/2T 3,d = 1

23

Page 26: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen

Furthermore, a random customer stays in the network on average (Little’s result)

T = N/λ = 11/6.

6. Consider a cyclic closed network consisting of two queues. The service times in the queues areexponentially distributed with parameters µ1 and µ2. There are three customers circulating inthe network. a) Draw the state transition diagram of the network (four states). b) Determinethe equilibrium probabilities and calculate the mean queue lengths. c) Calculate the customerstream in the network (e.g. the customer stream departing from queue 1). d) Rederive the resultsof b) and c) by means of the mean value analysis (MVA).

Solution:

µ

µ1

µ

2 2µ

1

0,31,22,13,0

Figure 5: State diagram of the system.

a) State diagram of the system is depicted in Fig. 5.

b) In steady state it holds that

µ1π0 = µ2π1 π1 = ρπ0

µ1π1 = µ2π2 ⇒ π2 = ρ2π0

µ1π2 = µ2π3 π3 = ρ3π0

Normalization:

(1 + ρ + ρ2 + ρ3)π0 = 1 ⇒ π0 =1

1 + ρ + ρ2 + ρ3.

The average queue lengths are

N1 = (3 + 2ρ + ρ2)π0 =3 + 2ρ + ρ2

1 + ρ + ρ2 + ρ3

N2 = (3ρ3 + 2ρ2 + ρ)π0 =3ρ3 + 2ρ2 + ρ

1 + ρ + ρ2 + ρ3. (N1 + N2 = 3)

c) The traffic flow is

λ = (π0 + π1 + π2)µ1 =1 + ρ + ρ2

1 + ρ + ρ2 + ρ3µ1 =

1 − ρ3

1 − ρ

1 − ρ

1 − ρ4µ1 =

1 − ρ3

1 − ρ4µ1.

d) Mean value analysis (MVA):

Ti[k] = (1 + Ni[k − 1]) /µ1

Ni[k] = k λiTi[k]Pj λjTj [k]

λi[k] = Ni[k]/Ti[k]

Here,

N [0] = [0, 0]T [1] = 1/µ1 [1, ρ]

N [1] =[

11+ρ , ρ

1+ρ

] T [2] = 1/µ1

[2+ρ1+ρ , 1+2ρ

1+ρ ρ]

= 1µ1(1+ρ)

[2 + ρ, ρ + 2ρ2

]N [2] = 2

[2+ρ

2+2ρ+2ρ2 , ρ+2ρ2

2+2ρ+2ρ2

]=[

2+ρ1+ρ+ρ2 , ρ+2ρ2

1+ρ+ρ2

]

T [3] = 1/µ1

[1+ρ+ρ2+2+ρ

1+ρ+ρ2 , 1 + ρ + ρ2 + ρ + 2ρ21 + ρ + ρ2ρ]

= 1µ1(1+ρ+ρ2)

[3 + 2ρ + ρ2, ρ + 2ρ2 + 3ρ3

]N [3] = 3

[3+2ρ+ρ2

3+3ρ+3ρ2+3ρ3 , ρ+2ρ2+3ρ3

3+3ρ+3ρ2+3ρ3

]=

[3 + 2ρ + ρ2, ρ + 2ρ2 + 3ρ3

]π0

24

Page 27: S-38.3143 Queueing Theory - TKK · S-38.3143 Queueing Theory, II/2007 Virtamo / Penttinen Hence, measuring variances v 1, v 2 and v 3 is enough to determine covariances. 6. The length

Exercise 6

Similarly, the traffic flow becomes

λ = λ1[3] =3 + 2ρ + ρ2

1 + ρ + ρ2 + ρ3

µ1(1 + ρ + ρ2)3 + 2ρ + ρ2

=µ1(1 + ρ + ρ2)1 + ρ + ρ2 + ρ3

=1 − ρ3

1 − ρ4µ1.

25