Queuing systems Chapter 5

advertisement
Chapter 5
Queuing systems
Queueing system
server 1
enter the system
some population of
individuals
server 2
according to some
random mechanism
exit the
system
server c
Depending upon the specifics of the application there are many varieties of queuing systems corresponding
combinations like
• size & nature of calling population
is it finite or a (potentially) infinite set? is it homogenous, i.e. only one type of individuals, or several
types?
• random mechanism by which the population enters
• nature of the queue
finite/ infinite
• nature of the queuing discipline
FIF0 or priority (i.e. different types of individuals get different treatment)
• number and behavior of servers
distribution of service times?
Variety of matters one might want to investigate:
• mean number of individuals in the system
• mean queue length
• fraction of customers turned away (for a finite queue length)
• mean waiting time
• etc.
71
72
CHAPTER 5. QUEUING SYSTEMS
Notation: FY /FS /c/K
FY distribution of inter arrival times Y
FS distribution of service times S
Usually, we will assume a FIFO queue.
c
number of servers
K maximum number of individuals in the system
The distributions FY and FS are chosen from a small set of distributions, denoted by:
M exponential (Memoryless) distribution
Ek Erlang k stage
D deterministic distribution
G a general, not further specified distribution
Usually, we will be interested in a couple of properties for each queuing system. The main properties are:
L
length of system on average = average number of individuals in the system
W average waiting time (time in queue and service time
Ws average service time
Wq average waiting time in queue
Lq average length of queue
The main idea of a queuing system is to model the number of individuals in the system (queue and server)
as a Birth & Death Process. This gives us a way to analyze the queuing systems using the methods from
the previous chapter.
X(t) = number of individuals in the system at time t is the Birth & Death Process we’ ll be interested in.
5.1
Little’s Law
The next theorem is based on a simple principle. However, don’t underestimate the theorem’s importance!
- It links waiting times to the number of people in the system and will be very useful in the future:
Theorem 5.1.1 (Little’s Law)
For a queuing system in steady state
L = λ̄ · W
where L is the average number of individuals in the system, W is the average time spent in the system, and
λ̄ is the average rate at which individuals enter the system.
This theorem can also be applied to the queue itself:
Lq = λ¯q · Wq
and the service center
Ls = λ¯s · Ws .
Relationship between properties
For the properties L, W, Ws , Wq , Lq there are usually two different ways to get a result: the easy and the
difficult one (involving infinite summations and similar nice stuff). To make sure, we choose the easy way of
computation, here’s an overview of the relationship between all these properties:
73
5.2. THE M/M/1 QUEUE
L = E[X(t)]
W = L/λ
WS = E[S]
5.2
Wq = W - WS
Lq = Wq λ
The M/M/1 Queue
Situation: exponential inter arrival times with rate λ, exponential service times with rate µ.
Let N (t) denote the number of individuals in the system at time t, N (t) can then be modeled using a Birth
& Death process:
λk
µk
= birth rate
= death rate
= arrival rate
= service rate
= λ for all k
= µ for all k
We’ve already seen that the ratio λ/µ is very important for the analysis of the B&D process. This ratio is
called the traffic intensity a. For a M/M/1 queuing system, the traffic intensity is constant for all k.
The previous problem of finding the steady state probabilities of the B&D process is equivalent to finding
the steady state probabilities for the number of individuals in the queuing system,
pk = lim P (N (t) = k).
t→∞
The B&D balance equations then say that
1 = p0 (1 + a + a2 + . . .)
The question whether
we have a steady state or not is the reduced to the question whether or not a < 1.
!∞
1
For a < 1 S = k=0 ak = 1−a
, then
p0
p1
p2
p3
...
pk
=
=
=
=
1−a
a(1 − a)
a2 (1 − a)
a3 (1 − a)
= ak (1 − a)
N (t) has a geometric distribution for large t!
The mean number of individuals in the queuing system L is limt→∞ E[N (t)]:
L = lim E[N (t)] =
t→∞
a
.
1−a
The closer the service rate is to the arrival rate, the larger is the expected number of people in the system.
The mean time spent in the system W is then, using Little’s Law:
W = L/λ =
1
1
·
µ 1−a
mean number in system
mean time
in system
74
CHAPTER 5. QUEUING SYSTEMS
The overall time spent in the system is a sum of the time spent in the queue Wq and the average time spent
in service Ws . Since we know that service times are exponentially distributed with rate µ, Ws = µ1 . For the
time spent waiting in the queue we therefore get
"
#
1
1
1 a
Wq = W − Ws =
−1 =
.
µ 1−a
µ1−a
The average length of the queue is, using Little’s Law again, given as
average length
of the queue
Lq = Wq λ =
server utilization rate
a2
1−a
Further we see, that the long run probability that the server is busy is given as:
p := P (server busy) = 1 − P (system empty) = 1 − p0 = a.
distribution
of time in
queue
Denote by q(t) the time that an individual entering the system at time t has to spend waiting in the queue.
Clearly, the distribution of the waiting times depends on the number of individuals already in the queue at
time t.
Assume, that the individual entering the system doesn’t have to wait at all in the queue - that happens
exactly when the system at time t is empty. For large t we therefore get:
lim P (q(t) = 0) = p0 = 1 − a.
t→∞
Think: If there are k individuals in the queue, the waiting time q(t) is Erlangk,µ (we’re waiting for k
departures, departures occur with a rate of µ). This is a conditional distribution for q(t), since it is based
on the assumption about the number of people in the queue:
q(t)|X(t) = k ∼ Erlangk,µ
for large t
We can put those pieces together in order to get the large t distribution for q(t) using the theorem of total
probability. For large t and x ≥ 0:
Fq(t) (x)
= P (q(t) ≤ x) =
total probability!
∞
$
=
P (q(t) ≤ x ∩ X(t) = k) =
=
k=0
∞
$
k=0
P (q(t) ≤ x|X(t) = k)pk =
= p0 +
∞
$
k=1
= p0 +
∞
$
k=1
=
1 − ae
(1 − P oµx (k − 1))pk =
(1 −
−x/W
,
k−1
$
j
e−µx
j=0
where W is the average time spent in the system, W =
1
µ
·
(xµ)
)pk = . . .
j!
1
1−a
=
1
µ−λ .
Example 5.2.1 Printer Queue (continued)
A certain printer in the Stat Lab gets jobs with a rate of 3 per hour. On average, the printer needs 15 min
to finish a job.
average time
in the queue
75
5.3. THE M/M/1/K QUEUE
Let X(t) be the number of jobs in the printer and its queue at time t.
We know already: X(t) is a Birth & Death Process with constant arrival rate λ = 3 and constant death rate
µ = 4.
The properties of interest for this printer system then are:
L = E[X(t)] =
Ws
W
Wq
Lq
a
0.75
=
=3
1−a
0.25
1
= 0.25 hours = 15 min
µ
L
3
=
= = 1 hour
λ
3
= W − Ws = 0.75 hours = 45 minutes
= Wq λq = 0.75 · 3 = 2.25
=
On average, a job has to spend 45 min in the queue. What is the probability that a job has to spend less
than 20 min in the queue?
We denoted the waiting time in the queue by q(t). q(t) has distribution function 1 − aey(µ−λ) . The probability
asked for is
P (q(t) < 2/6) = 1 − 0.75 · e−2/6·(4−3) = 0.4626.
5.3
The M/M/1/K queue
An M/M/1 queue with limited size K is a lot more realistic than the one with infinite queue. Unfortunately,
it’s computationally slightly harder to deal with.
X(t) is modelled as a Birth & Death Process with states {0, 1, ..., K}. Its state diagram looks like:
λ
0
λ
λ
1
λ
2
µ
µ
K
µ
µ
Since X(t) has only a finite number of states, it’s a stable process independently from the values of λ and µ.
The steady state probabilities pk are:
pk
=
= ak p0
p0
= S−1 =
1−a
1 − aK+1
where a = µλ , the traffic intensity and S = 1 + a + a2 + ... + aK =
The mean number of individuals in the queue L then is:
1−aK+1
1−a .
L = E[X(t)] = 0 · p0 + 1 · p1 + 2 · p2 + ... + K · pK =
=
K
$
k=0
kpk =
K
$
k=0
kak · p0 = ... =
a
(K + 1)aK+1
−
1−a
1 − aK+1
76
CHAPTER 5. QUEUING SYSTEMS
Another interesting property of a queuing system with limited size is the number of individuals that get
turned away. From a marketing perspective they are the ”expensive” ones - they are most likely annoyed
and less inclined to return. It’s therefore a good strategy to try and minimize this number.
Since an incoming individual is turned away, when the system is full, the probability for being turned away
is pK . The rate of individuals being turned away therefore is pK · λ.
For the expected total waiting time W , we used Little’s theorem:
W =
L
λ̄
where λ̄ is the average arrival rate into the system.
At this point we have to be careful when dealing with limited systems: λ̄ is NOT equal to the arrival rate
λ. We have to adjust λ by the rate of individuals who are turned away. The adjusted rate λa of individuals
entering the system is:
λa = λ − pK λ = (1 − pK )λ.
The expected total waiting time is then W = L/λa and the expected length of the queue Lq = Wq · λa .
Example 5.3.1 Convenience Store
In a small convenience store there’s room for only 4 customers. The owner himself deals with all the customers
- he likes chatting a bit. On average it takes a customer 4 minutes to pay for his/her purchase. Customers
arrive at an average of 1 per 5 minutes. If a customer finds the shop full, he/she will go away immediately.
1. What fraction of time will the owner be in the shop on his own?
The number of customers in the shop can be modelled as a Birth& death Process with arrival rate
λ = 0.2 per minute and µ = 0.25 per minute and upper size K = 4.
The probability (or fraction of time) that the owner will be alone is p0 =
1−a
1−aK+1
=
0.2
1−0.85
= 0.2975.
2. What is the mean number of customers in the store?
L=
a
(K + 1)aK+1
−
= 1.56.
1−a
1 − aK+1
3. What fraction of customers is turned away per hour?
p4 λ = 0.84 · 0.2975 · 0.2 per minute = 0.0243 per minute = 1.46 per hour
4. What is the average time a customer has to spend for check-out?
W =
L
= 1.56/(0.2 − 0.0243) = 8.88 minutes .
λa
For limited queueing systems the adjusted arrival rate λa must be considered for applying Little’s Law.
77
5.4. THE M/M/C QUEUE
5.4
The M/M/c queue
Again, X(t) the number of individuals in the queueing system can be modeled as a birth & death process.
The transition state diagram for the X(t) is:
λ
λ
0
λ
λ
2
1
µ
λ
2µ
K
c-1
3µ
(c-1)µ
λ
1c
cµ
cµ
Clearly, the critical thing here in terms of whether or not a steady state exists is whether or not λ/(cµ) < 1.
Let a = λ/µ and " = a/c = λ/(cµ).
The balance equations for steady state are:
p1
p2
p3
...
pc
= ap0
a2
= 2·1
p0
3
= a3! p0
=
pc+1
...
pn
= "·
ac
c! p0
= "n−c ·
ac
c! p0
for n ≥ c.
ac
c! p0
In order to get an expression for p0 , we use the condition, that the overall sum of probabilities must be 1.
This gives:


" c−1
#
!

∞
∞
!
! ak
 c−1 ak
ac ! k−c
ac 1 
.
1=
p k = p0
+
= p0 
+
"

k!
c!
c! 1 − " 
k=0 k!

k=0
k=0
k=c
'
()
*
=:S
This system has a steady state, if " < 1, in that case
p0 = S −1 .
The other probabilities pn are given as:
pn =
.
an
n! p0
an
c!cn−c p0
for 0 ≤ n ≤ c − 1
for n ≥ c
A key descriptor for the system is the probability, with which an entering customer must queue for service this is equal to the probability that all servers are busy. The formula for this probability is known as Erlang’s
C formula or Erlang’s delay formula and written as C(c, a).
Obviously, in this queueing system an entering individual must queue for service exactly then, when c or
more individuals are already in the system.
lim P (X(t) ≥ c)
t→∞
= C(c, a) =
= p0
= p0
"
∞
!
k=c
c−1
pk = 1 −
! ak
1
−
p0
k!
k=0
ac
.
c!(1 − ")
#
=
c−1
!
k=0
pk =
prob. that
entering customer must
queue
78
CHAPTER 5. QUEUING SYSTEMS
The steady state mean number of individuals in the queue Lq is
Lq
∞
!
=
k=c
= p0
overall time
in system
number in
system
c
a
c!
∞
!
∞
!
k=c
(k − c)
= p0
k"k
k=1
' () *
ak
p0 =
c!ck−c
ac
"
c! (1 − ")2
P
k #
!( ∞
k=1 ! )
"
C(c, a).
1−"
=
mean waiting time in
queue
(k − c)pk =
average number in queue
By Little’s Law
Wq = Lq /λ =
Then
1
"
1
·
C(c, a) =
C(c, a).
λ 1−"
cµ(1 − ")
W = Wq + Ws = Wq +
1
,
µ
and the overall number of individual in the system is on average
L=W ·λ=a+
"
C(c, a).
1−"
Example 5.4.1 Bank
A bank has three tellers. Customers arrive at a rate of 1 per minute. Each teller needs on average 2 min to
deal with a customer.
What are the specifications of this queue?
For this queue,λ = 1, µ = 0.5, c = 3, a = µλ = 2, and " = ac = 2/3.
The probability that no customer is in he bank then is
p0 =
" c−1
! ak
k=0
ac 1
+
k!
c! 1 − "
=
/
1+2+
4 23
1
+
·
2
3! 1 − "
0−1
=
1
.
9
"
ac
= 8/9.
c! (1 − ")2
Lq /λ = 8/9 minutes .
1
= 2 minutes.
µ
Ws + Wq = 26/9 minutes
W λ = 26/9
Lq
= p0
Wq
=
Ws
=
W =
L =
5.5
#−1
Machine-Repairmen Problems
The Machine Repairmen problems are a special case of queueing systems with non-constant arrival rates:
the arrival rate at time t depends on the state the system is in at time t.
The situation is like this:
We have K identical machines and c repairmen.
79
5.5. MACHINE-REPAIRMEN PROBLEMS
Each machine breaks down with rate λ, the time between breaks is exponentially distributed.
A single repairman can work on only one machine - each machine can be repaired by only a single repairman
at a time. The time for a repair is also exponentially distributed with rate µ.
Denote with X(t) the number of machines broken down at time t. Then, N has values between 0 and K at
any given time. X(t) can be modeled as a B&D process, the transition state diagram is:
K
0
K-1
K-c+1
K-c
...
1
c-1
K-c-1
...
c
(c-1)
c
. K-1
..
c
c
. K. .
c
This system, though there are only K + 1 possible states, is computationally tricky.
Denote by a = λ/µ the traffic intensity. The steady state probabilities are given as
1 2
p1 = Kap0
pc+1 = K−c
apc = (K − c)" Kc ac p0
c
p2 = K(K−1)
a2 p0
...
2·1
1 2
K(K−1)(K−2) 3
k−c K c
pk
= k!
p3 =
a
p
0
k a p0 for k ≥ c
c! "
3!
...
1 2 k
pk = K
k a p0 for k ≤ c
and
p0 =
" c−1 / 0
! K
k=0
k
a +
k
K
!
k!
k=c
c!
"
k−c
/ 0 #−1
K c
a
k
Once we have the steady state probabilities, we can compute the average number of machines waiting for
services, Lq , as:
K
!
Lq =
(k − c)pk
k=c+1
Example 5.5.1
A company has 3 machines that each break down at exponentially distributed intervals of mean 1 hour.
When one of these machines is down, only one repairman can work on it at a time, and while it is down the
company loses $50/hour in profit. Repairs require 1 hour on average to complete and the repair times are
exponentially distributed. Repairmen can be hired for $30/hour (and must be paid regardless of whether
there is a broken machine to work on). Do you recommend that the company employs 1 repairman or 2
repairmen? Show your whole analysis.
Let X(t) be the number of broken machines at time t. Then X(t) can be modelled by a B&D process for a)
a single repairman and b) two repairmen.
The two state diagrams are:
b)
a)
0
1
2
3
0
1
2
3
For a) the balance equations give
1 = p0 (1 + 3 + 6 + 6)
1 = p0 (1 + 3 + 3 + 1.5)
→ p0 = 0.0625
and p1 = 0.1875, p2 = p3 = 0.375
2
→ p0 =
17
6
3
6
and p1 =
, p2 =
, p3 =
17
17
17
If hiring one repairman the company loses $30 each hour. On top of that each hour down time of each
machine costs another $50. Let L be the loss per hour.
80
CHAPTER 5. QUEUING SYSTEMS
a)
E[L] = 30p0 + 80p1 + 130p2 + 180p3 =
b)
E[L] =
30 + 240 + 780 + 1080
= 133.125.
16
1
(60 · 2 + 110 · 6 + 160 · 6 + 210 · 3) = 139.412
17
With only one repairman the overall costs for the company are slightly less than with two repairmen.
Download
Study collections