You are on page 1of 18

EE132B - Recitation 10

Queueing Systems
Prof. Izhak Rubin
rubin@ee.ucla.edu
Electrical Engineering Department
UCLA
Outline
Birth & Death Process
Discrete Time Queueing System
Geometric Distribution
The Geom/Geom/1 QS
Example
Continuous Time Queueing System
The M/M/1 QS
Example
Birth & Death Process
A process is said to be a birth & death process if the
TPF is given by:
, for 1
, for 1
( , )
1 , for
0, otherwise
i
i
i i
X
j i
j i
P i j
i j


= +
|

=
,
=

|
0 1 2
3

3
Birth & Death Process (cont.)
Balanced equations
Flow into a node = flow out of a node
0 1
1 1
0 1
0
1
1
At node 0: (0) (1)
At any other node : ( ) ( ) ( 1) ( 1)
Node 0: (0) (1)
(1) (0)
( 1) ( ), 0
j j j j
j
j
P P
j P j P j P j
P P
P P
P j P j j


+
+
=
+ = + +
=
=
+ = >
1 1 0 2
1
2
Node 1: ( ) (1) (0) (2)
(2) (1)
P P P
P P

+ = +
=
Birth & Death Process (cont.)
1 1 -2 -1 -2 -3 0
-1 -1 -1 1
-1 -2 -3 0
-1 -1 1
0
0
...
( ) ( 1) ( 2) .... (0)
.....
...
Define
.....
A unique stationary distribution exists for
( ) (0)
j j j j j j
j j j j j j
j j j
j
j j j
j
j
j
P j P j P j P
a
a
P j P




=
+
= = =


' '
=

=

-1 -2 -3 0
0
1 -1 -1 1
1
0 0
0
...
(0) .. (0) ... 1
.....
(0) 1, (0)
( ) , 0,1, 2,..
j j j
j j j
j j
j j
j
i
i
P P
P a P a
a
P j j
a


= =

=
+ + + + =
+
= =

' '
= =

Discrete Time Queueing Systems


Example: Geom/Geom/1
Geometric Distribution
Recall the following properties for geometric distribution
It is the only discrete memoryless distribution
Let p = probability of success
And 1-p = probability of failure
If T
n
is a geometrically distributed random variable,
P(T
n
= j) = p(1-p)
j-1
The Geom/Geom/1 QS
Geom/Geom/1
Inter-arrival times are geometrically distributed
Service times are geometrically distributed
1 server is present in the system
Recall that this system is discrete. That means that
Arrivals can only occur at the beginning of a time slot
Departures can only occur at the beginning of a time slot
The inter-arrival times are geometrically distributed
T(j) = P(T
n
= j) = p(1-p)
j-1
i.e. for each time slot, we have an arrival with probability p, and
no arrival with probability 1-p
The service times are geometrically distributed
B(j) = P(B
n
= j) = q(1-q)
j-1
i.e. for each time slot, we have a departure with probability q,
and no departure with probability 1-q
Notations and Symbols

1
1 1
= message system size at
= # of message arrivals recorded at



k
k
D k
Dk
k k k
k k
Dk
k k k
Dk
X k
M k
N N X
X X M
X X N
X X N M
+
+
+
+
+
+
+
+
+ +
+ +
=
= +
=
= +
Notations and Symbols (cont.)



+
Recall we have single message arrivals and departures:
( 1)
( 0) 1
# of departures at ~ ( ) where:
1 probability that a message is serviced
0 1
Note that tha
k
k
D k
Dk
Dk
Dk
P M p
P M p
N k N X
P N q
P N q
+
+
+
-
= =
= =
- =
= =
= =

1 1
1 0 0 1
t at 0, (0) 0
(If there is no messages in system, can't have any departures!)
Now, recall that , 0.
We want to prove that is a Markov chain.
( | ,
k D
k k k
Dk
k
k
X N
X X N M k
X
P X j X i X
+
+
+
+ +
+ + +
+
= =
- = + >
= = =
1
1 0 0 1 1
1 1
,..., )
( ( ) | , ,..., )
( ( ) ) ( ( ) ) ( , )
Note that the Markov chain is time-homogeneous!
k
k D k k k
D k k D
i X i
P X N X M j X i X i X i
P i N i M j P M N i j i p i j
+
+ + + + +
+
+ +
=
= + = = = =
= + = = = =

Characterizing Geom/Geom/1 QS
Let us now calculate the different possibilities
for p(i, j)
Note that p(i, j) = 0 for any |i - j| > 1 since we have
single arrivals and departures.
1 1
(1) 0, 0
(0, 0) ( (0) 0) ( 0) (1 )
(2) 0, 1
(0,1) (1 )
(3) 1, ( , 1) (1 )
(4) 1, ( , 1) (1 )
(5) 1, ( , ) (1 )(1 )
k D k
i j
p P M N P M p pq
i j
P p q
i P i i q p
i P i i q p
i P i i q p qp
+ +
= =
= = = = = +
= =
=
> + =
> =
> = +
Apply DT B&D MC to Geom/Geom/1 QS
0
0 0
Consider the following:
(1 )
(1 )
Consequently, we have , 1, .
A stationary distribution exists iff:
1
Define traffic intensity parameter =
For 1,
i
i
j
j
j
j
j j
p q
q p
a a
a



p

p p

p

= =
=
=
+
= = =

' '
=
=



(1 )
we must have 1
(1 )
If the arrival rate is greater than the service rate, the system will overflow!
If 1, a stationary distribution exists and is given by the Geometric distribution:
1
p q
p q
q p
P j
p

=

, 0
j
j p p >
Example
Consider a Geom/Geom/1 QS that serves
arriving messages on a first come first served
basis. Given that the service rate is 0.85
msg/slot and the message arrival rate is 0.4
msg/slot, calculate the following:
Expected number of customer in the system, E[X]
Expected number of customer in the queue, E[Q]
Expected message waiting time, E[W]
Example (cont.)
0 0
1
(1 ) 0.4 0.15 0.06
(1 ) 0.51
0.06/ 0.51 0.11765
[ ] ( ) (1 ) 0.1333 messages
1
[ ] = (1 ) ( 1) [ ] 0.0157
Little's formula: [ ] [ ], is the departure rat
n
n n
n
n
D D
p q
q p
E X P n n n
E Q n E X
E X E D

p
p
p p
p
p p p


= =

=
+
= = - =
= =
= =
= = = =

= =
=

e of the QS ( )

[ ] [ ] [ ]
1 (1 )
[ ]
[ ]
1 1
[ ] [ ] [ ] 0.15686
(1 ) (1 )
Note: Do not use Little's formula on waiting time in Geom/Geom/1 QS
p
p
E X E X E M p
q
E X
E D
p
E W E D E S
q q q
p
p p
p
p p
+
+
= + = + =

=
= = = =

Continuous Time Queueing Systems
Categories
M/M/1, M/M/m, M/M/m/N, M/M/m/m, etc.
The M/M/1 QS





1
, 0
, 1
1
( ) 1 , 0
1 , 0
i
i
j
t
i
i
P j j
W t e u t t
p

p p
p

= >
= >
=
= >
= >
. J
. J . J

. J . J

. J . J

0
1
1
2
( )
1
1
1
1
1
j
D
E X j P j
E D E X
E W E D
E Q E W
p
p

p
p

p
p

= =

= =

= =

= =

Example 1
What effect does doubling and have on L = E(X),
Lq = E(Q), E(D) and Wq = E(W) in an M/M/1 QS?
For a M/M/1 QS,
Thus, doubling and dont change . As a result,
E(X)=L and W(Q)=Lq remain the same, but E(D) and
E(W)=W
q
become half their original value.
2
, , 1
1
, W=
1
q
q q
L
X L D D
L
Q L W
p
p
p
p
p
= = = = =

= = =

Example 2
A graduate research assistant moonlights in the food
court in the student union in the evenings. He is the only
one on duty at the counter during the hours he works.
Arrivals to the counter seem to follow the Poisson
distribution with mean of 10/hr. Each customer is served
one at a time and the service time is thought to follow an
exponential distribution with a mean of 4 min.
Note: Beware of units!
Example 2
(a) What is the probability of having a queue?
P(having a queue) = P(X 2) =
2
= 4/9 = 0.44
(b) What is the average queue length?
E(Q) =
2
/(1 - ) = 1.33
(c) What is the average time a customer spends in system?
E(D) = E(X)/ = 1/( ) = 1/5 hrs = 12 mins
Example 2
(d) What is the probability of a customer spending more than 5 min in
the queue before being serviced?
(e) The graduate assistant would like to spend his idle time grading
papers. If he can grade 22 papers an hour on average when working
continuously, how many papers per hour, can he average while
working his shift?
P(server is idle) = P(system size = 0) = 1 = 1/3.
Thus, the number of papers graded = 1/3*22 = 7.33 papers per hour.



1 5
1
5
12
2
1 1 , 0
3
2
( 5min) 1 12 hrs 1 0.56
3
Thus, P(a customer waits more than 5 mins) = 1 0.56 = 0.44
t t
q
q q
W t e e t
P W W e
p
p

= = >
= = =

You might also like