You are on page 1of 98

Politecnico di Torino

Network Modeling
Formulary
Fiandrino Claudio - Pievanelli Elisa
Academic Year 2010/2011
Contents
I Theory 5
1 Elementary Queueing Theory 6
1.1 Introduction and Basic Denitions . . . . . . . . . . . . . . . . . . . . . 6
1.1.1 Arrivals and Service . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.2 Scheduling Disciplines . . . . . . . . . . . . . . . . . . . . . . . . 11
1.1.3 Kendalls Notation . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.1.4 Graphical Representation of Queue . . . . . . . . . . . . . . . . . 12
1.1.5 Measurement of Eectiveness . . . . . . . . . . . . . . . . . . . . 13
1.1.6 Littles Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.2 Birth-Death Processes: The M/M/1 Queue . . . . . . . . . . . . . . . . 15
1.2.1 Description and Steady-State Solution . . . . . . . . . . . . . . . 15
1.2.2 Performance Measurement . . . . . . . . . . . . . . . . . . . . . . 17
1.3 Finite-Capacity System - The M/M/1/N Queue . . . . . . . . . . . . . . 19
1.4 Multiservers Systems - The M/M/c Queue . . . . . . . . . . . . . . . . . 21
1.5 Multiservers Systems - The M/M/c/0 Queue . . . . . . . . . . . . . . . 23
1.6 Multiservers Systems - The M/M/ Queue . . . . . . . . . . . . . . . . 25
1.7 Finite-Source Systems - The M/M/1/N-1/N Queue . . . . . . . . . . . . 26
1.8 Finite-Source Systems - The M/M/k/0/N Queue . . . . . . . . . . . . . 26
2 Queues with Phase-Type Laws 28
2.1 The Erlang-r Service Model - The M/E
r
/1 Queue . . . . . . . . . . . . 28
2.2 The Erlang-r Arrival Model - The E
r
/M/1 Queue . . . . . . . . . . . . 30
2.3 The M/H
2
/1 and H
2
/M/1 Queues . . . . . . . . . . . . . . . . . . . . . 32
3 The M/G/1 and the G/M/1 Queues 34
3.1 Introduction in the M/G/1 Queue . . . . . . . . . . . . . . . . . . . . . 34
3.2 Solving the M/G/1 Queue . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.3 Average in other type of queue . . . . . . . . . . . . . . . . . . . . . . . 38
4 Queueing Networks 39
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.1.1 Basic Denitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.1.2 The Departure Process - Burkes Theorem . . . . . . . . . . . . . 39
2
Politecnico di Torino Formulary ver. 1.1
4.1.3 Two M/M/1 Queues in Tandem . . . . . . . . . . . . . . . . . . 41
4.2 Open Queueing Networks . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.2.1 Feedforward Networks . . . . . . . . . . . . . . . . . . . . . . . . 41
4.2.2 Jackson Networks . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.3 Closed Queueing Networks . . . . . . . . . . . . . . . . . . . . . . . . . . 44
II Exercises 45
5 Preliminary Exercises 46
6 Exercises on Queues 51
7 Network queues exercises 70
8 Simulation of exams 73
III Appendix 92
A Formulas 93
B Integrals 96
C Series 98
3
Introduction
The formulary consists of a theorical part, exercises and formulas.
We have wrote it during the course Network modelling: theory and simulation
attended, for the rst time, in this year.
The rst part has been written by Pievanelli Elisa, while the exercises by Fiandrino
Claudio

Contact me from http://claudioandrino.altervista.org/ section contact & links.


4
Part I
Theory
5
Chapter 1
Elementary Queueing Theory
1.1 Introduction and Basic Denitions
The server(s) and the queue into which arriving customers are directed together con-
stitute the service facility or queueing system. Also, it frequently happens that both
the queue and the server are collectively referred to as a queue, such as the M/M/1
queue or the M/G/1 queue. One after the other, customers arrive to the service facil-
ity, eventually receive service and then depart. We make some assumptions about all
queueing systems we analyze:
If the server is free (not already serving a customer) an arriving customer goes
immediately into service. No time at all is spent in the queue.
If the server is busy, then the customer joins a queue of waiting customers and
stays in the queue until entering service.
When the server becomes free, a customer is chosen from the queue according to
a scheduling policy and immediately enters into service. The time between the
departure of one customer and the start of service of the next customer is zero.
Customers remain in the system until their service is complete and then they
depart. Customers do not become impatient and leave before they receive service.
1.1.1 Arrivals and Service
The length of a queue depends on the complete probabilistic description of the arrival
and service processes - the demand being placed on the resource - and of the capacity of
the resource to service these demands. Its evident that, if the average service demands
of arriving customers are greater than the system service capacity, the system will break
down since unbounded queues will form. On the other hand, if the average arrival rate
is less than the system service capacity, then we still get queues. Even when the average
arrival and service rates are held constant, an increase in the variation of arrivals or
service increases the congestion. Thus we use elementary probability theory to predict
6
Politecnico di Torino Formulary ver. 1.1
average waiting times, average queue length, distribution of queue length, etc., on the
basis of:
the arrival pattern of customers to the resource,
the service pattern of customers,
the scheduling algorithm in which the next customer to be served is chosen.
In some scenario, the space available to hold customers waiting for service, may be
limited. When the queue has reached its maximum capacity, so it is full; customers
who arrive to nd the queue full are lost.
The Arrival Process
The customer arrival process may be described in two ways:
1. By characterizing the number of arrivals per unit time (the arrival time);
2. By characterizing th time between successive arrivals (the interarrival time).
We use the variable to denote the mean arrival rate (1/ denotes the mean time
between arrivals). If the arrival pattern is not deterministic, the input process is a
stochastic process, which means that we need its associated probability distribution.
The probability distribution of the interarrival time of customers is denoted by A(t)
where
A(t) = P (time between arrivals t)
and
1

=
_

0
t dA(t)
where dA(t) is the probability that the interarrival time is between t and t + dt. We
assume that these interarrival times are independent and identically distributed (iid),
which means that only A(t) is of signicance. The manner in which the arrival pattern
changes in time may be important. An arrival pattern that does not change with time
is called homogeneous arrival process. If it is invariant to shifts in the time origin, it
is called stationary arrival process.
The Service Process
The service pattern may be describe by a rate, the number of customers served per
unit time, or by a time, the time required to serve a customer. The parameter is used
to denote the mean service rate (1/ denotes the mean service time). We use B(x) to
denote the probability distribution of the demand placed on the system
B(t) = P (Service time x)
7
Politecnico di Torino Formulary ver. 1.1
and
1

=
_

0
xdB(x)
where dB(x) is the probability that the service time is between x and x + dx. The
service time is equal to the length of time spent in service and does not include the
time spent waiting in the queue. Although it is usual to associate the service time
distribution with the server, the service time is actually the time that is request or
needed by customer who is taken into service. The service may be batch or single.
With batch service, several customers can be served simultaneously. Also, the service
rate may depend on the following factors:
1. Each server has its own queue.
2. There are fewer queues than server. Typically, there is a single queue for all
servers.
The servers may or may not be identically, B(x) may be dierent for dierent servers.
The capacity that a service facility has to hold waiting customers is often taken to be
innite.
Poisson Arrivals and Exponential Service
In stochastic modelling, numerous random variables are frequently modelled as expo-
nentials. These include:
interarrival time,
service time,
time to failure of a component,
time required to repair a component.
Recall that the cumulative distribution function for an exponential random variable,
X, with parameter > 0, is given by
F(x) =
_
1 e
x
x 0
0 otherwise
and its corresponding probability density function is
f(x) =
_
e
x
x 0
0 otherwise
Its mean and variance are given, respectively, by
E[X] =
1

Var [X] =
1

2
Reason for the use of exponential distribution include:
8
Politecnico di Torino Formulary ver. 1.1
1. its memoryless property and resulting analytical tractability,
2. its relationship to the Poisson process.
Denitions of Poisson process:
1. {t
i
} is a Poisson process if:
t
i+1
t
i
IID (interarrival times are independent and identically distributed),
t
i+1
t
i
e

(interarrival times are distributed as an exponential with


parameter )
2. A Poisson process {N(t), t 0} having a rate 0 is a counting process with
independent and stationary increments, with N(0)=0, and is such that the number
of events that occur in any time interval of length t has a Poisson distribution
with mean t. This means that
P (N(t +s) N(s) = n) = e
t
(t)
n
n!
n = 0, 1, 2, . . .
Thus a Poisson process is a continuous-parameter, discrete-state process.
3. Let N(t) be the number of events that occur in an interval (0,t]. When the
following four conditions are true, then {N(t), t 0} is a Poisson process:
(a) N(0)=0,
(b) Events that occur in nonoverlapping time intervals are mutually indepen-
dent,
(c) The number of event that occur in any interval depends only on the length
of the interval and not on the past history of the system,
(d) For suciently small h and some positive constant , we have
P (One event in(t, t +h]) = h +o(h)
P (Zero events in(t, t +h]) = 1 h +o(h)
P (More Than one event in(t, t +h]) = o(h)
where o(h) (little o h) is any quantity that tends to zero faster than h
lim
h0
o(h)
h
= 0
These denitions of the Poisson process are equivalent. The number of arrivals, N(t),
in the interval (0,t] has a Poisson distribution with parameter t. To compute the mean
number of arrivals in an interval of length t, we proceed as follows:
E[N(t)] =

k=1
k p
k
(t) =

k=1
k e
t
(t)
k
k!
= t
_

k=1
(
(t)
k1
(k 1)!
_
e
t
=
= t
_

k=1
(t)
k
k!
_
e
t
= t
9
Politecnico di Torino Formulary ver. 1.1
Poisson Process Have Exponential Interarrival Times
If the arrival process is a Poisson process, then the associated random variable de-
ned as the time between successive arrivals (the intearrival time) has an exponential
distribution. The arrival process is Poisson:
p
n
(t) = e
t
(t)
n
n!
, n = 0, 1, 2, . . .
Which describes the number of arrivals that have occurred by time t. Let X be the
random variable that denotes the time between successive arrivals. Its probability
distribution function is given by
A(t) = P (X t) = 1 P (X > t)
But P (X > t) = P (0 arrivals in (0, t]) = p
0
(t). Thus
A(t) = 1 p
0
(t) = 1 e
t
t 0
with corresponding density function
a(t) = e
t
t 0
This denes the exponential distribution. Thus X is exponentially distributed with
mean 1/ and, consequently, for a Poisson arrival process, the time between arrivals is
exponentially distributed.
Superposition and Decomposition of Poisson Process
When two or more independent Poisson streams merge, the resulting stream is also
a Poisson stream. It follows then that multiple processes to a single service center
can be merged to a single arrival process whose interarrival times are exponentially
distributed. If the i-th stream, i = 1, 2, ..., n, has parameter
i
, then the parameter for
the merged stream is given by
=
n

i=1

i
A single Poisson stream may be decomposed into multiple independent Poisson streams
if the decomposition is such that customers are directed into substreams i, i=1,2,...,n
with probability p
i
and
n

i=1
p
i
= 1
10
Politecnico di Torino Formulary ver. 1.1
PASTA (Poisson Arrivals See Time Average)
An important property of the Poisson arrival process is that the distribution of cus-
tomers seen by an arrival to a queueing system is, stochastically, the same as the limiting
distribution of customers at the system. Once the queueing system has reached the
steady state, each arrival from a Poisson process nds the system at equilibrium. If p
n
is the probability that the system contains n customers at equilibrium and a
n
is the
probability that an arriving customer nds n customers already present, then PASTA
says that p
n
= a
n
.

(i)
a
= lim
t0
P (N(t) = i | one arrival in(t, t + t))
= lim
t0
P (N(t) = i, one arrival in(t, t + t))
P (one arrival in(t, t + t))
= lim
t0
P (one arrival in(t, t + t) | N(t) = i)
P (one arrival in(t, t + t))

P (N(t) = i)
P (one arrival in(t, t + t))
=
P (one arrival in(t, t + t)) P (N(t) = i)
P (one arrival in(t, t + t))
= P (N(t) = i) =
(i)
This result is a consequence of the memoryless property if the interarrival time distri-
bution of customers to queueing system fed by Poisson process: it does not depend on
the service time distribution. The PASTA property does not hold for arrival processes
dierent from Poisson.
1.1.2 Scheduling Disciplines
The scheduling policy, or discipline, is the manner in which the customers are selected
from the queue and taken into service. We assume that the time it takes to select a
customer and to enter that into service is zero. We have two type of policies:
Preemptive policies: it is used when there are dierent types of customer (high
priority and low priority). When a high priority customer enters the queue and
nds a lower priority customer in service, the service of the lower priority customer
is interrupted and later resumed.
Nonpreemptive system: in this case the server will commence the service of lower
priority customer if there are no higher priority customers in the queue. Several
scheduling disciplines exist:
FCFS (First Come First Served), also called FIFO (First In First Out). In
this case it is selected the rst customer at the head of the queue to be the
rst served.
LCFS (Last Come First Served) is the opposite of FCFS. The last customer
to arrive is the one next chosen to be served.
11
Politecnico di Torino Formulary ver. 1.1
LCFS-PR (Last Come First Served-Preempt Resume)
SIRO (Service In Random Order). The next customer to be served is chosen
at random among all those waiting.
RR (Round Robin). In this scheduling discipline, the duration of service
provided each time a customer begins service is limited to a xed amount
(time slice). If a customer completes its service at any point during the time
slice, it immediately departs from the service center and the customer at the
head of the queue begins to be served. If, after the time slice has nished,
a customer has still not completed its service requirement, that customer is
reinserted back into the end of the queue to await its turn.
PS (Processor Sharing), it is a limiting case of RR in whiche the time slice
goes to zero.
IS (Innite Server). In this case the server has the ability to serve all cus-
tomers simultaneously.
PRIO (Priority scheduling). The customer chosen from the queue is the one
with the highest priority.
1.1.3 Kendalls Notation
Kendalls notation is used to characterize queueing systems. It is given by A/B/C/X/Y/Z
where
A indicates the interarrival time distribution
B indicates the service time distribution
C indicates number of servers
X indicates the system capacity
Y indicates the size of the customer population
Z indicates the queue scheduling discipline
Some possible distribution for interarrival and service time are: M for Markovian, E for
Erlang, G for General and D for Deterministic. The number of servers is often taken
to be 1. This rst three parameters are always provided. The letters that specify the
system capacity, customer population and scheduling discipline may be omitted with
the understanding that the default values for capacity and population size is innite
and the default scheduling discipline is FCFS.
1.1.4 Graphical Representation of Queue
There are several ways to graph a queueing system, but we will see only one. for a
FCFS, single server queue. one possibility is shown in the gure 1.1.
12
Politecnico di Torino Formulary ver. 1.1
Time
N. customers
1
2
3
4

1

2

3

4

5

6
t
2
t
3
t
4
t
5
t
6
w
2
x
1
x
2
x
3
x
4
x
5
x
6
Figure 1.1: Representation of a queue
Let we denote with C
n
the n
th
customer that enters in the queue. Let we denote
with
n
the time at which C
n
arrives in the system and t
n
the arrival time between
the arrival of C
n1
and C
n
. We assume that the t
n
are drawn from a distribution
such that P (t
n
x) = A(t), independent of n, where A(t) is completely arbitrary
interarrival time distribution. Equally, we can dene x
n
to be the service time for C
n
and P (x
n
x) = B(x), where B(x) is a completely arbitrary service time distribution.
In the gure we have plotted N(t), the number of customers in the system at time t;
and w
n
represents the waiting time for C
n
and s
n
represent the system time for C
n
.
Moreover, we can say that:
. t
n
are interarrival times;
. x
n
are interdeparture times.
1.1.5 Measurement of Eectiveness
We analyze a queueing system with the purpose of obtaining the values of certain system
properties; for example: the number of customers in the system, the waiting time of a
customer, the length of a busy or idle period, the current work backload, etc.. These
are called measurement of eectiveness. All these values are random variables and we
have to know their complete probabilistic descriptions, but sometimes we are satised
to be able to derive just mean and variance. We now consider the most commonly
obtained measures of eectiveness:
Number of customers: let N the random variable that describes the number
of customers in the system at steady state. The probability that at steady state
13
Politecnico di Torino Formulary ver. 1.1
the number of customer present in the system is n is denote by p
n
,
p
n
= P (N = n)
and the average number in the system at steady state is
E[N] =

i=0
n p
n
Let N
q
be the random variable that describes the number of customers waiting
in the queue and we denote its mean by E[N
q
].
System time and queueing time: the time that a customer spend in the
system, from the instant of its arrival to the queue to the instant of its departure
from the server, is called the response time. This is a random variable and we
denote it by R and its mean value is E[R]. The response time is composed of the
time that the customer spends waiting in the queue, called waiting time, plus the
time the customer spends receiving service, called service time. Let W
q
be the
random variable that describes the time spends by the customer waiting in the
queue and its mean is E[W
q
].
System utilization: in a queueing system with a single server, the utilization
U is dened as the fraction of time that the server is busy. If the rate at which
customers arrive in the queueing system is and if is the rate at which these
customers are served, then the utilization is equal to =

(where is identied
with the utilization). In the case of queueing system with multiple servers, the
utilization is dened as the average fraction of server that are active U =

c
.
System throughput: The throughput of a queueing system is equal to its
departure rate, the average number of customers that are processed per unit
time. It is denote by X. In a queueing system in which customers that arrive
are eventually served and leave the system, the throughput is equal to the arrival
rate .
Trac intensity: we dene the trac intensity as the rate at which work enters
the system, so it is given as the product of the average arrival rate of customers
and the service time: x =

, where x =
1

and is the mean service rate. In a


queueing system with a single server the trac intensity is equal to the utilization.
For multiple servers, the trac intensity is equal to cU.
1.1.6 Littles Theorem
Littles theorem equates the number of customers in a system to the product of the
eective arrival rate and the time spend in the system. We assume that
E[N] = lim
T
1
T
_

0
N(t) dt
14
Politecnico di Torino Formulary ver. 1.1
E[D] = lim
N

N
i=1
D
i
N
and the Littles theorem says:
E[N] = E[] E[D]
This says that the number of customers in the system is equal to the average arrival
rate of customers in the system multiplied by the average system time per customer.
Littles theorem can be applied individually to the dierent parts of a queueing system,
the queue and the server.
1.2 Birth-Death Processes: The M/M/1 Queue
Birth-Death processes are continuous-time Markov chains with a special structure. If
the states of the Markov chain are indexed by integer 0,1,2,.. , then transitions are
permitted only from state i > 0 to its nearest neighbors state i 1 and i + 1.For the
state i = 0 the Markov chain must enter state 1. These processes are called skip-free
processes because to go from any state i to any other state j, each intermediate state
must be visited. An arrival to the queueing system results in one additional unit in
the system, and is dened with a birth, whereas a departure removes a unit from the
system as is referred to as a death. The simplest of all queeuing system is the M/M/1
queue. This is a single server queue with FCFS scheduling discipline, an arrival process
that is Poisson and service time that is exponentially distributed.
1.2.1 Description and Steady-State Solution
At any time t, the state of an M/M/1 queue is completely characterized by specifying
the number of customers present. The state are denote with an integer number, n
denotes the state in which there are n customers in the system, including the one in
service. We want to know the state probabilities, the probability that the system is in
any given state n at any time t.
p
n
(t) = P (n in the sistem at time t)
This is a dicult task; so we look to the steady-state probabilities

n
= lim
t
p
n
(t)
If this limit exists, then the probability of nding the system in any particular state
eventually becomes independent of the starting state. This probability p
n
can be in-
terpreted as the probability of nding n customers in the system at an arbitrary point
in time after the process has reached steady state. Not all systems reach the steady
state, for some queueing systems it is impossible that lim
t
p
n
(t) may not yield a true
probability distribution. This system is a Markov chain so we can draw the diagram
15
Politecnico di Torino Formulary ver. 1.1
0 1 2
n n + 1

Figure 1.2: State transition diagram of an M/M/1 queue


transition state (gure 1.2):
The arrivals are distributed as an exponential with parameter and the service times
are exponentially distributed with parameter . The steady state equation are:
State 0 :
0
=
1
State 1 : ( +)
1
=
0
+
2
State n : ( +)
n
=
n1
+
n+1
n 1
If we sum the rst two equations we obtain:
1
=
2
. If we substitute this result
in one of the rst two equations we can nd the value of
1
or
2
. If we repeat this
procedure for all the state of the system well nd:

n
=
n+1
n 0

n+1
=

n
n 0
To nd the value of
0
we proceed as follows:

1
=

2
=

1
=
_

_
2

n
=
_

_
n

0
If we impose =

, we nd

n
=
n

0
Now we need to know if the M/M/1 system is ergodic.
A Markov chain is ergodic if:
=

< 1

0
= 1

n
= (1 )
n
n > 0
16
Politecnico di Torino Formulary ver. 1.1
At this point, we impose

i=0

i
= 1
This implies

i=0

i
= 1

0
=
1

i=0

i
with

i=0

i
<
1.2.2 Performance Measurement
Mean Number in System
Let N be the random variable that describes the number of customers in the system at
steady state and let E[N] be the mean number of customers in the M/M/1 queue.
E[N] =

n=0
n
n
=

n=0
n(1 )
n
For n = 0, the product is zero then we can start the sum from n = 1
E[N] = (1 )

n=1
n
n
= (1 )

n=1
n
n1
Since n
n1
can be written as n
n1
=
d
n
d
E[N] = (1 )

n=1
d
d

n
= (1 )
d
d
_

n=1

n
_
We know that

n=1

n
=

n=0

n
1 =
1
1
1 =

1
so we can write
E[N] = (1 )
d
d
_

1
_
=

1
( < 1)
17
Politecnico di Torino Formulary ver. 1.1
Variance of Number in System
To compute the variance of the number of customers in an M/M/1 queue, we use the
formula
Var [N] = E
_
N
2

E[N]
2
The second moment is
E
_
N
2

n=0
n
2

n
=

n=0
n
2
(1 )
n
= (1 )

n=0
n
2

n
= (1 )

n=0
n
2

n1
= (1 )
d
d
_

n=0
n
n
_
= (1 )
d
d
_

(1 )
2
_
= (1 )
(1 )
2
+ 2(1 )
(1 )
4
=

(1 )
2
In this way we can write the variance as follows
Var [N] =

(1 )
2

_

1
_
2
=

(1 )
2
Delay - Mean of Waiting in the Queue
If the mean service time is 1/ and the mean waiting time is n/ we can write the
mean of waiting in the queueing system as
E[W | find 0 customer] =
1

E[W | find 1 customer] =


2

E[W | find n customers] =


n + 1

=
_
1

+
n

_
In this way we can compute the mean of waiting in the queueing system
E[W] =

n=0
E[W | n] P (finding n customers) =

n=0
n + 1


(n)
a
Applying PASTA we obtain
E[W] =

n=0
n + 1


n
=

n=0
n + 1

(1 )
n
=
1/
1
Throughput, Utilization and Trac Intensity
The throughput of the M/M/1 queue is equal to the arrival rate, X = . The utilization
in equal to the trac intensity and is given by:
U =

18
Politecnico di Torino Formulary ver. 1.1
1.3 Finite-Capacity System - The M/M/1/N Queue
In an M/M/1/N queue customers arrive according to a Poisson process at rate and
receive service that is exponentially distributed with a mean service time of 1/ from
a single server. The dierence from the M/M/1 queue is that at most N customers
are allowed into the system. A customer that arrives and nd the system full it is
discarded, and then lost. To analyze the M/M/1/N queue, we use a birth-death model
and choose the parameter so that the Poisson arrivals stop as soon as N customers
are present. Figure 1.3 shows the system. The parameters of the exponential service
distribution are unchanged. Then

n
=
_
n < N
0 n N

n
= for n = 1 , 2 , , N
We can now write the ow balance equations:
0 1 2 N 2 N 1 N

Figure 1.3: State transition diagram of an M/M/1/N queue

0
=
1

1
=
2

i
=
i+1
i N

i
=
i

0
=

The system is ergodic so we impose


N

i=0

i
= 1
therefore by substituting
i
=
i

0
N

i=0

0
= 1

0
=
1

N
i=0

i
19
Politecnico di Torino Formulary ver. 1.1
Recall that
N

i=0

i
=
1
N+1
1
We can write:

0
=
1
1
N+1
And then we can obtain the value of
i

i
=
i

1
1
N+1
i N + 1
Now we try to nd some important parameter of this type of queue:
- The loss probability is P
loss
=
(N+1)
a
In this case we can apply PASTA, because the arrival process is Poisson, and
well nd:
P
loss
=
(N+1)
a
=
N+1
=

N+1
(1 )
1
N+2
For < 1 and N the loss probability tends to 0 while, considering > 1
and N the loss probability is:
P
loss
=
1

N+2

N+1

1

N+1
=
1

1
1

- The throughput is the number of customers that arrive in a unit of time; in this
case the formula for the throughput in input is:
T
in
=

= (1 P
loss
) = (1
N+1
)
and the formula for the throughput in output is:
T
out
=

= (1
0
) =
_
1
1
1
N+2
_
If < and N :

<
If > and N :

=
If N = 0
T
out
=
_
1
1
1
2
_
=
_

2
+
1
2
_
=
1
(1 +)(1 )
=

1 +
=

1 +
20
Politecnico di Torino Formulary ver. 1.1
- Delay: for the calculation of the delay we use the Littles Theorem
E[N] = E[] E[D]
E[D] =
E[N]
(1 +
N+1
)
E[N] =
N+1

i=0
i
i
=
[1 (N + 2)
N+1
+ (N + 1)
N+2
]
1
2

1
1
N+2
E[D] =
[1 (N + 2)
N+1
+ (N + 1)
N+2
]
(1 )(1
N+2
)

_
1

N+1
(1 )
1
N+2
_
If < 1 and N :
E[D] =

(1 )
=
1/
1
If N = 0:
E[D] =
1

1.4 Multiservers Systems - The M/M/c Queue


The M/M/c queue consists of c identical servers. In this queue customers arrive ac-
cording to a Poisson process with rate
n
= for all n and are served in st-come
rst-served order by any available server. Each of the c servers provides independent
and identically distributed exponential service rate . When the number of customers
is greater or equal to c, n c, then all the servers are busy and the eective service
rate is equal to c. If the number of customer is less than c, then only n out of c servers
are busy and the eective service rate is equal to n. The term load dependent service
center is used to designate a service center in which the customers departure rate is a
function of the number of customers present. With c identical servers, each providing
service at rate , and a total of n customers present, the load dependent service rate
is equal to
(n) = min{n, c}
The state transition diagram of an M/M/c queue is represented in gure 1.4. It
follows that the arrival rate and the service rate to dene the M/M/c queue are given
by

n
= n

n
=
_
n 1 n c
c n c
21
Politecnico di Torino Formulary ver. 1.1
0 1
c 2 c 1 c c + 1

(c 1)

c
Figure 1.4: State transition diagram of an M/M/c queue
The condition for ergodicity is < c.
The ow balance equation are:

0
=
1

1
= 2
2
For a generic i we obtain:

i
= (i + 1)
i+1
i < c

i
= c
i+1
i c
And from these equations we nd:
1. for i < c

i+1
=

(i + 1)

i
=
_

i
_

_

(i 1)
_

_

(i 2)
_
. . .
_


0
_

i
=
_

_
i
1
i!

0
2. for i c

i+1
=

c

i
=
_

c
_

_

c
_

_

c
_
. . .
c

i
=
_

c
_
ic

c
The system is ergodic only when

i=0

i
<
22
Politecnico di Torino Formulary ver. 1.1
Since this is an ergodic sum with radix /c, the ergodic condition is

c
< 1
If we normalize by requiring

i=o

i
= 1
we obtain:
c

i=0
1
i!
_

_
i

0
+

i=c+1
_

c
_
ic
1
c!
_

_
c

0
= 1

0
=
1

c
i=0
1
i!
_

_
i
+

i=c+1
_

c
_
ic
1
c!
_

_
c
=
1

c
i=0
1
i!
_

_
i
+
1
c!
_

_
c
/c
1 /c
From this formula we can nd information on the delay:
E[N] =

i=0
i
i
E[D] =
E[N]

1.5 Multiservers Systems - The M/M/c/0 Queue


This kind of queue is characterized by the fact of not having the waiting line. It is still
a Markov chain because it has both the arrival process, that is Poisson, and the service
time distributed as an exponential.
This is the state transition diagram of an M/M/c /0 queue (gure 1.5).
0 1 2
c 2 c 1 c

(c 1)

c
Figure 1.5: State transition diagram of an M/M/c/0 queue
This system is an irreducible Markov chain.
23
Politecnico di Torino Formulary ver. 1.1
Now we write the ow balance equation:

0
=
1

1
= 2
2

i
= (i + 1)
i+1
i c 1

i+1
=

(i + 1)

i
i c 1

i
=
1
i!
_

_
i

0
If we impose

i=0

i
= 1
we can nd
0
as follows
c

i=0
1
i!
_

_
i

0
= 1

0
=
1

c
i=0
1
i!
_

_
i

i
=
1
i!
_

_
i

c
j=0
1
j!
_

_
j
For the loss probability, that is the fraction of customer that are loss over the customers
that arrived, we can consider that we have a loss when a customer arrives and nd c
customers already in service. In this way we can dene the loss probability as:
P
loss
=
c
=
1
c!
_

_
c

c
j=0
1
j!
_

_
j
= B(, c)
Where B(, c) is the Erlang B formula. This formula is valid for the system M/G/c/0
and for this system the loss probability is:
P
loss
=
1
c!
( E[S])
c

c
i=0
1
j!
( E[S])
j
The delay of an M/G/c/0 is
E[D] =

1
24
Politecnico di Torino Formulary ver. 1.1
1.6 Multiservers Systems - The M/M/ Queue
This is an innite server queue and the arrival and service rates are:

n
= n (1.1)

n
= n n (1.2)
Since no customer will evere wait in an M/M/ queue, the mean time spent in the
system must be equal to the mean service time 1/ and so the mean number of cus-
tomers present must be equal to times this, /.
This is the state transition diagram of an M/M/c queue (gure 1.6).
0 1 2 n 1 n n + 1

(n + 1)
Figure 1.6: State transition diagram of an M/M/ queue
The ow balance equations are:

n
= (n + 1)
n+1

N+1
=

(n + 1)

n
=
1
n!
_

_
n

0
We impose that

n=0

n
= 1
obtaining

n=0
1
n!
_

_
n
= 1

0
e

= 1

0
= e

The average delay and the average number of customers are:


E[D] =
1

E[N] =

=
25
Politecnico di Torino Formulary ver. 1.1
1.7 Finite-Source Systems - The M/M/1/N-1/N Queue
In this type of queue there is a total of N customers and a customers is either in the
system, or else outside the system and is in an idle state. When a customer is in the
idle condition, then the time it takes for that particular customer to arrive is a random
variable with exponential distribution whose means is 1/. This is the mean time spent
per customer in the idle condition. All customers act indipendently of each other so
that if there are k customers in the idle condition, the total average arrival rate is k.
The arrival process in this case is not a Poisson process and we cannot apply PASTA.
The ow balance equations are:
N
0
=
1
(N i)
i
=
i+1
0 i N 1
From these equation we can nd the relationship between
i
and
0

i+1
=
(N i)

i
=
(N i + 1)

(N i + 2)

=
_
_
i

j=1
(n i +j)
_
_


0
To nd
0
we have to impose

N
i=0

i
= 1 and in this way we nd the steady state
solution.

0
=
1

N
i=0
_

i
j=1
(n i +j)
_

Now we try to nd the average of this type of queue applying Littles Theorem:
E[N] =
N

i=0
i
i
E[] =
N

i=o

i
=
N

i=0
(N i)
i
E[T] =
E[N]
E[]
1.8 Finite-Source Systems - The M/M/k/0/N Queue
This queue is represented by k identical servers (where k < N), no waiting line and
the population is a maximum of N. This kind of system is typical of the telephone
communications.
The state transition diagram of an M/M/k/0/N queue is represented in gure 1.7.
This system is always ergodic and we can nd
i
solving the ow balance equations.
26
Politecnico di Torino Formulary ver. 1.1
0 1 2 k 2 k 1 k
N

(N 1)
2
(N k + 2)
(k 1)
(N k + 1)
k
Figure 1.7: State transition diagram of an M/M/k/0/N queue
For the loss probability we have to refer to the blocking probability; where P
block
<
k
.
The blocking probability is the fraction between the rate at which calls are blocked and
the rate at which calls arrive:
P
block
=
(N k)
k

k
i=0
(N i)
i
=
(N k)
k

k
i=0
(N i)
i
<

k

k
i=0

i
=
k
N i N k
27
Chapter 2
Queues with Phase-Type Laws
In a single server queue the only probability law used to model the interarrival or service
time distributions is the exponential distribution. This type of queue are collectively
referred to as birth-death processes. In these systems, transitions from any state are ad-
jacent states only. But sometimes the exponential distribution is simply not adequate.
Phese-type distributions allows us to consider more general situations. Queueing sys-
tem with phase-type arrival or service mechanisms are referred to be almost-birth-death
processes.
2.1 The Erlang-r Service Model - The M/E
r
/1 Queue
Consider a single server system for which the arrival process is Poisson with rate
and service time, having an Erlang-r distribution, is represented as a sequence of r
exponential services each with rate r. There cannot be more than one customer
receiving service at any time - the single server provides each customer taken into service
with r consecutive service phases and then ejects that customer from the system.
The density functions of the arrival and service processes are given by
a(t) = e
t
, t 0
b(x) =
r(rx)
r1
e
rx
(r 1)!
, x 0
Our rst task is to formulate a state descriptor for this queueing system. In an M/E
r
/1
queue, we must record both the number of customers present and the current phase
of service of the customer in service, if any. Because of the exponential nature of the
distribution of both the times between arrivals and the services times at each of the r
phases, a knowledge of the number of customers in the system and the current phase of
service is sucient to capture all the relevant past history of this system.It follows that
a state of the system can be completely described by the pair (k, i), where k (k 0) is
the number of customers in the system, including the one in service, and i (1 i k)
denotes the current phase of service. If k = 0, then the value of i is irrelevant. If
28
Politecnico di Torino Formulary ver. 1.1
k > 0, then k i+1 denotes the number of phases of service yet to be completed by
the customer in service. The future evolution of the system is a function only of the
current state (k, i) and consequently a Markovian analysis may be carried out.
1,S
1
2,S
1
3,S
1
1,S
2
2,S
2
3,S
2
0 1,S
3
2,S
3
3,S
3

1,S
r
2,S
r
3,S
r

r r

r r

r r

Figure 2.1: State transition diagram of an M/E
r
/1 queue
The state transition diagram is represented in gure 2.1, where the states are arranged
into levels according to the number of customer present. The states that have exactly
k customers are said to constitute the level k.
If we consider Y as an Erlang process of order r we can write:
Y = X
1
+X
2
+ +X
r
Where X
i
with i < k is IID and it is a random variable distributed exponentially.
We can also calculate the mean of Y :
E[Y ] =
1

with Y = X
1
+ X
2
+ + X
r
The second moment of Y is:
E
_
Y
2

= E
_
(X
1
+X
2
+ +X
r
)
2

=
k

i=1
E
_
X
2
i

+
k

i=1
k

j=1
E[X
i
X
j
]
= k
2
(k)
2
+k(k 1)
1
(k)
2
=
k
2
+k
(k)
2
=
1

+
1
k
2
The coecient of variation, how variant is the random variable is describe by this
formula
C
v
=
_
Var [X]
E[X]
29
Politecnico di Torino Formulary ver. 1.1
for the exponential this value is
C
v exp
= 1
The variance of an M/E
r
/1 queue comes from the second moment
Var [Y ] = E
_
Y
2

E[Y ]
2
=
1

2
+
1
k
2

1

2
=
1
k
2
And the coecient of variation for an Erlang-r distribution is:
C
v Er
r
=
1

k
1

=
1

k
2.2 The Erlang-r Arrival Model - The E
r
/M/1 Queue
We now introduce the case of a single server queue for which the arrival process is
Erlang-r and the service time is exponential with rate .
The density function of the arrival and service processes are given by
a(t) =
r(rt)
r1
(r 1)!
t 0
b(x) = e
x
x 0
Before actually appearing in the proper queue, an arriving customer must pass through
r exponential phases each one distributed with parameter r. When a customer com-
pletes the arrival process another immediately begins. We assume to have an innite
pool of available customers waiting to enter the arrival mechanism. The instant that
one customer completes the arrival process, a second customer simultaneously begins
the process.
The state descriptor for the E
r
/M/1 queue must specify the number of customers in
the system, k, and the phase at which the arriving customer has to be found, i. In this
way, the state diagram is set up on a two-dimensional grid (k,i), arranged into levels
according to the number of customers present, similar to the M/E
r
/1 system. The
state transition of E
r
/M/1 queue is represented in gure 2.2.
30
Politecnico di Torino Formulary ver. 1.1
(0,1) (0,2) (0,3) (0,r)
(1,1) (1,2) (1,3) (1,r)
(2,1) (2,2) (2,3) (2,r)

(k,1) (k,2) (k,3) (k,r)
r

r
r

r
r

r
r

r
r

r r r r
Figure 2.2: State transition diagram of an E
r
/M/1 queue
31
Politecnico di Torino Formulary ver. 1.1
2.3 The M/H
2
/1 and H
2
/M/1 Queues
In this section we take into account single-server queues with either hyperexponential
service or arrival distributions. We consider rst the M/H
2
/1 queue, in this case the
arrivals are generated according to a Poisson process with rate , while the service is
represented by a two-hyperexponential distribution. With probability a customer
entering service receives service at rate
1
, while with probability 1 this customer
receives service at rate
2
. Also in this case the state of the system is represented by
the pair (n,i ) where n is the total number present and i is the current service phase.
The transition diagram is shown in gure 2.3. Increasing the number of phases from 2
to r has the eect of incorporating additional columns into this gure. With r possible
service choices, a departure from any state (n,i ), n > 1 can bring the system to any of
the states (n-1, i ) at rate
i

i
, where
i
is the probability that an arriving customer
enters service phase i, for i =1,2,..,r.
(0,0)
(1,1) (1,2)
(2,1) (2,2)

(k,1) (k,2)
(1 )

2

(
1

1
(1 )
2

2

(
1

1
(1 )
2

2

(
1

1
(1 )
2
Figure 2.3: State transition diagram of an M/H
2
/1 queue
Now we look at the H
2
/M/1 queue. In the instant at which a customer enters in the
queue properly, a new customer immediately initiates its arrival process. The time of
32
Politecnico di Torino Formulary ver. 1.1
the moment at which it actually arrives in the queue is exponentially distributed. With
probability this exponential distribution has rate
1
, while probability 1- it has rate

2
.
The transition diagram is represented in gure 2.4.
(0,1) (0,2)
(1,1) (1,2)
(2,1) (2,2)

(k,1) (k,2)
(
1

2
(1 )
2

(
1

2
(1 )
2

(
1

2
(1 )
2

(
1

2
(1 )
2

Figure 2.4: State transition diagram of an H


2
/M/1 queue
33
Chapter 3
The M/G/1 and the G/M/1
Queues
3.1 Introduction in the M/G/1 Queue
The M/G/1 queue is a single-server queue, the arrival process is Poisson with rate
and its distribution function is:
A(t) = 1 e
t
t 0
The service times are independent and identically distributed and obey a general distri-
bution function. In particular, the remaining service time may no longer be independent
of the service already received. The mean service rate is denoted by . The service
time distribution function is:
B(x) = P (S x)
where S is the random variable service time, and the density function is:
b(x)dx = P (x S x +dx)
For the M/G/1 queue, the stochastic process N(t), t 0 is not a Markov process since,
when N(t) 1, a customer is in service and the time already spent by that customer in
service must be take into account. Consider the conditional probability that the service
nishes before x +dx knowing that its duration is greater than x
C(x) = P (S x +dx| S > x) =
P (x S x +dx)
P (S > x)
=
b(x)dx
1 B(x)
In general C(x) depends on x. However, when B(x) is the exponential distribution,
B(x) = 1 e
x
, b(x) = e
x
and
C(x) =
e
x
dx
1 1 + e
x
34
Politecnico di Torino Formulary ver. 1.1
which is independent of x.
For the M/G/1 queue, where C(x) depends on x, the process N(t), t 0 is not Marko-
vian and if we start to observe the process at an arbitrary time x, the probability that
the service completes on the interval (x, x +dx], which implies a transition of the pro-
cess N(t), is not independent of x, the time already spent in service for the customer
currently in service. If at some time t we want to summarize the complete relevent
past history of an M/G/1 queue, we must specify both:
1. N(t), number of customers present at time t
2. S
0
(t), the service time already spent by the customer in service at time t
While N(t) is not Markovian, [N(t), S
0
(t)] is a Markovian process, since it provides all
the past history necessary for describing the future evolution of an M/G/1 queue.
3.2 Solving the M/G/1 Queue
To solve the M/G/1 queue with Markov chain theory we need a trick. If we consider the
process N(t
n
) the process sampled in discrete time is better. We can sample the time
at arrival time or at departure time. If we sample at arrival time, the residual service
time is still dependent on S
0
(t) and in this case is not possible to say that Markovian
property is ensured (the next arrival is related to S
0
(t)). Else, when we sample at
departure time, if the queue is not empty the interval between two departures depends
only on service time; if the queue is empty this interval is the sum of one arrival time
and one departure time.
We recognize that N(t
n
) = q
n
is a discrete time Markov chain (DTMC), where q
n
is
the number of customers at departure time. If we write
q
n+1
= F(q
n
)
is equivalent to say that Markov property holds because all the system depends on n.
F is a function that contains stochasticity but does not depend on the past.
q
n+1
= q
n
+ arrivals departures
If q
n
> 0 departures are deterministically equal to 1.
We dene
n
as the number of arrivals in (t
n
, t
n+1
] and we can check that
n
does not
depend on the past. We can write
q
n+1
= (
n
1) +p
n
If we dene t
n
and t
n+1
the service time of customer in n and n +1, we can rewrite
n
as the number of arrivals in S
n+1
and for stacasticity
n
is in S
n+1
is independent of
another
n
in another S
n
time.
Now we dene

n
is the arrivals in S
n+1
we can write
q
n+1
=

n
+q
n
35
Politecnico di Torino Formulary ver. 1.1
q =
_
1 q
n
> 0
0 q
n
= 0
The M/G/1 works as
q
n+1
= q
n
q
n
+
n
Now we draw the graph of M/G/1(3.1)
0 1 2 3 4 5
p
0
p
1
p
2
p
3
p
4
p
5
Figure 3.1: Graph of an M/G/1 queue

n
can take any value from 0 to . The probability to having k customers does not
depend on n:
p
k
= p
n
( = k)
If we consider that G = D, so we have an M/D/1 queue, all S
n
have the same value
p
n
( = k) =
e
x
(x)
k
k!
Now we dene N(t) as the number of customers after the departure of the n-th customer.
Service time are IID so customers that arrive are independent from the number of
customers in another service time. This can be write as
P (
n
= k) = P ( = k)
Customers arrive in random window so
_

0
P ( = k | S
n+1
= x) S(x) dx =
_

0
e
x
(x)
k
k!
S(x) dx
However, this solution is too complex to do, so we try in another way.
0 1 2
p
0
p
1
p
2
p
1
p
2
p
0
n 1 n n + 1 n +j
p
1
p
2
p
0
p
j+1
36
Politecnico di Torino Formulary ver. 1.1
We now look at the ow balance equation for state 0 is:

1
p
0
=
0
(1 p
0
)
The ow balance equation for state n is:

n
(1 p
1
) =
n+1
p
0
+
n1
p
2
+ +
1
p
n1
+
0
p
n
The loops are count twice or are not count at all.
Average
To calculate the average we start from this equation
q
n+1
= q
n
q
n
+
n
Under ergodic condition we can write
lim
n
E[q
n
] = E[q]
And we nd
E[q
n+1
] = E[q
n
] E[q
n
] +E[
n
]
Now we take the limit of this expression
E[q] = E[q] lim
n
E[q
n
] +E[
n
]
E[
n
] this is a constant with respect to n, because of
n
does not depend on n.
P (q > 0) +E[
n
] = 0 P (q > 0) = E[
n
]
E[] = E[S]
for E[S] > 1 the system is not ergodic. Now, if we take q
n+1
= q
n
q
n
+
n
and we
do the square and after we take the limit for n we obtain something like this
E[q] =
E
_

+E[] 2E[]
2
2(1 E[])
This formula is known as Pollack and Klimchine formula.
E[] = E[S]
E
_

=
2
E[S]
2
+E[S]
It can be proved that the distribution if the queue size at departure time is equal to
the steady state distribution at any time.
E[q] =

2
E[S]
2
+E[S] +E[S] + 2
2
E[S]
2
2(1 E[S])
=

2
E[S]
2
+ 2E[S] + 2
2
E[S]
2
2(1 E[S])
37
Politecnico di Torino Formulary ver. 1.1
If we put = E[S]
E[q] =

2
E[S]
2
+ 2 2
2
2(1 )
=

2
E[S]
2
+ 2(1 )
2(1 )
=

2
E[S]
2
2(1 )
+
We apply Littles Theorem and we obtain
E[D] =
E
_
S
2

2(1 )
+E[S]
E[W] =
E
_
S
2

2(1 )
This is the average waiting time and we can see that it depends directly to the second
moment of the service time.
3.3 Average in other type of queue
M/M/1
c
v
= 1 V ar(S) =
1

2
E[S] =
1

E
_
S
2

=
2

2
= 2E[S]
2
E[W] =
E
_
S
2

2(1 )
=
2E[S]
2
2(1 )
=
E[S]
2
1
=
2/
2
1 rho
= E[S]

1
M/D/1
c
v
= 0 E[S] =
1

E
_
S
2

= E[S]
2
= S
2
E[W] = E[S]

2(1 )
M/G/1
c
2
v
= 10 E
_
S
2

= E[S]
2
+V ar(S) = 11E[S]
2
E[W] = E[S] 11

2(1 )
38
Chapter 4
Queueing Networks
4.1 Introduction
4.1.1 Basic Denitions
In this part we consider a multi-node system in which a customer requires service
at more than one node. This kind of system can be viewed as a network of nodes,
in which each node is a service center having storage room for queues to form and
perhaps with multiple servers to handle customers requests. In queueing networks we
are faced with situation in which customers departing from one service center may mix
with customers leaving a second center and the combined ow may be destined to enter
a third service center. Thus there is an interaction among the queues in the network
and this ultimately may have a complicating eect on the arrival at downstream service
center. Customer arrival times can become correlated with customer service times once
customers proceed past their point of entry into the network and this correlation can
make the mathematical analysis of these queues dicult.
4.1.2 The Departure Process - Burkes Theorem
If we know the various properties of the variables that are associated with the service
centers, the number of servers, their service time distribution, the scheduling disci-
pline and so on, then the only item missing is the stochastic process that describes the
arrivals. This linked to the departure processes from nodes that feed the particular
service center as well as the ow of customers directly from the exterior into the center.
Consider an M/G/1 system and let A

(s), B

(s) and D

(s) denote the Laplace trans-


form of the PDFs describing the interarrival times, the service times, and the interde-
parture times, respectively. Let us calculate D

(s). When a customer depart from the


server, either another customer is available in the queue and ready to be taken into
service immediately, or the queue is empty. In the rst case, the time until the next
customer departs from the server will be distributed exactly as a service time and we
have
D

(s)|
server nonempty
= B

(s)
39
Politecnico di Torino Formulary ver. 1.1
On the other hand, if the st customer leaves an empty system behind, we must wait
for the sum of two intervals: (a) the time until the next customer arrives and (b) the
service time of this next customer. Since these intervals are independently distributed,
the transform of the sum PDF is the product of the transforms of the individual PDFs,
and we have
D

(s)|
server empty
= A

(s)B

(s) =

s +
B

(s)
We know that the probability of a departure leaving behind an empty queue is the
same as the stationary probability of an empty system, 1 . In this way we can write
the unconditional transform for the interdeparture PDF as
D

(s) = B

(s) + (1 )

s +
B

(s)
For the case of an M/M/1 queue, the Laplace transform is given by
B

(s) =

s +
where is the service rate. Substituting in D

(s) we obtain
D

(s) =

s +
+
_
1

_

s +

s +
=

s +
+

s +

s +

s +

s +
=
(s +)
(s +)(s +)
+

2
(s +)(s +)
=
(s +)
(s +)(s +)
=

s +
and so the interdeparture time distribution is given by
D(t) = 1 e
t
t 0
We can conclude that the interdeparture times are exponentially distributed with the
same parameters as the interarrival times. This result can be written more generally
ad Burkes theorem:
Consider an M/M/1, M/M/c or M/M/ system with arrival rate . Suppose that
the system is in steady state. Then the following hold true:
1. the departure process is Poisson with rate
2. at each time t, the number of customers in the system is independent of the
sequence of departure time prior to t
We know that the systems, such as M/M/1, M/M/c or M/M/, are the only such
FCFS queues with this property. In other words, if the departure process of and
M/G/1 or G/M/1 system is Poisson, then G=M.
40
Politecnico di Torino Formulary ver. 1.1
4.1.3 Two M/M/1 Queues in Tandem
Consider a queueing system network with Poisson arrivals and two nodes in tandem.
We assume that the service times of a customer at the rst and second nodes are
mutually independent as well as independent if arrival process. We now show that , as
a result of this assumption and Burkes theorem, the distribution of customers in the
two nodes is the same as if they were isolated independent M/M/1 queues.
The rate of Poisson arrival process is and the mean service times at servers 1 and 2
be 1/
1
and 1/
2
, respectively. We introduce
1
=

1
and
2
=

2
as the utilization
factors and we assume that
1
< 1 and
2
< 1. Notice that node 1 is an M/M/1 queue,
and by the Burkes theorem, its departure process (and hence the arrival process of
node 2) is Poisson. By assumption, the service time at node 2 is independent of node
1. But node 2 behaves like an M/M/1 queue, and can analyzed independently of node
1. From our result we know:
P (n at node 1) =
n
1
(1
1
)
P (m at node 2) =
m
2
(1
2
)
From the Burkes theorem, it follows that the number of customers present in node 1
is independent of the sequence of earlier arrivals at node 2. Consequently, it must be
independent of the number of customer present in node 2. This implies that
P (n at node 1 ANDm at node 2) = P (n at node 1) P (m at node 2) =
n
1
(1
1
)
m
2
(1
2
)
Thus, under steady state conditions, the number of customers at node 1 and node 2 at any
given time are independent and joint distribution of customers in the tandem queueing system
has a product form solution.
4.2 Open Queueing Networks
4.2.1 Feedforward Networks
We have a feedforward network when the input to each node in the network is Poisson. Indeed,
since the aggregation of mutually independent Poisson processes is a Poisson process, the input
of the nodes that are fed by combined output of other nodes in Poisson. Likewise, since the
decomposition of a Poisson process yields multiple Poisson processes, a single node can provide
Poisson input to multiple downstream nodes. Feedforward networks do not permit feedback
paths since this may destroy Poisson nature of the feedback stream.
4.2.2 Jackson Networks
The work of Jackson shows that, even in presence of feedback loops, the individual nodes
behaves as if they were fed by Poisson arrivals, when in fact they are not. We consider now
the Jackson network. Take an open network consisting of M nodes, where there is at least one
node to which customers arrive from external source and there is at least one node from which
customers depart from the system. This network is a Jackson network if the following are true
for i, j = 1, 2, , M:
41
Politecnico di Torino Formulary ver. 1.1
node i consists of an innite FCFS queue and c
i
exponential servers, each with parameter

i
external arrivals to node i are Poisson with rate
i
after completing service at node i, a customer will proceed to node j with probability r
ij
independent of past history or will depart from the system, never to return again, with
probability 1

M
j=1
r
ij
The service centers in this network may be load dependent, meaning that the rate at which
customers depart from service can be a function of the number of customers present in the
node. The total average arrival rate of customers to service center is i by
i
; this is given by
the sum of the arrivals from outside the system plus arrivals from all internal service centers.
And we obtains the following equation:

i
=
i
+
M

j=1

i
r
ij
i = 1, 2, , M
In steady state we also have a trac equation for the network as a whole:
M

i=1

i
= =
M

i=1

i
_
_
1
M

j=1
r
ij
_
_
This states that, at equilibrium, the total rate at which customers arrive into the queueing
network from the outside must be equal to the rate which the leave the network.
A Jackson network may be viewed as a continuous-time Markov chain with state descriptor
vector k = (k
1
, k
2
, , k
M
) in which k
i
denotes the number of customers at service center i. At
a given state k, the possible successor states correspond to a single customer arrival from the
exterior, a departure from the network or a movement of a customer from one node to another.
The transition from state k to state k(i
+
) = (k
1
, , k
i1
, k
i
+ 1, k
i+1
, , k
M
) correspond to
an external arrival to node i and has transition rate
i
. The transition from state k to state
k(i

) = (k
1
, , k
i1
, k
i
1, k
i+1
, , k
M
) corresponds to a departure from center i to the
exterior and has transition rate
i
(k
i
)(1

M
j=1
r
ij
). Finally, the transition from state k to
state k(i
+
, j

) = (k
1
, , k
i1
, k
i
+ 1, k
i+1
, , k
j1
, k
j
1, k
j+1
, , k
M
) corresponds to a
customer moving from node j to node i and has transition rate
j
(k
j
)r
ij
. Let
P(k) = P(k
1
, k
2
, , k
M
)
denote the stationary distribution of the Markov chain (P(k) is the equilibrium probability
associated with state k). We denote the marginal distribution of nding k
i
customers in node
i by P
i
(k
i
).
Jacksons theorem provide the steady state joint distribution for the states of the network.
Jackson Theorem: For a Jackson network with eective arrival rate
i
to node i, and assuming
that
i
< c
i

i
for all i, the following are true in steady state:
1. node i behaves stochastically as if it were subjected to Poisson arrival with rate
i
2. the number of customers at any node is independently of the number of customers at
every other node
Jacksons theorem shows that the joint distribution for all nodes factors into the product of
the marginal distribution, that is P(k) = P
1
(k
1
)P
2
(k
2
) P
M
(k
M
), where P
i
(k
i
) is given as a
42
Politecnico di Torino Formulary ver. 1.1
solution to the classical M/M/1-type queue. It is an example of a product-form solution. In
special case when all the service centers contain a single exponential server, the expression of
P(k) becomes:
P(k) =
M

i=1
(1
i
)
k
i
i

i
=

i

i
The stability condition for a Jackson network is

i
=

i
c
i

i
< 1 i = 1, 2, , M
To solve a Jackson network we need to solve the trac equations to obtain the eective arrival
rate at each node. Each node is then solved in isolation and the global solution formed from
the product of the individual solutions.
Mean Number of Customers
The mean number of customer in node i, E[N
i
], is that of an isolated M/M/1 queue with arrival
rate
i
; this is given by:
E[N
i
] =

i
1
i
i = 1, 2, , M
It follows that the total mean number of customers in the network is given by:
E[N] =
M

i=1

i
1
i
Mean Time Spent in Network
The average waiting time is related to the average time that a customer spends in the network,
and this can be found by applying Littles Theorem:
E[W] =
E[N]

=
M

i=1

i
is the total arrival rate. The average time that a customer spends at node i, during each visit
to node i, is given by:
E[W
i
] =
E[N
i
]

i
=
1

i
(1
i
)
In this case we have that W = W
1
+W
2
+ +W
M
. The average time that a customer spends
queueing prior to service on a visit to node i is:
E
_
W
Q
i
_
= E[W
i
]
1

i
=

i

i
(1
i
)
Throughput
The throughput of a singe node is the rate al which customers leave that node. The throughput
od node i is:
X
i
=

k=1
P
i
(k)
i
(k)
43
Politecnico di Torino Formulary ver. 1.1
where
i
(k) is the load-dependent service rate.The throughput of the entire open queueing
network is the rate ant which customers leave the network. If customers are not lost to the
network, nor combined nor split in any way, then at steady state, the throughput of the network
is equal to the rate at which customers enter the network.
4.3 Closed Queueing Networks
If Jackson network is a closed queueing network it is called Gordon and Newell network.
Consider a closed single-class queueing network composed of M nodes. Let n
i
be the number of
customers at node i. Then the total customer population is given by N = n
1
+n
2
+ +n
M
.
A state of the network is dened as n = (n
1
, n
2
, , n
M
) with n
i
0 and

M
i=1
n
i
= N. The
queueing discipline at each node is FCFS and the service the distributions are exponential. Let

i
be the mean service rate at node i. When the service rate is load dependent, we shall denote
the service rate by
i
(k). Let p
ij
be the fraction of departures from node i that go next to
node j and let
i
be the overall arrival rate to node i. Since the rate if departure is equal to
the rate of arrival, when the network is in steady state, we can write

i
=
M

j=1

j
p
ij
i = 1, 2, , M
Now we introduce the visit ratio at node i,
i
. This gives the mean number of visits to node
i relative to a specied node, in our case we consider the node 1. So,
1
= 1 and
i
is the
mean number of visits to node i between two consecutive visits to node 1. Notice that
i
may
be greater (or smaller) than 1. If X
i
(N) is the throughput of node i in a closed network with
N customers, then we must have
i
= X
i
(N)/X
1
(N). At steady state the rate of arrival to a
node is equal to the rate of departure so that
i
=
i
/
1
which means that
i
uniquely satisfy
the system equation

1
= 1 and
i
=

M
j=1

j
p
ij
i = 1, 2, , M
The major result for this closed network is that the equilibrium distribution is given by the
product form
P (n) = P (n
1
, n
2
, . . . , n
M
) =
1
G(N)
M

i=1
f
i
(n
i
)
where
f
i
(n
i
) =

n
i
i

n
i
k=1

i
(k)
if the node i is load dependent
f
i
(n
i
) =
_

i
_
n
i
= Y
n
i
i
if node i is load dependent
The constant G(N) is called the normalization constant. It ensures that the sum of the prob-
abilities is equal to one.
44
Part II
Exercises
45
Chapter 5
Preliminary Exercises
Exercise 1
Text
Compute the probability density function for the smallest among independent random vari-
ables, all distributed accordingly to a exponential probability density function with the same
parameter .
Solution
X
i
Exp() i = 1, . . . ,
Moreover, X
i
are IID. The minimum will be given by:
Y = min{X
i
}
Therefore the probability density function f
y
(y) is the objective of the problem.
F
y
(y) = P (Y y) = P (min{X
i
} y)
But it is more easy to compute:
F
y
(y) = 1 F
y
(y) = 1 P (Y y) = P (Y y)
Indeed:
P (Y y) = P (min{X
i
} y) = P (X
1
> y , X
2
> y , . . . , X

> y)
since they are all IID, it is possible write:
P (X
1
> y) P (X
2
> y) . . . P (X

> y) = [P (X > y)]

= [e
y
]

= e
y
Now, given that F
y
(y) is obtained, to compute f
y
(y) it is possible use:
f
y
(y) =
dF
y
(y)
dy
f
y
(y) =
dF
y
(y)
dy
Therefore:
f
y
(y) = [ e
y
] = e
y
46
Politecnico di Torino Formulary ver. 1.1
It is simply f
x
(x) = e
x
where = , in conclusion:
Y Exp()

Exercise 2
Text
A barber opens his shop at time t
0
= 0. Customers arrive at shop randomly, accordingly to a
Poisson process, i.e., the probability density function of the time between two customers arrive
is:
a(t) = e
t
u(t)
Each air cut requires X seconds, where such X is a random variable.
Find the probability, P, that the second arrive customer does not have to wait and his
average waiting time W in the following cases:
. X is a constant: X = c;
. X is uniformly distributed among 0 and 2c: X U(0 , 2c).
Solution
Case 1: the customer does not wait - X = c
Consider:
t
t
0
t
a
1
t
d
1
X
where:
. t
a
1
is the arrival time of the rst customer;
. t
d
1
is the departure time of the rst customer;
. the orange line represent possible arrival times for the second customer.
Therefore:
P
_
2

customer does not have to wait


_
= P (t
a
2
> t
d
1
)
and:
t
d
1
= t
a
1
+X = t
d
1
= t
a
1
+c
In conclusion:
P (t
a
2
> t
d
1
) = P (t
a
2
> t
a
1
+c) = P (t
a
2
t
a
1
> c)
but:
t
a
2
t
a
1
Exp() = P (t
a
2
t
a
1
> c) = e
c
47
Politecnico di Torino Formulary ver. 1.1
Case 2: the customer has to wait - X = c
Consider W the waiting time of the second customer; the average is:
E[W] =
_
0 t
a
2
> t
d
1
t
a
2
t
d
1
otherwise
Since:
t
a
2
t
d
1
= t
a
2
t
a
1
+c = c (t
a
2
t
a
1
) if t
a
2
t
a
1
< c
and t
a
2
t
a
1
Exp(). Thus:
E[W] =
_
0 t
a
2
> t
d
1
c (t
a
2
t
a
1
) otherwise
Let y = (t
a
2
t
a
1
):
E[W] =
_
0 t
a
2
> t
d
1
c y otherwise
The average waiting time of the second customer is:
E[c y | y < c]
this can be computed as:
_
c
0
(c y)f
y
(y) dy =
_
c
0
(c y)e
y
dy

By solving this integral:


c
_
c
0
e
y
dy
_
c
0
y e
y
dy =
c
_
e
y

c
0
_

_
y e
y

c
0
+
_
c
0
e
y
dy
_
=
c (1 e
c
)
_
c e
c
+
e
y

c
0
_
=
c (1 e
c
) +c e
c
+
e
y

= c +
e
y

Case 3: the customer does not wait - X U(0 , 2c)


In this case:
t
d
1
= t
a
1
+X
and:
P
_
2

customer does not have to wait


_
= P (t
a
2
> t
d
1
) = P (t
a
2
> t
a
1
+X)
It can be written as:
_
2c
0
P (t
a
2
t
a
1
> X) f
x
(x) dx =
_
2c
0
e
x

1
2c
dx

This is solved by parts, where f = y and g

= e
y
48
Politecnico di Torino Formulary ver. 1.1
This integral is solvable in such a way:
1
2c

_
2c
0
e
x
dx =
1
2c

e
x

2c
0
=
1
2c

e
2c
1

=
1
2c
e
2c
Case 4: the customer has to wait - X U(0 , 2c)
In this case we have not to compute:
E[c y | y < c]
but, since:
t
a
2
t
d
1
= t
a
2
t
a
1
+X = t
a
2
< t
a
1
+X
therefore:
E[W] = E[X Y | Y < x] = E[E[X Y | Y < X , X = x]]
x
that can be solved by:
_
2c
0
__
x
0
(X Y )f
y
(y) dy
_
f
x
(x) dx =
_
2c
0
_
x +
e
x

1
2c
dx =
=
1
2c

_
4c
2
2

e
2c

2

2c

+
1

2
_

Exercise 3
Text
Passengers arrive randomly at the bus stop. The random process describing passengers arrivals
is Poisson with rate = 1 arrival per minute. Also departures follows a Poisson random process,
independent from the customer arrival process, with rate = 2 buses per hour.
Assuming that passengers take always the rst stopping bus and buses can carry an arbitrary
number of passengers, compute:
1. the average number of passengers that take the same bus;
2. the average number of passengers on the rst bus departing after 9 am.
Solution
Task 1
Let N be the number of passengers in the same bus; the problem requests E[N]. Let X be
inter arrival time of buses:
X Exp()
The process that counts the number of passengers arriving during X is N(x) and it is a Poisson
process with rate X:
N(x) Poisson(X)
49
Politecnico di Torino Formulary ver. 1.1
Therefore:
E[N] = E[E[N(x) | X]] = E[X] = E[X] =
1

Since describe arrivals per minute, it is equivalent say:


1 arrival per minute = 60 arrivals per hour
In conclusion:
E[N] = 60
1
2
= 30
Task 2
The situation to take care is:
t
0 bus 9 bus
x
2
x
1
where each random variable is exponentially distributed:
x
1
Exp()
x
2
Exp()
The average number of passengers that take the bus after 9, thanks to memoryless property, is
given by:
E[N] = E[E[N(x
1
) | x
1
]] +E[E[N(x
2
) | x
2
]] = 2 E[E[N(x) | x]] = 2

= 60

50
Chapter 6
Exercises on Queues
Exercise 1
Text
In a M/M/m system, arrivals are distributed according to a Poisson process and service time
are exponentially distributed with rate . The queue is served in FIFO and, at time t
0
= 0,
customer A arrives nding m people into the m servers and n people in the queue. After t
0
nobody arrives more.
Find:
1. the average time in which A starts being in service (waiting time);
2. the time in which the system will be empty.
3. Let X be if A is the -th customer leaving the system after t
0
. Find P (X = ).
4. the probability that A ends his service before his predecessor B.
5. Let be the amount of time spent by A waiting to be in service. Find P ( > x).
Solution
Task 1
The average waiting time is:
E[W
A
]
It happen after n + 1 departures of customer in the queue. Since there are m servers, the
inter departure time is distributed accorded to Exp(m) because all of them are distributed
as Exp(). Therefore, the waiting time of A is the sum of inter departure times (T
d
) of n + 1
customers.
E[W
A
] =
n+1

i=1
E[T
d
i
]
Since all T
d
i
are IID:
E[W
A
] = (n + 1) E[T
d
i
] = (n + 1)
1
m
=
n + 1
m
51
Politecnico di Torino Formulary ver. 1.1
Task 2
The time in which the system is empty is the time in which n + 1 + m departures will take
place. The distribution is not, as before, Exp(m) because, in some moments, it is possible
that not all servers are busy. Representing the situation with a Markov Chain:
0 1 2
m m+ 1 m+ 2

m
Therefore:
E[T
empty
] =
n + 1
m
+
1
m
+
1
(m1)
+
1
(m2)
+ +
1

=
=
n + 1
m
+
m1

i=0
1
(mi)
Task 3
If = 1, A is the rst customer leaving the system: it could not be possible since the discipline
is FIFO. Therefore:
P (X = 1) = 0
At least, A could leave the system after n + 1 customers: it means that people in the queue is
all in service into the m servers and A is the one that has the service time smaller.
Therefore:
P (X = ) =
_
0 1 n + 1
n + 1 < n + 1 +m
Indeed that probability is dierent than 0 in two cases:
. if all customers are served and A is the last one (m 1 servers are idle and 1 busy, the
one that is serving A);
. if there are some customers in service and A is one of them (m servers, potentially, are
busy: actually they can be less than m, but surely more than 1).
In the rst case we have to compute:
P (X = n + 2)

= P (A is the rst leaving) =


1
m
since all servers are independent.
In the second case, instead, the probability that have to be compute is:
P (X = n + 3) = P (Ais not the rst leaving)
P (A is the second leaving | Ais not the rst) =
=
_
1
1
m
_

1
(m1)
=
1
m

The term n + 2 means that A is the rst of the remaining m customers in queue.
52
Politecnico di Torino Formulary ver. 1.1
The probability that A is the second leaving given that is not the rst, means that there
are m1 servers to consider and each one is independent from the others. It is the same of the
previous case because servers are IID and the distribution is exponential, so the memoryless
property holds.
In conclusion:
P (X = ) =
_
_
_
0 1 n + 1
1
m
n + 1 < n + 1 +m
Task 4
The probability that A ends his service before B given that the service time of B is greater
than the service time of A is:
P (A leaves before B| T
d
B > W
A
) =
1
2
because once they are both in service they have the same probability of end their service one
before the other.
Actually, the probability that A leaves before B is:
P (T
d
B > W
A
) P (A leaves before B| T
d
B > W
A
)
where P (T
d
B > W
A
) is just given by the probability that m 1 customer are still in service.
Therefore:
P (T
d
B > W
A
) =
m1
m
Globally:
P (A leaves before B) =
1
2

m1
m
Task 5
Given that is the waiting time of A, the probability:
P ( = x)
is simply the distribution. Therefore:
P ( = x) =
n+1

i=0
x
i
where x
i
Exp(m). It means that:
n+1

i=0
x
i
=
n+1

i=1
e
mx

(mx)
i
i!
This term is the Erlang(n + 1, m).

53
Politecnico di Torino Formulary ver. 1.1
Exercise 2
Text
Consider a M/M/1 system with arrival rate and departure rate . Knowing that customers
arrives always in pair, draw the transition diagram and write the ow balance equations.
Solution
The transition diagram is:
0 1 2 3 4

For a given node i, with i 2, ows balance equations are:


(
i2
) + (
i+1
)

= ( +)
i

Considering i = 1:

2
= ( +)
1
While, for i = 0:

1
=
0
Globally:
_

_

i+1
=
i
i = 0

i+1
= ( +)
i
i = 1
(
i2
) + (
i+1
) = ( +)
i
i 2

Exercise 3
Text
Consider a system in which the departure rate is and the arrival rate is

, where:

=
_
2 when there are no customers in the system
otherwise
Find:
1. the transition diagram;
2. the balance equations, the steady state distribution and discuss the ergodicity;
3. the average number of customers in the system;
4. the average time spent by customers in the system;
5. the average waiting time spent before being served.

This is the incoming ow.

This is the outgoing ow.


54
Politecnico di Torino Formulary ver. 1.1
Solution
Task 1
The transition diagram is:
0 1 2
2

Task 2
Considering i = 0:

i
=
i+1
=
i+1
=


i
while for i = 0:
2
0
=
1
Therefore:
_

i
=
i+1
i = 0
2
i
=
i+1
i = 0
where each
i
is the stationary distribution. Replacing i + 1 with j:

j
=


j1
but it is possible substitute
j1
with his expression obtaining:

j
=


j2
_
Iterating, the last term will be:

j
= 2
_

_
j

0
This holds for each j. In order to be a distribution, the sum of all
j
is forced to be equal to
one, therefore the two equations that represent the steady state distribution are:

j
= 2
_

_
j

0
(6.1)
n

j=0

j
= 1 (6.2)
Substituting (6.1) in (6.2):
n

j=0
_

_
j

0
= 1
55
Politecnico di Torino Formulary ver. 1.1
It is possible rewrite the expression in:
n

j=1
2
_

_
j

0
+
0
= 1

_
_
2
n

j=1
_

_
j
1 + 1
_
_
= 1 (6.3)
Let:
=

So the sum:
n

j=1

j
converge if < 1: under this hypothesis the system is ergodic. Assuming k = j 1:
n

k=0

k+1
=
n

k=0

k
and the last term is the geometric sum, therefore:
n

j=1

j
=
1
1
Substituting in (6.3):

_
2
1
1
+ 1
_
= 1 =
0
=
1
2
1
+ 1
= =
1
1 +
In conclusion:
_

i
= 2
_

_
i

1
1 +

0
=
1
1 +
The initial
0
, in terms of and , is:

0
=
1
1 +
=

+
(6.4)
Task 3
The average number of customer in the system is given by:
E[N] =

i=0
i
i
=

i=1
i
i
56
Politecnico di Torino Formulary ver. 1.1
since the term with i = 0 is null. Substituting the value of
i
:
E[N] =

i=1
i
_
2
_

_
i

1
1 +
_
Let:
=
_

_
Therefore:
E[N] = 2
1
1 +

i=1
i
i
(6.5)
The sum:

i=1
i
i
is the derivative of the geometric series, so:

i=1
i
i
=

i=1
i
i1
=
_
d
dx
_

i=0
i x
i
__
x=
Since:

i=0
i x
i
=
1
1 x
the result is:

_
d
dx
_
1
1 x
__
x=
=
_
d
dx
_
1
(1 x)
2
__
x=
=

(1 )
2
Substituting this value in (6.5):
E[N] = 2
1
1 +


(1 )
2
=
2
(1 +) (1 )
=
2
(1
2
)
Task 4
The average time spent by customers in the system is given, using the Little Theorem, by:
E[T] =
E[N]
E[]
The value E[N] is just the average number of customer in the system computed in task 3, while
E[] is the expected value of arrival rate. It can be calculated as:
E[] = 2
0
+

i=1

i
= 2
0
+

i=1

i
It can be re-written, by putting the common term into the sum, as:
2
0
+

i=1

i
=
0
+

i=0

i
57
Politecnico di Torino Formulary ver. 1.1
Since the distribution is stationary:

i=0

i
= 1
Therefore:
E[] =
0
+ = (
0
+ 1)
Substituting the value of
0
given by (6.4):
E[] =
_
1
1 +
+ 1
_
=
_
1 + 1 +
1 +
_
=
2
1 +
Expressed in terms of and :
E[] =
2
1 +
=
2
+
Since:
E[T] =
E[N]
E[]
the result is:
E[T] =
_
2
(1
2
)
_

_
2
+
_
=
( +)
(1
2
)
Task 5
The average waiting time spent before being served is E[W]: it is a part of the cumulative time
spent in the system. Indeed:
E[T] = E[W +T
s
]
where T
s
is the service time. Due to independence:
E[T] = E[W +T
s
] = E[W] +E[T
s
]
Therefore:
E[W] = E[T] E[T
s
]
Since departures are exponentially distributed:
E[T
s
] =
1

In conclusion:
E[W] = E[T] E[T
s
] =
( +)
(1
2
)

1

Exercise 4
Text
Consider a system in which the departure rate is and the arrival rate is , where:
=

+ 1
Find:
58
Politecnico di Torino Formulary ver. 1.1
1. the transition diagram;
2. the steady state distribution and discuss the ergodicity;
3. the average number of customers in the system;
4. the average time spent by customers in the system.
Solution
Task 1
The transition diagram is:
0 1 2

/2

/3

Task 2
For a given node i, the transition diagram is:
i i + 1
/i + 1

therefore:

i + 1

i
=
i+1
=
i+1
=
1
i + 1


i
Replacing the value of
i
:

i+1
=
1
i + 1


i
=
i+1
=
1
i + 1


_
1
i


i1
_
In general:

i+1
=
1
(i + 1)!

_

_
i+1

0
Imposing that the sum of
i
must be equal to one:
_

i+1
=
1
(i + 1)!

_

_
i+1

0

i=0

i
= 1
Therefore:

i=0
1
i!

_

_
i

0
= 1
59
Politecnico di Torino Formulary ver. 1.1
where:

0
=
1

i=0
1
i!

_

_
i
Let:
=
_

_
The sum becomes:

i=0

i
i!

0
It converges always because is the exponential series: the system is ergodic . In conclusion:
_

i
=
1
(i)!

_

_
i
e
/
=
1
(i)!

i
e

0
= e
rho
Task 3
The average number of customer is given by:
E[N] =

i=0
i
i
=

i=0
i
1
(i)!

i
e

It can be re-written as:

i=0
i
1
(i)!

i
e

= e

i=0
1
(i 1)!

i
= e

i=1
1
(i 1)!

i1
Imposing j = i 1:
e

i=1
1
(i 1)!

i1
= e

j=0
1
(j)!

j
= e

=
Task 4
The average time spent by customer in the system is given, applying the Little Theorem, by:
E[T] =
E[N]
E[]
The value of E[] is unknown:
E[] =

=0

+ 1

=0

+ 1

_
1
()!

_
It becomes:
e

=0
1
( + 1)!

=
e

=0
1
( + 1)!

+1
60
Politecnico di Torino Formulary ver. 1.1
Imposing j = + 1 the sum becomes:

=0
1
( + 1)!

+1
=

j=1
1
(j)!

j
= e

1
Therefore:
E[] =
e

[e

1]

Exercise 5
Text
Consider a M/M/1 queue in which service times are exponentially distributed with parameter
and customers arrive according to a Poisson process with rate . The server is lazy: after
each service, the server takes a rest, during which possibly waiting customers can not be served.
Rest times are exponentially distributed with parameter . At the end of the rest time, the
server becomes available to serve waiting customers. If no customers are waiting after the rest,
the server waits for the rst customer arrival and starts to serve him immediately upont his
arrival.
Draw the transition diagram.
Solution
To identify an arbitrary state of the chain, two descriptors are needed:
. one describing the number of customers in the line;
. one describing the state of the server:
. A if the server is active and can serve a customer;
. R if the server is taking a rest.
The diagram takes care of a population up to 2 customers:
0-A 1-A 2-A
0-R 1-R 2-R

61
Politecnico di Torino Formulary ver. 1.1
Exercise 6
Text
Consider a taxi station with 5 parking positions. Taxis arrive to the station according to a
Poisson process with rate = 2 taxis per minute. The process describing customer arrivals to
the station is independent and Poisson with rate = 1 customer per minute. An arriving taxi
can carry only one customer. When no customer are waiting the arriving taxi can use one free
position, if any. If no parking position is available and no customers are waiting, the taxi leaves
the station empty.
1. Model the system with a Markov with a suitable state denition.
2. Find the probability of having n customers.
3. Find the average number of waiting customers.
4. Find the average number of waiting taxis.
Solution
Task 1
By using:
. N
t
: label describing the number of taxis available;
. N
c
: label describing the number of customers;
is possible describe the system in a reliable way. Each state is composed in such a way:
N
t
-N
c
Therefore, the resultant Markov Chain is:
62
Politecnico di Torino Formulary ver. 1.1
0-0
1-0
2-0
3-0
4-0
5-0
0-1 0-2 0-3

Notice that it is not possible have taxis and customers waiting at the same time and the number
of customers can be any value, while the number of taxis is bounded (up to 5). When a customer
arrives (rate ) and nds a free taxi (the branch going down of the chain) is immediately served,
while if the does not nds free taxis (the branch going right of the chain) he has to wait. This
kind of queue is and M/M/1 queue, where states can be identify by a label:
= 5 N
t
+N
c
This order, labels states starting from the bottom to the top.
Having in mind this:

= (1 )

Using i to label customers arrives and j for taxis, an equivalent notation is:

0 , i
= (1 )
(i+5)

j , 0
= (1 )
(j5)
Task 2
The probability of having exactly n customers in the queue happens only if all taxis are already
busy, therefore the state of the queue to be considered is:
63
Politecnico di Torino Formulary ver. 1.1
0-n
This implies:

0 , n
= (1 )
(n+5)
Task 3
The average number of waiting customers can be computed as:
E[N
c
] =

=6
( 5)

or, in an equivalent way:


E[N
c
] =

i=0
i
i
Task 4
The waiting number of taxis, instead, is:
E[N
t
] =
5

=0
(5 )

or:
E[N
c
] =
5

j=0
j
j

Exercise 7
Text
Consider a doctor shop with two waiting rooms: the rst one has B 1 seats (i.e. up to B
patients can be seated including the one being seen by the doctor), while the second can contain
any number (up to innite) of standing customers. Assume that the arrival process is Poisson
with rate and that service times are exponentially distributed according to rate . Find:
1. the transition diagram and draw it;
2. the average number of seated customers;
3. the average number of standing customers.
64
Politecnico di Torino Formulary ver. 1.1
Solution
Task 1
The transition state diagram for this exercise is very simple:
0 1 2 B 1
B B + 2

As usual:

= (1 )

<
Task 2
If there are B customers all of them are seated, while if they are more, N, B are seated and
N B are upright.
E[N
seat
] =
B

i=1
i
i
+B

i=B+1

i
Task 3
The average number of standing customers is:
E[N
upright
] =

i=B+1
(i B)
i

Exercise 8
Text
Consider the following system:

65
Politecnico di Torino Formulary ver. 1.1
Assume that arrivals are distributed to a Poisson process of rate and, when they arrive, they
select the shortest line; if a customer arrives and nds the two queues with the same number
of waiting customers, he has to select his own waiting line randomly. Departures takes always
place with average 1/.
When a customer ends his service, other waiting customers can move from a queue to the
other one in order to improve their service. Movements occurs in zero time and are simultaneous
to departures and just customers at the end of queue can move.
The system has global capacity equal to 6.
Find:
1. the transition diagram and draw it;
2. similarities with well-known systems.
Solution
Task 1
The transition state diagram, using as descriptors the number of customers into the dierent
queues, is:
0 , 0
1 , 0 0 , 1
1 , 1
2 , 1 1 , 2
2 , 2
3 , 2 2 , 3
3 , 3
/2
/2

/2
/2

/2
/2

Since there are two queues the global departure rate is 2 (therefore a customer leaves from
a single queue with rate ), but arrival rates in the graph are dierent; this dierence is based
on the current state of the system:
66
Politecnico di Torino Formulary ver. 1.1
. if the number of customers is equal in both queues, a new one enters with rate /2
because it can choose the queue in which it will wait;
. if the number of customers in queues are dierent, a new one is forced to enter in the
queue with less occupancy with rate .
Task 2
If there are no distinctions among queues the system behaves like a M/M/2/4 queue:
. 2 because the waiting line is composed by two servers;
. 4 because the global capacity is 6 element: since 2 can be in service, just other 4 customers
can be accommodated.
0 1 2 3 4 5 6

2
This chain has been obtained by aggregating intermediate states of the previous graph.
Exercise 9
Text
Consider a single server queuing system with service rate equal to customers per second with
a FIFO waiting line of limited capacity: at most 3 customers, included the one in service, can
be accepted. Customers arrive in groups and both inter arrival times and service times are
exponentially distributed. The arriving group enters in the system only if all customers can be
accepted otherwise the entire group is lost.
Find the transition diagram and the dropping probability for the following distributions of
customers:
. groups of one customers with rate 2;
. groups of two customers with group arrival rate ;
. groups comprising, with the same probability, one, two or three customers; the group
arrival rate is .
Solution
First scenario
In the rst case customers arrive one after the others as in an M/M/1/2 system; the transition
diagram is, therefore:
0 1 2 3
2

67
Politecnico di Torino Formulary ver. 1.1
Since PASTA holds, the dropping probability is that the system reaches state 3:
P (loss) =
3
For this system is also easy to compute the average delay expected, the throughput of incoming
and outgoing customers; indeed:
E[D] =

2 (1 )
=
1/
(1 )
because here:
=
2

The incoming throughput is dened as:


T
h
in
= [1 P (loss)]
therefore, in this case:
T
h
in
= 2 (1
3
)
The outgoing throughput is:
T
h
out
= (1
0
)
Second scenario
For the second scenario, the transition diagram is:
0 1 2 3


The state 2 is a state for which a further arrival can not be accommodated because there is not
more rooms. In this case, therefore, the dropping probability is given by:
P (loss) =
2
+
3
It is possible conclude that batch arrivals lead to more burstiness, increasing the dropping
probability and, consequently, reduce the throughput. In this scenario PASTA still hold.
Third scenario
The third case is the most complicated one; the transition diagram is:
0 1 2 3

/
3

/
3
/3

/
3

/
3

/
3

68
Politecnico di Torino Formulary ver. 1.1
Rates are all /3 because the probability of having dierent batches is uniform.
In this case, the size of batches implies dierence in losses: batch with higher size are more
probably rejected than others, therefore the dropping probability is state dependent. In this
case PASTA does not hold any more. To evaluate the dropping probability:
. rst the average arrival rate has to be computed: batches can carry one, two or three
customers, so in average they carry two customers; batches arrival rate is so the average
arrival rate for customer is 2;
. the rate in which customers are dropped is:
. in state 1 only the batch that carry three customers is lost at rate /3;
. in state 2 is possible lose the batch that carry two and three customers, always at
rate /3;
. in state 3 all batches are lost at rate /3.
In conclusion:
P (loss) =

_
3

3
_
+
2

_
2

3
+ 3

3
_
+
3

_
1

3
+ 2

3
+ 3

3
_
2

69
Chapter 7
Network queues exercises
Exercise 1
Text
Given the following network queue:

1
/
2

3
1
/
2

2
1/3
2/3
1

1
Assume that each queue is an M/M/1 with innite storage capacity; moreover, consider arrival
and departure rates exponentially distributed.
Find:
1. the steady state distribution;
2. the average number of customers in all queues.
Solution
Task 1
First of all, arrival rates have to be computed: the Jacksons Theorem holds because the
following conditions:
. service times are exponentially distributed;
. all queues have innite storage capacity;
70
Politecnico di Torino Formulary ver. 1.1
. exogenous arrival processes are Poisson;
. routing is memoryless (Bernoullian);
are not violated; thanks to this assumption, the departure rate after a given queue (marked in
the picture in green) is equal to its arrival rate; thanks to this:

2
=
3
=

1
2

1
= +
_
2
3

2
_
+ [1
3
]
Therefore:

1
= +
_
2
3


1
2
_
+
_
1

1
2
_
=
1
= 6
In conclusion:
_

1
= 6

2
= 3

3
= 3
Now it is possible dene the load for each queue:

1
=

1

1
=
6

2
=

2

2
=
3

3
=

3

3
=
3

3
To ensure ergodicity, simultaneously, all loads must not violate the constraints:
_

1
< 1

2
< 1

3
< 1
With these hypothesis, the steady state distributions are:

(1)
i
= (1
1
)
i
1

(2)
j
= (1
2
)
j
2

(3)
k
= (1
3
)
k
3
Thanks to the product form property:

ijk
=
(1)
i

(2)
j

(3)
k
71
Politecnico di Torino Formulary ver. 1.1
Task 2
Since all queues are M/M/1, the average number of customers in an M/M/1 is given by:
E[N] =

1
Therefore:
E[N
1
] =

1
1
1
E[N
2
] =

2
1
2
E[N
3
] =

3
1
3
Globally, in the system there are:
E[N] = E[N
1
] +E[N
2
] +E[N
3
]

Exercise 2
Text
Consider the following closed-network queue:

i
j
k
Assume that the number of customers is N = 5, nd the Markov Chain that describe the model.
Solution
Every time, the number of customers must be equal to 5; some examples are:
0 0 5
0 1 4
1 1 3
and so on. So, as a descriptor, it is possible to use the number of customers in the system; with
this assumption, the Markov Chain is:
0 1 2 3 4 5
5

72
Chapter 8
Simulation of exams
Exercise 1
Text
Consider a system M/. . ./2 where arrivals are Poisson and service times are:
. Erlang 2 (E
2
r
) for q = 0;
. exponential for q = 1.
Assume q be the probability of exit immediately from the system by a customer and p = 1 q
be the probability of going into the second stage.
Find:
1. the transition diagram;
2. if the system is ergodic;
3. ow balance equations;
4. the average number of customers in the system;
5. the average delay of the system.
Solution
Task 1
The state descriptor is composed by:
N
i
- St
1
- St
2
where:
. N
i
represents the number of customers in the system;
. St
1
represents the stage of the rst server: A or B;
73
Politecnico di Torino Formulary ver. 1.1
. St
2
similarly with the previous state, represents the stage of the second server: A or B.
For the generic state (AA):
(AA) ( + 1 AA) ( 1 AA)
(AB)

2q
2p
For the generic state (AB):
(AA) ( + 1 AB) ( 1 AB)
(BB)
( 1 AA)

q
p

For the generic state (BB):


(AA) ( + 1 BB) ( 1 AB)

2
Therefore, in general:
74
Politecnico di Torino Formulary ver. 1.1
2 AA 3 AA
1 A
0 2 AB 3 AB
1 B
2 BB 3 BB
1
2
3
4
1
1
2
3
6
5
7
1
6
7
4 4
1
1
5
3
where:
. 1 means: ;
. 2 means: ;
. 3 means: q; it is used when a customer immediately leave the system;
. 4 means: p; it is used when a customer goes into the second stage;
. 5 means: 2; it is used when the leaving of a customer occurs by choosing one among
two in the same state;
. 6 means: 2q; it is used when one customer among two can exit immediately;
. 7 means: 2p; it is used when one customer among two goes into the second stage.
Task 2
The system is a particular case of an M/G/2; the average service time is:
E[s] =
1

+p
1

The rst time is the service time always present, while the second is considered just with
probability p. Thanks to this, the maximum capacity of the system is:
2
E[s]
so, ergodicity is ensured when:
E[s] < 2
75
Politecnico di Torino Formulary ver. 1.1
Indeed, for a M/M/2 the condition is:

< 2
where
1

= E[s].
Task 3
Flow balance equations are written just for two states:
. for state 0:

0
= q
1 A
+
1 B

. for state (2 AA):


(2q + 2p +)
2 AA
=
1 A
+ 2q
3 AA
+
3 AB
Globally, the outgoing ow is:
(2 +)
2 AA
because:
2q + 2p = 2q + 2(1 q) = 2 (q + 1 q)
Task 4
The average number of customers in the system is:
E[N] = 1 (
1 A
+
1 B
) + 2 (
2 AA
+
2 AB
+
2 B B
) +
+ 3 (
3 AA
+
3 AB
+
3 B B
) =
= 1 (
1 A
+
1 B
) +

=2
(
AA
+
AB
+
B B
)
Task 5
The expected delay can be computed as:
E[D] =
E[N]

by simply applying Little. Take care that the arrival rate is = E[].

Exercise 2
Text
Consider the following network queue:

Outgoing ows equal to incoming ows.


76
Politecnico di Torino Formulary ver. 1.1

1/3
Q
1
Q
2
Q
3
2/3
1/3
1/3 2/3
2/3
Find:
1. if there is a steady state product form (Jacksons Theorem);
2. if the system is ergodic;
3. the steady state distribution;
4. delays of the system:
. traversing time;
. total time spent into a queue.
Solution
Task 1
To verify if the Jacksons theorem is ensured, the following constraint have to be veried:
. service times are exponentially distributed in every queue;
. all queues must have an innite storage capacity;
. exogenous arrival processes must be Poisson;
. routing must be memoryless.
Since all these properties are veried, the system has a steady state product form.
Task 2
To nd if the system is ergodic, rst the following parameters, associated to queues, have to be
dened:

1
such that

1

1
< 1

2
such that

2

2
< 1

3
such that

3

3
< 1
77
Politecnico di Torino Formulary ver. 1.1
All the constraints must be veried simultaneously. The resultant system is:
_

3
=
1
3

1

2
=
2
3

3

1
= +
2
3

1
+
1
3

3
+
2
3

2
Therefore:
_

3
=
1
3

1

2
=
2
9

1

1
=
27
2

Task 3
By exploiting the product form, rst are dened:

1
=

1

2
=

2

3
=

3

3
such that:

ijk
= [(1
1
)
i
1
] [(1
2
)
j
2
] [(1
3
)
k
3
]
Task 4
By applying Little, it is possible to compute both requests. For what concern the traversing
time of a given queue , if

is assumed to be the arrival rate:


E[Trav

] =
E[N

where E[N

] is the average number of customers of the queue .


For what concern the total time spent in a given queue , it can be computed starting from
the average time spent in the system:
E[Time in the system] =
E[N]

=
E[N
1
]


E[N
3
]


E[N
3
]

Since each term is the time spent in a given queue:


E[Time in the queue ] =
E[N

For Q
1
there are two kinds of delays:
. one, the traversing time, that considers the measurement time as:

1
78
Politecnico di Torino Formulary ver. 1.1
by applying Little, this is:
E[Trav
Q
1
] =
E[N
1
]

1
it must be shortest than the other!
. the second one, instead, looks at the total time spent in the queue:

2/3

x

1
since the internal ow is not considered, the new arrival rate is:

x
=
1

2
3

1
=
1
3

1
and, therefore, the average time spent in Q
1
is:
E[Tot time
Q
1
] =
E[N
1
]

x
= 3
E[N
1
]

Exercise 3
Text
Consider an M/M/1 in which arrival and departure rates are exponentially distributed with
parameters and respectively and the server, after having served a packet, takes a rest.
Vacation time is also exponentially distributed with parameter .
Find:
1. the transition diagram;
2. the ergodicity condition.
Solution
Task 1
The state descriptor must contain the number of customers actually present into the system
and the state of the server:
. A if it is active;
. V if it is in vacation.
With this consideration, the markov chain is:
79
Politecnico di Torino Formulary ver. 1.1
0 A 1 A 2 A 3 A
0 V 1 V 2 V 3 V




If the parameter = , the system is exactly an M/E
2
r
/1.
Task 2
The time devoted for each customer is:
1 service time + 1 vacation time =
1

+
1

Therefore the maximum capacity C of the system is that value and, to ensure ergodicity:
C < 1 =
_
1

+
1

_
< 1
Performances of this system are reduced with respect to a traditional M/M/1: indeed, the time
in which the server is working is reduced. The eciency is:
E =
1

+
1

<
1

Exercise 4
Text
Consider a M/M/2 in which one server is lazy: if the queue is empty, one server becomes
inactive until customers are again the system. Arrival and departure rates are exponentially
distributed with with parameters and respectively.
Find:
1. the transition diagram;
2. the ergodicity condition.
Solution
Task 1
In this case, the state descriptor must contain the number of customers in the system and the
actual state of the server lazy; again, is it possible to consider:
80
Politecnico di Torino Formulary ver. 1.1
. A if it is active;
. V if it is in vacation.
With this consideration, the markov chain is:
1 V 2 V
. . .
1 V
0 1 A 2 A
. . .
1 A





2 2
2 2
Task 2
To discuss the ergodicity of the system, it has to be considered on the long term: it has the
same performances of an M/M/2 without rest because for n > :

n+1
=

2

n
Indeed, the series for the M/M/2 is convergent, so also the series for this case converge: this is
due to the property that adding an arbitrary number of terms at the beginning of a series does
not aect the convergence. Therefore, the system is ergodic if:

2
< 1

Exercise 5
Text
Assume that the following random variable has to be simulated:
X = Y +Z
where:
. Y is an hyper-exponential: Y = H
2
y
;
. Z is Rayleigh:
f
z
(t) =
t

2
e

t
2
2
2
Write the pseudo-code to obtain X.
81
Politecnico di Torino Formulary ver. 1.1
Solution
Since X is sum of two independent random variables, it is possible to generate them indepen-
dently.
For what concern Y , the hyper-exponential distribution is:
H
2
y
= p
1

1
e

1
t
+p
2

2
e

2
t
where p
2
= 1 p
1
. Therefore, the pseudo-code to generate it is:
generate u=uniform(0,1)
if (u<p1)
negexp(
1
)
else
negexp(
2
)
For what concern Z, it is possible to compute the cumulant and then invert it:
F
z
(t) = 1 e

x
2
2
2
= u = 1 e

x
2
2
2
Now:
1 u = e

x
2
2
2
= log {1 u} =
x
2
2
2
= x =
_
2
2
log {1 u}
Therefore, the pseudo-code to generate it is:
generate u=uniform(0,1)
apply the formula Z =
_
2
2
log {1 u}

Exercise 6
Text
Consider an M/M/1 system with group services: the server provides services for 1, 2 and 3
customer simultaneously with arrival time and service time , independent on the group size.
The number of served customer is always the largest as possible, given the number of customers
in the waiting line (if in the waiting line there is just one customer, it is served immediately
without waiting other arrivals).
Find:
1. the general transition diagram and dene when it holds;
2. when the system is ergodic.
82
Politecnico di Torino Formulary ver. 1.1
Solution
Task 1
The state descriptor has to take care of the number of customers currently in the system and
on the number of currently in service (this can be 1, 2 or 3). The general transition diagram
consider a node n and looks for possible states reachable from a basic state (n, 1): it means
that there are n customer in waiting line and 1 in service.
n, 1
n, 2
n 3 , 3 n 2 , 3 n 1 , 3 n, 1

This holds just for N = 5 because at the beginning there are transient eects.
Task 2
The capacity of the system, on the long term, is:
C = 3
Therefore, the system is ergodic when:
arrival rate
capacity
< number of servers =

3
< 1

Exercise 7
Text
Consider an E
2
r
/M/1/2 queuing system with group arrivals (each group has at most 3 cus-
tomers). If not all customers of a group can be accepted, only those one that not exceed the
capacity of the system are accepted. The average group interarrival time is
1
, while the
average service time is
1
.
Find:
83
Politecnico di Torino Formulary ver. 1.1
1. the transition diagram for the Markov Chain that model the system;
2. when the system is ergodic;
3. the steady state distribution;
4. the average delay;
5. the average waiting time.
Solution
Task 1
The state descriptor has to take care of the number of customers and the stage of the system
(A/B):
N , A/B
The transition diagram is:
0 , A 1 , A 2 , A 3 , A
0 , B 0 , B 2 , B 3 , B


2 2 2
2
2
2
2 2
Arrival rate are 2 because the average is
1

but there are two stages A/B. The state 3 B


has an arrow towards 3 A because, if customer arrives are all refused, but the system changes
state.
Task 2
Since the system is nite (up to 3 customer can be present: 1 in service and 2 in waiting line)
the system is ergodic.
Task 3
The steady state distribution is not reported, but only balancing equations for some states are
written:
state 0 , B : 2
0 , B
=
1 , B
+ 2
0 , A
state 2 , A : (2 +)
2 , A
=
3 , A
84
Politecnico di Torino Formulary ver. 1.1
Task 4
The average delay can be computed by applying Little:
E[D] =
E[N]
E[]
where:
. E[N] is the average number of customers in the system;
. E[] is the average arrival rate.
For what concern the rst quantity:
E[N] = 0 (
0 , A
+
0 , B
) + 1 (
1 , A
+
1 , B
) + 2 (
2 , A
+
2 , B
) + 3 (
3 , A
+
3 , B
) =
=
3

i=0
i (
i , A
+
i , B
)
For the average arrival rate:
E[] = 0(
0 , A
+
1 , A
+
2 , A
+
3 , A
)+3

2(
0 , B
)+2

2(
1 , B
)+1

2(
2 , B
)+0

(
3 , B
)
Task 5
The average waiting time E[W] can be computed starting from the average delay:
E[D] = E[W] +E[S]
where E[S] is the average service time and:
E[S] =
1

Another approach is to compute rst the average number of waiting customers, then apply
Little:
E[W] =
E[N
waiting
]
E[]
where:
E[N
waiting
] =
3

i=1
(i 1) (
i , A
+
i , B
)
because i customers are present and 1 is in service: i 1 represent the number of waiting
customers.

3 because all customers can be accepted.

1 customer is dropped.

2 customers are dropped.

all customers are dropped.


85
Politecnico di Torino Formulary ver. 1.1
Exercise 8
Text
Consider an M/E
2
r
/2/1 queuing system with group arrivals in which groups arrivals follow a
Poisson process with rate and the average service time is equal to
1
. Each arrival brings
into the queue 2 customers and if one of the two can not be accepted, it is discarded; the same
behaviour happens in case both of them can not be served.
Find:
1. the transition diagram for the Markov Chain that model the system;
2. the average delay.
Assume to consider the particular case M/E
2
r
/2/: when the system is ergodic?
Solution
Task 1
The state descriptor has to take care of the number of customers and all possible stages of the
system (AA/AB/BB):
N , AA/AB/BB
With respect to the previous exercise, now there are two servers, so there are 3 combinations
of possible stages.
The transition diagram is:
2 AA 3 AA
1 A
0 2 AB 3 AB
1 B
2 BB 3 BB

4 4
4
4
2 2
2
2
2
2
When there are two customers that potentially can exit from the system, the departure rate
is 4 because each Erlang 2 with rate has two stages. From any state x, BB it is possible
reach states x 1 , AB because one customer exit (and a new one come starting in stage A),
but the other one is still in the system in stage B.
86
Politecnico di Torino Formulary ver. 1.1
Task 2
As the previous exercise, by applying Little:
E[D] =
E[N]
E[]
Therefore:
E[N] = 1 (
1 , A
+
1 , B
) + 2 (
2 , AA
+
2 , AB
+
2 , BB
) + 3 (
3 , AA
+
3 , AB
+
3 , BB
)
E[] = 2 (
0
+
1 , A
+
1 , B
) + (
2 , AA
+
2 , AB
+
2 , BB
) + 0
Task 3
In general, for a system with 2 server, an M/M/2 in which customers arrives one at time, the
ergodicity condition is:
E[S] < 2 =

< 2
considering and as arrival and departure rate respectively. For batch arrivals (groups of 2
customers at time):
2 E[S] < 2 =
2

< 2 =

< 1

Exercise 9
Text
Assume that instances of a random variable X have to be generated starting from:
n
f
x
(n)
0

1
Solution
There are two possible approaches.
87
Politecnico di Torino Formulary ver. 1.1
Approach 1

2
+ (1 ) = 1

_

2
+ 1
_
= 1 = =
1
1

2
Approach 2
In this case the function have to be split into:
n
f
x
(n)
0

n
f
x
(n)
0

1
The graph on the left it is not a distribution; to be a distribution, it has to be normalized as
follows:
n
f
x
(n)
0

where such

is:

=
2

Now the distribution is:


f
z
(n) =
_
_
_
2

2
n 0 n
0 otherwise
The rst value is due to: c = 2/ = c = 2/
2
. In this way, by looking at values of n:
_
X = rst graph if 0 n <
X = second graph if n 1
88
Politecnico di Torino Formulary ver. 1.1
The second part is easy to be generated:
X|
n1
= Uniform{,1,&seed}
For what concern the rst, by applying the inversion on the cumulant:
F
z
(n)

=
2

2
n
2
for 0 n
so:
t =
2

2
n
2
= n =

2
t
Since t can be generate as an uniform from 0 to 1:
X|
0n<
=
_

2
Uniform{0,1,&seed}}

Exercise 10
Text
Assume that a wireless network has to be simulate under the following hypothesis:
. use a spatial approach;
. consider nodes distributed as a Poisson process with rate ;
. nodes are placed in an independent and uniform manner.
Solution
By using a spatial approach, it is possible to introduce axis x and y to describe a generic
coordinate of a node:
x
y
distribution: Poisson( Area)
To generate a Poisson process to place nodes:
n=Poisson));

This is the integral of f


z
(n)
89
Politecnico di Torino Formulary ver. 1.1
for(k=1; k<= n; k++){
x[k]=Uniform(0,1,&seed);
y[k]=Uniform(0,1,&seed);
}
rst it is generated the number of nodes to put into the topology, then they are placed in a
given coordinate.
Each node is placed exactly in the center of a disk with a given radius:
R
and disks can not overlap. To generate it, there are two methods:
1. generate module and phase to exploit polar coordinates:
module=Uniform(0,1,&seed);
phase=Uniform(0,2,&seed);
2. generate a square outside the disk to have the radius R = 1/2:
then generate the point on the rectangle surface.

Exercise 11
Text
Given a set of random variables:
_

_
X
1
= . . .
X
2
= . . .
.
.
.
X
n
= . . .
compute the condence interval.
90
Politecnico di Torino Formulary ver. 1.1
Solution
As notation, the estimated value are denoted as . . . while non estimated value does not have
the line over them.
To compute the condence interval, rst the estimate mean and variance have to be com-
puted:
avg =
n

i
1
x
i
n
=
var =
1
n 1

n

i
1
(x
i
avg)
2
=
where x
i
are samples. To nd the variance as estimator of the mean value, the estimated
standard deviation has to be computed:
stdev =
_
var
n
=
_

n
After that, it is possible to conclude that:
avg

= N

_
avg , stdev
_
The probability that an error is behind a threshold is:
P (|avg avg|) <
Since:
avg avg

= N
_
0 , stdev
_

= N
_
0 ,
_

n
_
the expression:
|avg avg| <
is simply:
|avg avg|
To nd this interval:
_

N
_
0 ,
_

n
_
= F()
The condence interval associated to level (typical values for it are 0.9, 0.95, 0.99) is:
Conf = [avg , avg +]
because is the solution of the equation:
F() =

Normal distribution
91
Part III
Appendix
92
Appendix A
Formulas
Queue Type of Formula Formula
M/M/1 Ergodicity Condition

< 1
Avg Service Time E[S] =
1

Second Moment of Service Time E


_
S
2

=
2

2
Avg Number of Customers E[N] =

1
Variance V ar(N) =

(1 )
2
Avg Delay E[W] =
1/
1
Throughput X =
Trac Intensity U =

M/M/1/N Avg Number of Customers E[N] =


[1 (N + 2)
N+1
+ (N + 1)
N+2
]
1
2

1
1
N+2
Average Delay E[D] =
[1 (N + 2)
N+1
+ (N + 1)
N+2
]
(1 )(1
N+2
)

1

N+1
(1 )
1
N+2

Throughput in input t
in
= (1
N+1
)
Throughput in output [N=0] t
out
=

1 +
Loss Probability
1

1
1

M/M/c Ergodicity Condition



c
< 1
Avg Number of Customers E[N] =

i=0
i
i
Avg Delay E[N] =

i=0
i
i

93
Politecnico di Torino Formulary ver. 1.1
M/M/c/0 Avg Number of Customers E[N] =

1
M/M/ Avg Number of Customers E[N] =

Avg Delay E[W] =


1

M/M/1/N-1/N Avg Number of Customers E[N] =

N
i=0
i
i
Avg Arrival Time E[] =

N
i=0
(N i)
i
Avg Delay E[D] =

N
i=0
i
i

N
i=0
(N i)
i
M/E
r
/1 Y is an Erlang process Y = X
1
+X
2
+ +X
r
Mean of Y E[Y ] =
1

Second Moment of Y E[Y


2
] =
1

+
1
k
Coecient of Variation c
v
=
_
V ar(x)
E[X]
Variance V ar(Y ) =
1
k
2
M/G/1 Pollack Klimchine E[q] =
E[
2
] +E[] 2E[]
2
2(1 E[])
Second Moment of Service Time E
_
S
2

= E[S]
2
+V ar(S) = 11E[S]
2
Avg Delay E[D] =
E[S]
2
2(1 )
+E[S]
Avg Waiting Time E[W] =
E[S]
2
2(1 )
M/D/1 Avg Service Time E[S] =
1

Second Moment of Service Time E


_
S
2

= S
2
Avg Delay E[D] = E[S]

2(1 )
Jackson Networks Stability Condition [i=1,2,..,M]
i
<

i
c
i

i
Mean Number of Customers E[N] =

M
i=1

i
1
i
Avg Waiting Time E[W] =
E[N]

M
i=1

i
[ is the arrival time]
Avg Time spent in node i E[W
i
] =
1

i
(1
i
)
Throughput X
i
=

k=1
P
i
(k)
i
(k)
94
Politecnico di Torino Formulary ver. 1.1
For what concern the M/M/k/0/N, the blocking probability is:
P
block
=
(N k)
k

k
i=0
(N i)
i
where:
(N k)
k

k
i=0
(N i)
i
<

k

k
i=0

i
=
k
computed for:
N i N k
95
Appendix B
Integrals
In the following formulas are always omitted the sum of the constant c.
Fundamentals
_
x

=
x
+1
+ 1
_
1
x
= ln |x|
_
a
x
=
a
x
ln a
_
a
x
=
a
x
log a
a > 0 , a = 1
_
e
x
= e
x
_
e
x
=
e
x

_
x e
x
=
e
x

2
(x 1)
_
sin x = cos x
_
cos x = sin x
96
Politecnico di Torino Formulary ver. 1.1
Integrals that can be bring back to fundamentals
_
f
n
(x) f

(x) =
f
n+1
(x)
n + 1
_
f

(x)
f(x)
= log |f(x)|
_
e
f(x)
f

(x) = e
f(x)
_
a
f(x)
f

(x) =
a
f(x)
ln a
Techniques
By substitution
Imposing:
g(t) = x = dx = g

(t)
It is possible obtain:
_
f(x) dx =
_
f[g(t)] g

(t)dt
By parts
_
f(x) g

(x)dx = f(x) g(x)


_
f

(x) g(x)dx
97
Appendix C
Series

i=0
x
i
=
1
1 x

i=0
i x

=
1
1 x

i=0
i x
i
=
x
(1 x)
2

i=0
i
2
x
i
=
x (1 +x)
(1 x)
3

i=0
i
3
x
i
=
x (1 + 4x +x
2
)
(1 x)
4

i=0
i
4
x
i
=
x (1 +x) (1 + 10x +x
2
)
(1 x)
5

i=1
x
i
i
= log
e
_
1
1 x
_

i=0
x
i
i!
= e
x

i=0
i
x
i
i!
= x e
x

i=0
i
2

x
i
i!
= (x +x
2
) e
x

i=0
i
3

x
i
i!
= (x + 3x +x
2
) e
x

i=0
i
4

x
i
i!
= (x + 7x
2
+ 6x
3
+x4) e
x
98

You might also like