ISM206: Queuing Theory Professor Kevin Ross Original Scribe – Hui Zhang

advertisement
ISM206: Queuing Theory
Professor Kevin Ross
Original Scribe – Hui Zhang
2010 Edit – Marc Mendonca
November 29, 2010
In the problem of queuing theory,there are several related processes, arriving at
the back of the queue, waiting in the queue, and being served by the server.
Some examples of such problems are:
• People choosing a line at a store.
• Packets arriving to a router/switch.
• Calls to a customer service center.
• People booking flights.
1
Some Definitions
• Service Mechanism: How customers get served.
• Service Discipline: Who gets served. eg.
– FIFO – first in first out
– LIFO – last in first out
– Random
– Prioritized
1
• Service Time: Time to complete 1 job in queue.
• Inter-arrival time: time between 2 arrivals.
• Queueing System Notation
We usually use the following notation, introduced by David G. Kendall.
a/b/c
a: Distribution of inter-arrival times.
b: Distribution of service times.
c: # of servers.
eg. M/M/1
M – Markovian/Exponential/Memoryless.
D – Deterministic/Degenerate/Constant
Ea – Erlang distance with parameter k.
G – general
Note that the Markovian implies an exponential pdf, i.e.,
fT (t) =
αe−αt t ≥ 0
0t≤0
On the other hand, the Erlang distribution has two parameters k, and α.
It follows,
fT (t) =
λk tk−1 e−αt
(k − 1)!
The Erlang distribution simplifies to an exponential distribution when the
shape parameter k equals 1. The Erlang distribution is a special case of
the Gamma distribution where the shape parameter k is an integer.
• Queue length can be finite or infinite. Analysis is easier for the infinite
case.
• State – num. customers in system.
• Buffer Length – num, customers waiting = state - (num. being served)
• N(t) – num. customers at time t
• Pn (t) – Probability that there are n customers at time t (given information
about the time.
2
• S = num. paralell servers
• λn – mean arrival time when there are n in system.
• µn – mean service rate when there are n in system
• C – combined rate of completion.
• If λn is constant it is called just λ when the service rate is constant per
server.
• Load/Utilization ρ = λ/µ:. Generally, if ρ < 1, then we can get stability
in the system.
P∞
• L – expected num. in system. L is equal to n=0 nPn
where Pn – the probability that n are in the system.
P∞
• Lq – expected num. in queue n=0 (n − s)Pn
• W – expected waiting time
• Wq – expected time in queue
2
Little’s Law
Little’s Law states that the average number of customers over some time interval
is equal to their average arrival rate, multiplied by their average time in a
stable system. Thus, the average number of customers is independent of the
probability distributions requires no assumptions about the schedule according
to which customers arrive or are serviced, or even whether they are served in
the order in which they arrive. We have,
L =
Lq
=
λW
λWq
If mean service is constant 1/µ for a ≥ 1 then W = Wq + 1/µ.
This means that if we have one of L,W ,Lq ,Wq we can calculate them all!!!
3
Common Assumptions
Arrivals follow an exponential distribution:
αe−αt t ≥ 0
fT (t) =
0t≤0
3
P (T ≤ t)
=
1 − e−αt
P (T ≥ t)
=
e−αt
Z ∞
E(T )
=
tfT (t)dt = 1/α
0
var(t)
=
ET 2 − (ET )2 = 1/α2
Is this a reasonable model? Yes, for many systems such as phone calls and
large shops. But not always.
4
Nice Properties of exponential
P (T > t + 4t|T > t)
P (T > 4t, T > t + 4t)
P (T > t)
P (T > t + 4t, T > t)
P (T > t)
P (T > t + 4t)
P (T > t)
=
=
=
e−α(t+4t)
e−αt
−α4t
= e
=
= P (T > 4t)
This implies that it does not matter how long we have been waiting, hence state
information is very simple. We only need to keep track of num. in the system.
4.1
Another Interesting Property
The mimimum of set of exponentials distributed times is also exponential,i.e.,
Let u = {min}T, . . . Tn
P (U > t)
exponential rate
X
=
P (T1 > t, T2 > t, T3 > t, . . . Tn > t)
=
P (T1 > t)P (T2 > t)P (T3 > t) . . . P (Tn > t)
=
e−α1 t e−α2 t . . . e−αn t
=
e−(α1 +α2 +...+αn )t
αi
The service times are exponential and the queue length is Poisson.
P (X(E) − n) =
4
(αt)n e−αt
n!
Think about ”what will happen first and when”.
4.2
Properties of a Poisson Process
When considering queues in infinite length, the service times is exponential, i.e.,
the length is Poisson.
P (X(t) = 0)
E(x(t))
α
= e−αt
= αt
=
arrivals per unit time
It has similar properties to that of the exponential process.
5
Example
λ0
0
λs-1
λ1
1
µ1
2
Xµ2
λs
S
µs
X=number of servers
available
µs+1
Say we have one queue and are interested in the num. of jobs waiting.
Assume all rates are independent.
Pn = probability that there are n in the system.
Eventually the system will go to a steady state.
In that state we have the following balanced equations:
µ1 P1
= λ 0 P0
λ0 P0 + µ2 P2
=
(λ1 + µ1 )P1
λ1 P1 + µ3 P3
=
(λ2 + µ2 )P2
”F lowin
= F lowout ”
Leads to Pn = Cn P0
Where:
Cn =
λn−1 + λn−2 + . . . + λ0
1
P0 = P∞
µn µn − 1 . . . µ0
n=0 Cn
More details specific to each type of system is available in the text.
5
6
Kevin’s Research
Kevin’s research looks at problems in network scheduling. It is applicable to
switches, optical storage, and Storage Area Networks.It deals with resource
allocation, parallel queue networks, forwarding queues, managiging network of
queues and service models at different prices.In any smart queuing system there
is a tradeoff between complexity and performance. The challenge is to produce
an algorithm which smoothly manages this tradeoff.
6
Worked Examples for Chapter 17
Example for Section 17.4
A queueing system has two servers whose service times are independent random
variables with an exponential distribution with a mean of 15 minutes. Customer X
arrives when both servers are idle. Five minutes later, customer Y arrives and customer
X still is being served. Another 10 minutes later, customer Z arrives and both customer
X and Y are still being served. No other customer arrived during this 15-minute
interval.
(a) What is the probability that customer X will complete service before customer
Y?
By Property 2 of the exponential distribution (the lack-of-memory property) given in
Sec. 17.4, when customer Y arrives, the remaining time until customer X completes
service has the same distribution as the service time for customer Y, so they are equally
likely to finish first. Thus, the probability that customer X will complete service before
customer Y is 0.5.
(b) What is the probability that customer Z will complete service before customer
X?
Customer Z cannot begin service until either customer X or customer Y completes
service. Given that customer Y completes service first (which has probability 0.5 from
part (a)), then the reasoning of part (a) implies that the probability that customer Z
completes service before customer X is 0.5. Therefore, the unconditional probability
that customer Z will complete service before customer X is 0.5(0.5) = 0.25.
(c) What is the probability that customer Z will complete service before customer
Y?
By the same reasoning as in part (b), the probability that customer Z will complete
service before customer Y is 0.5(0.5) = 0.25.
(d) Determine the cumulative distribution function of the waiting time in the
system for customer X. Also determine the mean and standard deviation.
We are given that customer X has not completed service after 15 minutes. By Property
2, the remaining time until service is completed still has an exponential distribution
with a mean (and standard deviation) of 15 minutes. Therefore, in units of minutes, the
CDF of the waiting time in the system for customer X is
⎧0,
for t ≤ 15
P{T ≤ t} = ⎨
−(t −15)/15
, for t ≥ 15 .
⎩1 − e
Since the remaining time after 15 minutes has a mean and standard deviation of 15
minutes, the mean of the total time is 15 + 15 = 30 minutes. The first 15 minutes are a
fixed constant, so the standard deviation of the total time continues to be the standard
deviation of the remaining time, namely, 15 minutes.
(e) Repeat part (d) for customer Y.
The reasoning is the same as for part (d), except now the given time without completing
service is 10 minutes instead of 15 minutes.
Therefore,
⎧0,
for t ≤ 10
P{T ≤ t} = ⎨
−(t −10) /15
, for t ≥ 10 .
⎩1 − e
The mean is 10 + 15 = 25 minutes and the standard deviation is 15 minutes.
(f) Determine the expected value and standard deviation of the waiting time in the
system for customer Z.
The waiting time in the system for customer Z is
W = W q + T,
where Wq is the waiting time in the queue and T is the service time. The waiting time in
the queue is the time until either customer X or customer Y completes service after
customer Z arrives. By Properties 2 and 3 in Sec. 17.4, this time until either customer X
or customer Y completes service after customer Z arrives has an exponential
distribution with a mean (and standard deviation) of
1
E Wq = 1
1 = 7.5 minutes.
+
15 15
( )
Consequently, since E (T) = 15 minutes and Var (T) = (15)2,
E( W ) = E Wq + E(T) = 7.5 + 15 = 22.5 minutes,
( )
Var ( W ) = Var ( Wq + T) = (7.5)2 + (15)2 = 281.25,
so the standard deviation of W is
281.25 = 16.77 minutes.
(g) Determine the probability of exactly 2 more customers arriving during the next
15-minute interval.
By Property 4 in Sec. 17.4, we can simply use the Poisson distribution with a mean of
E{X(t)} = αt =
1
(15) = 1
15
to find the probability of 2 arrivals,
P{X(t) = 2} =
(αt )2 e −αt
2!
=
(1)2 e −1
2
=
1
≈ 0.1839.
2e
Example for Section 17.5
Consider a single server queueing system where some potential customers balk (refuse
to enter the system) and some customers who enter the system later get impatient and
renege (leave without being served). Potential customers arrive according to a Poisson
process with a mean rate of 4 per hour. An arriving potential customer who finds n
customers already there will balk with the following probabilities:
⎧ 0,
⎪
⎪ 0.5,
P{balk | n already there} = ⎨
⎪0.75,
⎪
⎩ 1
if n = 0,
if n = 1,
if n = 2,
if n = 3.
Service times have an exponential distribution with a mean of 1 hour.
A customer already in service never reneges, but the customers in the queue
may renege. In particular, the remaining time that the customer at the front of the queue
is willing to wait in the queue before reneging has an exponential distribution with a
mean of 1 hour. For a customer in the second position in the queue, the time that she or
he is willing to wait in this position before reneging has an exponential distribution
with a mean of 1/2 hour.
(a) Construct the rate diagram for this queueing system.
The rate diagram is shown next.
(b) Obtain the steady-state distribution of the number of customers in the system.
Using the general solution for the steady-state distribution given in Sec. 17.5, we use
the following equations to obtain this distribution for this system:
λ
4
P1 = 0 P0 = P0 = 4 P0 ,
µ1
1
λλ
2(4)
P2 = 1 0 P0 =
P = 4P0
µ 2 µ1
2(1) 0
λ λλ
1(2)(4)
8
P3 = 2 1 0 P0 =
P0 = P0
µ3 µ2 µ1
(5 / 2)(2)(1)
5
8
P0 + P1 + P2 + P3 = (1 + 4 + 4 + ) P0 = 1.
5
Hence, the steady-state probability distribution is
P0 = 5/53, P1=20/53, P2 = 20/53, P3 = 8/53.
(c) Find the expected fraction of arriving potential customers who are lost due to
balking.
Using the probabilities of balking, we have
Fraction of lost customers =
1
3
33
P1 + P2 + 1P3 =
.
2
4
53
(d) Find Lq and L.
L = 1P1 + 2P2 + 3P3 =
Lq =1P2 + 2P3 =
84
= 1.585 customers.
53
36
= 0.679 customer.
53
Download