Вы находитесь на странице: 1из 43

4 - Exercises on queueing theory

Ing. Alfredo Todini


Dipartimento INFOCOM
Universit di Roma Sapienza
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 1
Evaluate the Laplace transform of the function:
f (t ) = cos(t ).
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 1 - Solution
Writing cos(t ) =
e
+j t
+e
j t
2
and applying the denition yields
the result:
L
f
(s) =
_

0
_
e
+j t
+ e
j t
2
_
e
st
dt =
=
1
2
_

0
e
(s+j )t
dt +
1
2
_

0
e
(sj )t
dt =
=
1
2
1
s j
+
1
2
1
s + j
=
s
s
2
+
2
.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 2
Give the queuing models for the following system. Dene 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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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: innite
Service principle: FIFO
Notation: M/G/m
Performance measures: response time, server utilization
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 3
Show that the uniform distribution is not memoryless.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 3 - Solution
Let X be a random variable with p
X
(x) =
1

rect

(x x
0
),
= 5 and x
0
= 7.5. We show that there is a t such that
Pr {X < t + x|X > t } = Pr {X < x}.
Pr {X < x} =
_

_
0 if x < 5
x 5
5
if 5 x < 10
1 if x 10.
it sufces to take t = 7.5:
Pr {X < 7.5 + x|X > 7.5} =
_
_
_
x
2.5
if 0 x < 2.5
1 if x 2.5.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 = X
1
+ X
2
+ X
3
+ X
4
f
X
(t ) = e
t
E[X] = 1/ Var [X] = 1/
2
= 1/10
f
W
(t ) =
(t )
3
3!
e
t
E[W] =
4

i =1
E[X
i
] = 40 Var [W] =
4

i =1
Var [X
i
] = 400.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 4 - Solution
Note that the sum of k independent, identically distributed
exponential random variables has an Erlang distribution:
f (x; k, ) =
(x)
k1
(k 1)!
e
x
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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.
Pr {W > 40} =
3

i =0
(t )
i
i !
e
t

t =40
= 0.433.
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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 4 - Solution
Alternatively, we can use the distribution of the waiting time:
Pr {W > 40} =
_
+
40

(t )
3
3!
e
t
dt = (integrating by parts)
=
_
(t )
3
3!
+
(t )
2
2!
+t + 1
_
e
t

+
t =40
=
=
3

i =0
(t )
i
i !
e
t

t =40
= 0.433
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 nish 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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 5 - Solution
1
Pr {workers nish the arrangement before the arrival of a customer} = Pr {No arrivals in 30 min} =
= P
0
(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} =
= P
3
(10/60) =
(10/6)
3
3!
e
10/6
= 0.14574
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 5 - Solution
3
E [arrival time of the next customer | a new customer arrived at 9:13 am] =
= 9:13 am+ E[interarrival times] = 9:13 am+
1

=
= 9:13 am+
1
10
hr = 9:19 am
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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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).

2
2 2
0
1
2
3 4
2
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 6 - Solution
Just write local balance equations:
_

_
p
0
= p
1
2
p
1
( + 2) = p
2
2
p
2
( + 2) = p
0
+ p
3
2
p
3
2 = p
1
+ p
4
2
p
4
2 = p
2

p
0
+ p
1
+ p
2
+ p
3
+ p
4
= 1
p = (p
0
, p
1
, p
2
, p
3
, p
4
) =
_
27
59
,
9
59
,
12
59
,
7
59
,
4
59
_
.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 p
n
.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 7 - Solution
/2

0
1
2 3 4

5
/3 /4

2
n = 0 p
0
= p
1
n = 1 ( +)p
1
= p
0
+p
2
n = 2 (/2 +)p
2
= p
1
+p
3
n = 3 (/3 +)p
3
= (/2)p
2
+p
4
n = 4 (/4 +)p
4
= (/3)p
3
+p
5
n = 5 p
5
= (/4)p
4
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 7 - Solution
3
_

_
p
1
= (/)p
0
p
2
= (/)
2
p
0
p
3
= (2!)
1
(/)
3
p
0
p
4
= (3!)
1
(/)
4
p
0
p
5
= (4!)
1
(/)
5
p
0

5
i =0
p
i
= 1
p
0
=
_
1 +

+
_

_
2
+
1
2!
_

_
3
+
1
3!
_

_
4
+
1
4!
_

_
5
_
1
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 8
You have designed a rst-come rst-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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 8 - Solution
1 We have = 0.5/sec. Hence
N =

1
= 0.95, =

X
= 0.475/sec
W =


= 38sec.
2 On the other hand:
Pr {W > 20sec} = e
()20
= 0.95e
0.5
= 0.5762.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 nd 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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 e
5
_
=
1
e
.
3 Using an Erlang table
B(m, ) =

m
m!
p
0
=

m
/m!

m
n=0

n
n!
0.05 m = 15.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 rst come rst 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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 10
3 What is the probability that a car will have to wait for a
worker?
4 On average, how many cars will nd 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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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} = p
0
= 0.015173
2
Pr {an arriving car will be able to enter the gas station} = 1 p
5
=
= 1 0.352882 =
= 0.647118
3
Pr {car will have to wait for a worker} = p
3
+ p
4
+ p
5
=
= 0.1829 + 0.2541 + 0.3529 = 0.7899
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 10 - Solution
4
E [number cars will nd all pumps occupied in one hour] = p
5
= (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] = N
q
=
= 0.96 cars
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 10 - Solution
7
Pr {driver will be serviced immediately} = p
0
+ p
1
+ p
2
=
= 1 0.7899 = 0.2101
8
E [waiting time for service] = W
q
=
N
q
(1 p
5
)
=
=
0.96
50(0.6472)
= 0.03 hours = 1.78 min
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 ve.
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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 11 - Solution
We have = 60/8 = 7.5 passenger/hr.
1 We need < m for stability.
m = 1

m
= 2.66 m = 2

m
= 1.33
m = 3

m
= 0.889.
Hence m 3.
2 Using the formulas for M/M/m queue:
m = 3 N = 9.05
m = 4 N = 3.42.
Hence m 4.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 12
The individual service times have a general distribution with pdf
etc. given as per our usual notation as b(t ), B(t ), L
B
(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 nally leaves the system.
Consider the system state (i. e. number in the system) at
the imbedded time instants just after a job nally leaves the
system. For these imbedded points, nd p
0
and the
generating function G
n
(z).
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 12 - Solution
Let q = 1 p. We start evaluating the effective service time
distribution Laplace-transform:
L
B
(s) =

k=1
pL
B
(s) [qL
B
(s)]
k1
=
pL
B
(s)
1 qL
B
(s)
,
with mean effective service time
X

k=1
pq
k1
kX =
pX
(1 q)
2
=
X
p
and effective trafc

= X

=
X
p
=

p
.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 12 - Solution
Drawing an analogy with the basic M/G/1 queue, we can then
write
G
n
(z) = p
0
(1 z)L
B
( z)
L
B
( z) z
with p
0
= 1

.
Simplifying, we get
G
n
(z) =
_
1
X
p
_
p(1 z)L
B
( z)
(p + qz)L
B
( z) z
,
with
p
0
= 1
X
p
=
p
p
.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 13
Consider arrivals coming in a random time interval (pdf b(t ), cdf
B(t ) and Laplace-transform L
B
(s)) from a Poisson process with
rate . We dene A
k
as the probability of there being k or more
arrivals in such a time interval.
Show analytically that
A
k
=
_
+
0
(x)
k1
(k 1)!
e
x
[1 B(x)] dx k = 1, 2, , +.
(1)
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 13 - Solution
Note that we can write:
A
k
= Pr {k or more arrivals in the time interval}
A
k+1
= Pr {k + 1 or more arrivals in the time interval}
A
k
= A
k+1
+ Pr {k arrivals in the time interval} .
Hence
A
k
= A
k+1
+
_

0
(x)
k
k!
e
x
b(x)dx
A
k+1
= A
k

_

0
(x)
k
k!
e
x
b(x)dx. (2)
We prove (1) by mathematical induction by rst 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 Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 13 - Solution
For k = 1
A
1
=

j =1
_

0
(x)
j
j !
e
x
b(x)dx =
_

0
_
1 e
x
_
b(x)dx =
= 1
_

0
e
x
b(x)dx.
Integrating by parts, we can show that
_
e
x
b(x)dx = e
x
B(x) +
_
e
x
B(x)dx, (3)
and hence
_

0
e
x
b(x)dx =
_

0
e
x
B(x)dx.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 13 - Solution
Moreover
1 =
_

0
e
x
dx,
therefore
A
1
=
_

0
e
x
[1 B(x)] dx,
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
A
k+1
=
_

0
(x)
k1
(k 1)!
e
x
[1 B(x)] dx
_

0
(x)
k
k!
e
x
b(x)dx.
(4)
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory
Exercise 13 - Solution
Integrating by parts, we can show that

_

0
(x)
k1
(k 1)!
e
x
[1 B(x)] dx =
=
_

0
(x)
k
k!
e
x
[(1 B(x)) + b(x)] dx.
(5)
Substituting (5) in (4), we get the desired result
A
k+1
=
_

0
(x)
k
k!
e
x
{[(1 B(x)) + b(x)] b(x)} dx =
=
_

0
(x)
k
k!
e
x
[1 B(x)] dx.
Ing. Alfredo Todini Dipartimento INFOCOM Universit di Roma Sapienza
4 - Exercises on queueing theory

Вам также может понравиться