# 7 - Exercises on Queueing Theory

October 8, 2017 | Author: Ramiro Herazo Salas | Category: Applied Mathematics, Statistical Theory, Probability Theory, Mathematics, Physics & Mathematics

#### Description

4 - Exercises on queueing theory Ing. Alfredo Todini Dipartimento INFOCOM Università di Roma “Sapienza”

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 1

Evaluate the Laplace transform of the function: f (t) = cos(ωt).

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 1 - Solution +jωt

−jωt

Writing cos(ωt) = e +e and applying the definition yields 2 the result:  Z ∞  +jωt e + e−jωt Lf (s) = e−st dt = 2 0 Z Z 1 ∞ (−s+jω)t 1 ∞ (−s−jω)t = e dt + e dt = 2 0 2 0 1 1 1 1 s = + = 2 . 2 s − jω 2 s + jω s + ω2

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 2

Give the queuing models for the following system. Define the arrival and service process, the number of servers, the size of the buffer and the service principle. List the relevant performance measures. Requests arrive to a Web server. The server can respond to M requests at a time. Responding to a request means transmitting a Web page of variable size. Requests that arrive when M requests are already under service must wait for their turn.

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 2 - Solution

Web server. Arrival process: requests from Internet users Service process: transmission of a Web page (page size/transmission rate) Number of servers: M Buffer size: infinite Service principle: FIFO Notation: M/G/m Performance measures: response time, server utilization

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 3

Show that the uniform distribution is not memoryless.

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 3 - Solution 1 Let X be a random variable with pX (x) = ∆ rect∆ (x − x0 ), ∆ = 5 and x0 = 7.5. We show that there is a t such that Pr {X < t + x|X > t} = 6 Pr {X < x}.   0 if x < 5   x −5 Pr {X < x} = if 5 ≤ x < 10    5 1 if x ≥ 10.

it suffices to take t = 7.5:   x Pr {X < 7.5 + x|X > 7.5} = 2.5 1 Ing. Alfredo Todini 4 - Exercises on queueing theory

if 0 ≤ x < 2.5 if x ≥ 2.5.

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 4

You are entering a bank, where there is one clerk and there are already three customers waiting. The service of one customer takes 10 minutes on average, with an exponential distribution. 1

Give the distribution of your waiting time.

2

What is your expected waiting time, the variance of the waiting time, and what is the probability that you have to wait more then 40 minutes? Prove your answers.

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 4 - Solution

1

Your waiting time will be the sum of the service times of 4 customers, one under service, 3 waiting. Each service time has an exponential distribution with parameter 1/10. Note that due to the memoryless property of the exponential distribution it does not matter when the service of the customer at the clerk has started, his remaining service time is still exponential with the same expected value.

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 4 - Solution 2

The average is the sum of the average service times. The variance is the sum of the variances of the service times, since they are independent. W = X1 + X2 + X3 + X4 fX (t) = λe−λt

E[X ] = 1/λ fW (t) = λ

E[W ] =

4 X i=1

Ing. Alfredo Todini 4 - Exercises on queueing theory

E[Xi ] = 40

Var [X ] = 1/λ2

λ = 1/10

(λt)3 −λt e 3!

Var [W ] =

4 X

Var [Xi ] = 400.

i=1

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 4 - Solution

Note that the sum of k independent, identically distributed exponential random variables has an Erlang distribution: (λx)k −1 −λx e f (x; k , λ) = λ (k − 1)!

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 4 - Solution The probability that you have to wait longer than 40 minutes is the probability, that there was no service completion, or only 1, 2 or 3 service completions during these 40 minutes. The sequence of services forms a Poisson process, and thus you can calculate the probabilities above. 3 X (λt)i −λt e Pr {W > 40} = = 0.433. i! i=0

t=40

Note that the departures from a sequence of exponential services form a Poisson process, only if the server is never idle, as in this case. Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 4 - Solution Alternatively, we can use the distribution of the waiting time: +∞

(λt)3 −λt e dt = (integrating by parts) 3! 40 +∞   (λt)3 (λt)2 −λt =− + + λt + 1 e = 3! 2! t=40 3 X (λt)i −λt = e = 0.433 i! Z

Pr {W > 40} =

λ

i=0

Ing. Alfredo Todini 4 - Exercises on queueing theory

t=40

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 5 Customers arrive to a restaurant according to a Poisson process with rate 10 customers/hour. The restaurant opens daily at 9:00 am. Find the following: 1

When the restaurant opens at 9:00 am, the workers need 30 min to arrange the tables and chairs. What is the probability that they will finish the arrangement before the arrival of a customer?

2

What is the probability that there are 15 customers in the restaurant at 1:00 pm, given that there were 12 customers in the restaurant at 12:50 pm?

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 5

3

Given that a new customer arrived at 9:13 am, what is the expected arrival time of the next customer?

4

If a customer arrive to restaurant at 2:00 pm what is the probability that the next one will arrive before 2:10 pm?

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 5 - Solution 1

Pr {workers finish the arrangement before the arrival of a customer} = Pr {No arrivals in 30 min} = = P0 (30/60) = e−10(0.5) = 0.006674 2

Pr {there are 15 customers in the restaurant at 1:00 | there were 12 customers in the restaurant at 12:50} = = Pr {exactly 3 customers arrived between 12:50 and 1:00} = = P3 (10/60) =

Ing. Alfredo Todini 4 - Exercises on queueing theory

(10/6)3 −10/6 e = 0.14574 3!

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 5 - Solution 3

E [arrival time of the next customer | a new customer arrived at 9:13 am] = 1 = 9:13 am + E[interarrival times] = 9:13 am + = λ 1 = 9:13 am + hr = 9:19 am 10 4

Pr {next customer will arrive before 2:10 pm | a new customer arrive at the restaurant at 2:00 pm} = = Pr {interarrival time < 10 min} = = 1 − e−10(10/60) = 0.811 Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 6 Calculate the state probabilities in steady-state for the following Markov-chain with the help of global or local balance equations (λ = 100 and µ = 150).

1

0 2μ

Ing. Alfredo Todini 4 - Exercises on queueing theory

λ

λ

λ

4

3

2 2μ

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 6 - Solution Just write local balance equations:  p0 λ = p1 2µ     p1 (λ + 2µ) = p2 2µ    p2 (λ + 2µ) = p0 λ + p3 2µ p3 2µ = p1 λ + p4 2µ      p 2µ = p2 λ   4 p0 + p1 + p2 + p3 + p4 = 1  ⇒

p = (p0 , p1 , p2 , p3 , p4 ) =

Ing. Alfredo Todini 4 - Exercises on queueing theory

27 9 12 7 4 , , , , 59 59 59 59 59

 .

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 7 Consider a queueing system with Poisson arrival process and exponential service time having the following rates: λ0 = λ

n=0

λn = λ/n

n = 1, 2, 3, 4

µn = µ

n = 0, 1, 2, 3, 4, 5

1

Draw the state diagram for this system.

2

Write the balance equations for each state.

3

Solve the balance equations to get the steady state distribution of the system pn .

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 7 - Solution λ

λ 1

0 μ

λ/2

μ

4

3

2 μ

λ/4

λ/3

μ

5 μ

2

n=0

λp0 = µp1

n=1

(λ + µ)p1 = λp0 + µp2

n=2

(λ/2 + µ)p2 = λp1 + µp3

n=3

(λ/3 + µ)p3 = (λ/2)p2 + µp4

n=4

(λ/4 + µ)p4 = (λ/3)p3 + µp5

n=5 Ing. Alfredo Todini 4 - Exercises on queueing theory

µp5 = (λ/4)p4 Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 7 - Solution 3

 p1 = (λ/µ)p0      p2 = (λ/µ)2 p0   p = (2!)−1 (λ/µ)3 p 3 0 −1 (λ/µ)4 p  p = (3!) 4 0     p5 = (4!)−1 (λ/µ)5 p0   P  5 i=0 pi = 1 "

λ ⇒ p0 = 1 + + µ

Ing. Alfredo Todini 4 - Exercises on queueing theory

 2       #−1 λ 1 λ 3 1 λ 4 1 λ 5 + + + µ 2! µ 3! µ 4! µ

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 8 You have designed a first-come first-service data processing system. You based the design on an M/M/1 queuing model. Now the users complain about poor response times. The log of the system shows that there are on average N = 19 jobs in the system and that the average processing time (service time) for one job is X = 2 seconds. 1

Estimate the system utilization, the job arrival intensity and the average waiting time, based on the M/M/1 model.

2

What is the probability that a job would wait more than twenty seconds?

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 8 - Solution

1

We have µ = 0.5/sec. Hence N=

2

ρ 1−ρ

ρ = 0.95, λ =

W =

ρ = 38sec. µ−λ

ρ = 0.475/sec X

On the other hand: Pr {W > 20sec} = ρe−(µ−λ)20 = 0.95e−0.5 = 0.5762.

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 9 Calls arrive to a call-center according to a Poisson process with intensity of 2 calls per minute. The call holding times are exponentially distributed with an average of 5 minutes. Calls that find all operators busy are blocked. 1

Give the Kendall notation of the system.

2

Consider a call that has lasted already 5 minutes. What is the probability that it lasts at least 5 minutes more?

3

How many operators are necessary to keep the blocking probability below 5%?

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 9 - Solution 1

M/M/m/m with λ = 2 call/min, µ = 1/5 call/min, ρ = 10.

2

We can write Pr {call on for another 5 minutes|already on for 5 minutes} = =Pr {call on for more than 5 minutes} =  1 =1 − 1 − e−5µ = . e

3

Using an Erlang table B(m, ρ) =

ρm ρm /m! p0 = Pm ρn ≤ 0.05 m! n=0

m = 15.

n!

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 10 Consider a gas station located on a highway with 5 pumps. Cars arrive to the gas station according to a Poisson process at rate 50 cars/hour. Any car able to enter the gas station stops by one of the available pumps. If all pumps are occupied, the driver will not enter the gas station. The gas station has three workers to service the cars. Each car takes an exponential amount of time for service with average of 5 minutes. The workers remember the order in which cars arrived so they service the cars on a first come first serviced basis. In the long run: 1

What is the probability that all workers are idle?

2

What is the probability that an arriving car will be able to enter the gas station?

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 10 3

What is the probability that a car will have to wait for a worker?

4

On average, how many cars will find all pumps occupied in one hour?

5

On average, how many cars will be in the station?

6

On average, how many cars waiting for service in the station?

7

Assume that a driver is in a hurry, so he will enter the gas station if and only if he will be serviced immediately. What is the probability that he will enter this gas station?

8

On average, how long a car will have to wait for service?

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 10 - Solution We can model the system as M/M/3/5 with µ = 60/5 = 12 car/hr. 1

Pr {all workers are idle} = p0 = 0.015173 2

Pr {an arriving car will be able to enter the gas station} = 1 − p5 = = 1 − 0.352882 = = 0.647118 3

Pr {car will have to wait for a worker} = p3 + p4 + p5 = = 0.1829 + 0.2541 + 0.3529 = 0.7899 Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 10 - Solution 4

E [number cars will find all pumps occupied in one hour] = λp5 = (50)(0.3529) = = 17.645 cars/hour 5

E [number of cars will be in the station] = N = = 3.656 cars 6

E [number of cars waiting for service] = Nq = = 0.96 cars Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 10 - Solution 7

Pr {driver will be serviced immediately} = p0 + p1 + p2 = = 1 − 0.7899 = 0.2101 8

Nq = λ(1 − p5 ) 0.96 = = 0.03 hours = 1.78 min 50(0.6472)

E [waiting time for service] = Wq =

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 11 Authorities at Ciampino Airport have established a new terminal for departure. It is estimated that passengers will arrive to the new terminal at rate 20 passenger per hour. Each passenger needs an average of 8 minutes for check-in. The authorities want to decide how many check-in counters should be opened. Assume that the arrival process is Poisson and the service time is exponential. Find: 1 The minimum number of counters so that the average queue length does not grow to ∞. 2 The minimum number of counters such that the average number of passengers in line is less than five. 3 The minimum number of counters such that the average time for check-in and receiving the boarding pass is less than 15 minutes. Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 11 - Solution We have µ = 60/8 = 7.5 passenger/hr. 1 We need λ < mµ for stability. m=1⇒

2

λ λ = 2.66 m = 2 ⇒ = 1.33 mµ mµ λ m=3⇒ = 0.889. mµ

Hence m ≥ 3. Using the formulas for M/M/m queue: m=3

N = 9.05

m=4

N = 3.42.

Hence m ≥ 4. Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 11 - Solution

3

Using the formulas for M/M/m queue: m=3

W = 0.45 hours = 27.1 min

m=4

W = 0.17 hours = 10.3 min.

Hence m ≥ 4.

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 12 Consider the M/G/1 queue with immediate feedback as shown. Arrivals come from a Poisson process at rate λ at point A. Immediately after a service time completion, the job tosses a coin to decide randomly with probability 1 − p to re-enter the queue for another service, or leaves the system altogether with probability p.

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 12

The individual service times have a general distribution with pdf etc. given as per our usual notation as b(t), B(t), LB (s) and mean X . Note that because of the immediate feedback, a particular job entering at A, may get served for one or more such service times before it finally leaves the system. Consider the system state (i. e. number in the system) at the imbedded time instants just after a job finally leaves the system. For these imbedded points, find p0 and the generating function Gn (z).

Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 12 - Solution Let q = 1 − p. We start evaluating the effective service time distribution Laplace-transform: LB ∗ (s) =

∞ X

pLB (s) [qLB (s)]k −1 =

k =1

pLB (s) , 1 − qLB (s)

with mean effective service time X∗

=

∞ X

pq k −1 k X =

k =1

pX X = p (1 − q)2

and effective traffic ρ∗ = λX ∗ = Ing. Alfredo Todini 4 - Exercises on queueing theory

λX ρ = . p p Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 12 - Solution Drawing an analogy with the basic M/G/1 queue, we can then write Gn (z) = p0

(1 − z)LB ∗ (λ − λz) LB ∗ (λ − λz) − z

Simplifying, we get "

λX Gn (z) = 1 − p

#

with p0 = 1 − ρ∗ .

p(1 − z)LB (λ − λz) , (p + qz)LB (λ − λz) − z

with p0 = 1 − Ing. Alfredo Todini 4 - Exercises on queueing theory

λX p−ρ = . p p Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 13

Consider arrivals coming in a random time interval (pdf b(t), cdf B(t) and Laplace-transform LB (s)) from a Poisson process with rate λ. We define Ak as the probability of there being k or more arrivals in such a time interval. Show analytically that Z Ak = 0

+∞

(λx)k −1 −λx e [1 − B(x)] λdx (k − 1)!

Ing. Alfredo Todini 4 - Exercises on queueing theory

k = 1, 2, · · · , +∞. (1)

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 13 - Solution Note that we can write: Ak = Pr {k or more arrivals in the time interval} Ak +1 = Pr {k + 1 or more arrivals in the time interval} ⇒

Ak = Ak +1 + Pr {k arrivals in the time interval} .

Hence ∞ (λx)k −λx e b(x)dx Ak = Ak +1 + k! 0 Z ∞ (λx)k −λx Ak +1 = Ak − e b(x)dx. k! 0

Z

(2)

We prove (1) by mathematical induction by first showing that it holds for k = 1 and then using the recursion of (2) to show that if it holds for k then it will also hold for k + 1. Ing. Alfredo Todini 4 - Exercises on queueing theory

Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 13 - Solution For k = 1 ∞ Z X A1 = j=1

0

Z

=1−

(λx)j −λx e b(x)dx = j!

∞

Z

 1 − e−λx b(x)dx =

0

e−λx b(x)dx.

0

Integrating by parts, we can show that Z Z e−λx b(x)dx = e−λx B(x) + λ e−λx B(x)dx,

(3)

and hence Z

e 0 Ing. Alfredo Todini 4 - Exercises on queueing theory

−λx

Z b(x)dx = λ

e−λx B(x)dx.

0 Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 13 - Solution Moreover

Z 1=λ

e−λx dx,

0

therefore

Z A1 =

e−λx [1 − B(x)] λdx,

0

as given by (1) for the case k = 1. Using the recursion of (2) and assuming (1) holds for k , we get the following for k + 1 Z

Ak +1 = λ 0

Ing. Alfredo Todini 4 - Exercises on queueing theory

Z ∞ (λx)k −1 −λx (λx)k −λx e [1 − B(x)] dx− e b(x)dx. (k − 1)! k! 0 (4) Dipartimento INFOCOM Università di Roma “Sapienza”

Exercise 13 - Solution Integrating by parts, we can show that ∞

(λx)k −1 −λx e [1 − B(x)] dx = (k − 1)! 0 Z ∞ (λx)k −λx = e [λ(1 − B(x)) + b(x)] dx. k! 0 Z

λ

(5)

Substituting (5) in (4), we get the desired result Z

Ak +1 = 0

Z

= 0 Ing. Alfredo Todini 4 - Exercises on queueing theory

(λx)k −λx e {[λ(1 − B(x)) + b(x)] − b(x)} dx = k! (λx)k −λx e λ [1 − B(x)] dx. k! Dipartimento INFOCOM Università di Roma “Sapienza”