0% found this document useful (0 votes)
6 views

Queuing System in Simulation

Uploaded by

Su Gaam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Queuing System in Simulation

Uploaded by

Su Gaam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Pramod Parajuli

Simulation and Modeling, CS-331

Chapter 8
Queueing Systems

a l
ep
itn
1
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

1
Queueing Systems

A queueing system consists of one or more servers


that provide service of some kind to arriving
customers
If the servers are busy, the customers join one or
more queues in front of the servers, hence
queueing system
System Servers Customers
Bank Tellers Customers
Hospital Doctors, Nurses, beds Patients
Computer System CPU, I/O devices Jobs
Manufacturing systems Machines, Workers Parts

a l
Airport Runways, Gates Airplanes, travelers

ep
Communications network Nodes, links Messages, Packets

itn
2
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

2
Queueing Systems

State of the system; the number of units in the


system
Queues that grow without bound are known as
explosive or unstable queues
Queueing system includes; the server, the unit being
services (?), and units in the queue
Simulation time is determined by simulation clock
Queue status
Not empty Empty

l
Busy Enter queue Enter queue

a
Server

ep
status Idle Impossible Enter service

itn
3
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

3
Queueing Systems

Departure
event

Begin Another
server idle unit
Remove the waiting
time
NO waiting? YES unit from the queue

Begin servicing the


Arrival unit
Event

l
NO Server YES

a
busy?

ep
Unit enters
Unit enters

itn
queue for 4
service
service
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

4
Characteristics of Queueing Systems

The calling population


-The population of potential customers
-In systems with a large population of potential
customers, the calling population is considered to be
infinite
-Although the population in finite, if very small fraction of
the potential customers are served by the system,
then the population is supposed to be infinite
System capacity
-Number of customers waiting in the queue is limited
The arrival process

a l
Queue behavior and descipline

ep
Service times and service mechanism

itn
5
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

5
Components Queueing Systems

-Arrival process (pattern)


-Service mechanism
-Queue discipline

a l
ep
itn
6
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

6
Arrival Process

The simulation time start when first customer arrives


to the system
The arrival time is random and hence inter-arrival
time is also random

Customer Inter-arrival time Arrival time on clock


1 - 0
2 2 2
3 4 6
4 1 7
5 2 9

a l
6 6 15

ep
itn
7
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

7
Arrival Process

If arrivals vary stochastically, it is necessary to


define the probability function of the inter-arrival
times
Two or more arrivals may be simultaneous. If n
variables are simultaneous, then n-1 of them have
zero inter-arrival times

Notation;
Ta Mean inter-arrival time
λ Mean arrival time

a l
1

ep
They are related as; λ =
Ta

itn
8
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

8
Arrival Process

Example - office;
- five days a week
- Eight-hour day
- 800 calls a week
- Model the office using time scale of minutes
1 week = 40 working hours. Therefore inter-arrival time
= (40 * 60) / 800
= 3 minutes
i.e. 0.333 calls per minute

- In infinite population model, the arrival rate is not

a l
affected by the number of customers

ep
- If the arrival process is homogenous (no rush-hours)

itn
then arrival is linear 9
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

9
Arrival Process

On the other hand, the arrival time is very much


uncertain and hence its distribution is important

Let’s define A0(t) be the arrival distribution to be


defined as; (different writers use different notations)

It is the probability that an inter-arrival time is


greater than ‘t’
Again, if the cumulative distribution function F(t) is
the probability that an inter-arrival time is less
than t, then

l
A0(t) = 1 – F(t)

a
ep
Therefore, takes maximum value of ‘1’ at t = 0

itn
10
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

10
Poisson Arrival Patterns

Often used to model arrival processes with constant


arrival rates
Gives the number of events that occur in a given period
Probability of an arrival in an interval dt is
proportional to dt
If is the mean number of arrivals per unit time,
then probability of an arrival in dt is
λ.∆t
Therefore, PDF of inter arrival time is given by;

a l
f (t ) = λ .e − λt (t >= 0)

ep
itn
11
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

11
Poisson Arrival Patterns

In other words, a probability function is said to have


poisson pattern if
 e −α α x
 , x = 0,1, L
p ( x) =  x!
0 , otherwise

• Where α is the mean rate and must be positive
• E(X) = V(X) = α

a l
ep
itn
12
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

12
Poisson Arrival Patterns
f (t )
So now, arrival distribution will be; A=
λ
− λt
A0 (t ) = e A=
λ.e −λt
λ
A = e − λt
Here, λ is mean no. of arrivals per unit time and
arrivals in a period of time ‘t’ is again a random
variable.
So now, probability of ‘n’ arrivals occurring in a
period of length ‘t’ is given by (exponential)
(λt ) n e − λt
p ( n) =
n!

a l
ep
itn
13
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

13
Poisson Arrival Patterns

Example;
Arrival Arrival Inter-arrival Arrival Arrival Inter-
Number Time Time Number Time arrival time
1 12.5 12.5 11 136.4 21.4
2 15.1 2.6 12 142.7 6.3
3 44.1 29.0 13 151.2 8.5
4 62.6 18.5 14 162.5 11.3
5 65.3 2.7 15 167.2 4.7
6 67.6 2.3 16 172.9 5.7
7 71.0 3.4 17 179.8 6.9
8 92.5 21.5 18 181.6 1.8

l
9 106.5 14.0 19 185.0 3.4

a
ep
10 115.0 8.5 20 194.9 9.9

itn
14
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

14
Poisson Arrival Patterns

Example;
The inter arrival time is ranging from 1.8 to 29.0.
Look at graph plot at page 149 of text book.
Taking the average of the inter arrival time;
9.74
1
Therefore, estimated arrival rate is = λ =
Ta
= 0.103
Now, let’s group the time period into 10 different
range of size 20

a l
ep
itn
15
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

15
Poisson Arrival Patterns

Example;
Time Period No. of Arrivals Time Period No. of Arrivals
0-20 2 100-120 2
20-40 0 120-140 1
40-60 1 140-160 2
60-80 4 160-180 4
80-100 1 180-200 3

λ= 0.103, t = 20, and value of p(n) for n = 0, 1,

l
2, 3, 4, 5 will be;

a
ep
itn
16
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

16
Poisson Arrival Patterns

Example;
No. of arrivals Actual No. of p(n) Expected
in 20 mins Occurrences number of
occurrences
0 1 0.128 1.3
1 3 0.266 2.7
2 3 0.272 2.7
3 1 0.187 1.9
4 2 0.096 1.0
5 0 0.040 0.4

Compare the values in 2nd and 4th column

a l
ep
itn
17
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

17
Poisson Arrival Patterns

Example;
Number of people logging onto a computer per minute is
Poisson Distributed with mean 0.7
What is the probability that 5 or more people will log onto
the computer in the next 10 minutes?
Solution?

Must first convert the mean to the 10 minute period – if mean is 0.7 in
1 minute, it will be (0.7)(10) = 7 in a ten minute period

P(X >= 5) = 1 – P(0) – P(1) – P(2) – P(3) – P(4)


= 1 – F(4) (where F is the cdf)

a l
= 1 – 0.173 (from the table in the text)

ep
= 0.827

itn
18
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

18
The Exponential Distribution

A random variable is said to be exponentially distributed


with λ > 0 if its pdf is given by
λe − λx , x ≥ 0
f ( x) = 
0 , otherwise
Since the exponent is negative, the pdf will decrease as x
increases
λ is the arrival rate: number of occurrences per time unit
Ex: arrivals per hour; failures per day
Note that 1/λ can thus be considered to be the time between
events or the duration of events
Ex: 10 arrivals per hour Æ 1/10 hr (6min) average between

l
arrivals

a
ep
Ex: 20 customers served per hour Æ 1/20 hr (3min) average
service time

itn
19
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

19
The Exponential Distribution

The CDF of exponential distribution is given by;


y = 1 − e − λt after solving; λt = − ln(1 − y )
Since y is representing cumulative distribution, the
term (1-y) gives values between 0 and 1
Within the range of 0-1, the natural logarithm gives
–ve value
If numbers y are uniformly distributed, the numbers
1-y are also uniformly distributed
− ln( y )
t= = −Ta ln( y )
λ

la
ep
It shows that exponential distribution is dependent
on mean value

itn
20
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

20
The Exponential Distribution

The significance about Ta is that it is in multiplicative


form. Numbers with any mean can be derived
from a generator of mean value 1 by multiplying
its output by the required mean

1 1
E( X ) = V (X ) =
λ λ2
0 , x < 0
F ( x) =  x −λt
∫0
− λx
λe dt = 1 − e , x≥0

a l
ep
itn
21
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

21
The Exponential Distribution

Example – Generation;
Let’s consider we have 5 random numbers ‘y’ in the range
(0,1). The numbers are 0.135, 0.639, 0.424, 0.010,
0.843
Given λ = 3.8
1/ λ = 1/3.8

The numbers we get are;


0.526, 0.118, 0.226, 1.213, 0.045

a l
ep
itn
22
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

22
Coefficient of Variation

Applies to arrival times


Ratio of standard deviation of the inter-arrival time
to the mean arrival time
Zero value means no variation. If the coefficient
increases the data become more dispersed
If exponential distribution of mean value is T and
standard deviation is also T, then variance is 1
i.e. if the variance is close to 1, then the
exponential distribution may fit the data. In
such case, chi-square test should be carried out
to test the level of significance

a l
ep
itn
23
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

23
Erlang Distribution

- Originally derived to analyze telephone traffic


- PDF of such distribution is given by;
− kλt
 e  k −1
f (t ) = (kλ ) 
k
t
 (k − 1)!
- And arrival distribution will be;
k −1
( kλ t ) n
A0 (t ) = e − kλt .∑
n =0 n!
 k −1 e − kθ x (kθ x) i
1 − ∑ , x>0
F ( x) =  i =0 i!
0 , x ≤ 0

a l

ep
Where k is a positive integer

itn
24
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

24
Erlang Distribution

Setting k=1, gives exponential distribution.


Standard deviation of Erlang Distribution = T/k1/2
Therefore coefficient of variation is = 1/k1/2
If k > 1, the data cluster around the mean value
If k = ∞, the distribution will be step function
If variation coefficient of variation is significantly less than 1,
it is desirable to represent the data using Erlang
distribution for which ‘k’ is closest to the value (T/s)2
In general terms, there are ‘k’ stages that an entity have to
pass and total time required is ‘T’ then,
1 1 1 1 1
E ( x) = + + + ...... +

a l
λ λ λ λ λ

ep
k-terms

itn
25
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

25
Erlang Distribution

If β is average time delay of each ‘k’ constituent


exponential distributions, then kβ is the average value
of the Erlang distribution.
In this case;
k
1  1  k −1 −t / β
f (t ) = .  .t .e
(k − 1)!  β 
If k = 1, then
1
f (t ) = .e −t / β
β
i.e. exponential distribution

a l
ep
itn
26
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

26
Erlang Distribution

Example - Generation;
- Generate ‘k’ random samples from an exponential
distribution with mean time of β
- Add all of the terms

float prod = 1.0;


for(counter = 0; counter < k; counter++){
rn = generateRandom(seed);
prod *= rn;
}
return –beta * ln(prod);

a l
ep
itn
27
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

27
Erlang Distribution

Exercise 5.21
Time to serve a customer at a bank is exponentially
distributed with mean 50 sec
1. Probability that two customers in a row will each
require less than 1 minute for their transaction
2. Probability that the two customers together will
require less than 2 minutes for their transactions
For 1) we are looking at the probability that each of two
independent events will be < 1 minute
In this case, the probability overall is the product of the two
probabilities, each of which is exponential

l
λ = rate = 1/mean = 1/50

a
ep
We want P(X < 60) = F(60) = 1 – e-(1/50)(60) = 0.6988
Thus the total probability is (0.6988)2 = 0.4883

itn
28
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

28
Erlang Distribution

For 2) we are looking at the probability that two


events together will be < 2 minutes
In this case the probability overall is an Erlang distribution
with k = 2 and kθ = 1/50, and we want to determine
P(X < 120) = F(120)
Substituting into our equation for F, we get
2 −1 − (120 / 50 ) i
e (120 / 50)
F (120) = 1 − ∑
i =0 i!
= 1 − (0.0907) − (0.2177) = 0.6916

a l
ep
itn
29
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

29
Hyper Exponential Distribution

If a set of data have two different exponential patterns, then


it known as hyper-exponential distribution
T
s 2s

T
1− s
2(1 − s )

Here, mean service time for first server = T/2s


mean service time for second server = T/2(1-s)
0 < s <= ½
And therefore, the arrival pattern

a l
−2 sλt −2 (1− s ) λt
A0 (t ) = se + (1 − s )e

ep
itn
30
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

30
Hyper Exponential Distribution

The variance
(1 − 2 s + 2 s ) 2
k=
2 s (1 − s )
when s = ½, k becomes 1 and hence gives exponential
distribution

Steps;
- Generate exponentially distributed rn from uniformly distributed
random number with mean value of 1
- Compare the second uniformly distributed random number to ‘s’
- If less than s, multiply by T/2s

a l
- Else multiply by T/2(1-s)

ep
itn
31
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

31
Service Times

Normally, service time of a process is constant


But if it varies stochastically, it is described by a
probability function
Ts = Mean service time
µ = mean service rate
S0(t) = Probability that service time > t
Normally, exponential distribution is used to
represent the service time but if the service time
is fluctuating by large variance, it is represented
by normal distribution

a l
ep
itn
32
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

32
Service Times

Articulated by specifying the number of servers


(denoted by s) whether each sever has its own
queue or there is one queue feeding all servers
and probability distribution of customers’ service
times
If Si is the service time of the ith arriving customer,
E(S) is the mean service time of the customer
then service rate of the server is
= 1/E(S)
Example : Class demonstration (from page 210 of Banks,
Carson, Nelson, Nicol)

a l
ep
itn
33
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

33
Normal Distribution

A random variable X with mean µ (-∞ < µ < ∞) and


variance σ2 > 0 has a normal distribution if it has
the pdf
2
1  x−µ 
1 − 
2 σ 

f ( x) = e ,−∞ < x < ∞
σ 2Π
In normal form
1 −z2 / 2
f ( z) = .e

a l
ep
itn
34
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

34
Normal Distribution

-Property;

67%

93%

99%

µ − 3σ µ − 2σ µ −σ µ +σ µ + 2σ µ + 3σ
µ

a l
ep
itn
35
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

35
Normal Distribution
To generate numbers distributed according to f(z), we use
x = z . σ + µ, z = standard normal variate

If r1 and r2 are two uniform random numbers in the range (0, 1), then to
generate random samples from a standardized normal distribution is
to use ‘Box Mueller Transformation’;

z = (−2. ln r1 ) . cos(2πr2 )
1/ 2

For a set of several uniformly distributed random numbers,


standard deviation of this equation reaches normal distribution as k
approaches infinity
xi = uniformly distributed random numbers
k
k
∑ xi −
2
k = small values of k give good accuracy (normally 12)
12
y = i =1 1/ 2
y = ∑ xi − 6.0

a l
k 

ep
  i =1
 12 

itn
36
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

36
Normal Distribution

The random numbers xi are generated using inverse


transformation method
A more accurate method can be;
Given two independent uniform variates, the method
generates two outputs which are independent and is
from a normal distribution with a mean of 0 and
deviation of 1. It provides more accuracy than the
previous one

X 1 = (−2 ln U1 )1/ 2 . cos 2πU 2


X 2 = (−2 ln U1 )1/ 2 . sin 2πU 2
In this case, the numbers X1 and X2 will be IID

a l
(independent and identically distributed)

ep
itn
37
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

37
Queueing Notation

Standard notation
A/B/c/N/K

A – preresents interarrival-time distribution


B – represents the service-time distribution
A and B can follow any distribution
D : Constant or deterministic
M : Exponential or Markov
Ek : Erlang of order k
G : Arbitrary or General
H : Hyper exponential
GI : General independent

a l
ep
itn
38
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

38
Queueing Notation

c – represents the number of parallel servers


N – represents the system capacity
Could be "infinite" if the queue can grow arbitrarily large (or at least
larger than is ever necessary)
Ex: a queue to go up the Eiffel Tower
Space could be limited in the system
Ex: a bank or any building

This can affect the effective arrival rate, since some arrivals may have
to be discarded

K – represents the size of the calling population


- How large is the pool of customers for the system?

a l
- It could be some relatively small, fixed size

ep
Ex: The computers in a lab that may require service

itn
39
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

39
Queueing Notation

It could be very large (effectively infinite)


Ex: The cars coming upon a toll booth
The size of the calling population has an important effect on
the arrival rate
If the calling population is infinite, customers that are
removed from the population and enter the queueing
system do not affect the arrival rate of future customers
(∞-1 = ∞)
If the calling population is finite, removal of customers from
the population (and putting them into and later out of
the system) must affect future arrival rates
Ex: In a computer lab with 10 computers, each has a 10%

a l
chance of going down in a given day. If a computer

ep
goes down, the repair takes a mean of 2 days

itn
40
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

40
Queueing Notation

In the first day, the expected number of failures is 10*0.1=1


However, once a failure occurs, the faulty computer is out of
the calling population, so the expected number of
failures in the next day is 9 * 0.1 = 0.9
Clearly this changes again if another computer fails

a l
ep
itn
41
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

41
Queueing Notation

Example;
1. there are ‘s’ servers in parallel and one FIFO queue feeding all
servers
2. A1, A2, . . . are IID random variables
3. S1, S2, . . . are IID random variables
4. Ai’s and Si’s are independent
Such system is represented by GI/G/s queue
GI – distribution of Ai
G – distribution of Si

M/M/1/∞/∞
Here, the interarrival time and service time are exponentially
distributed, the server is of single-server, the system have

a l
infinite capacity and infinite population of potential arrivals

ep
This kind of server often represented by M/M/1

itn
42
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

42
Queueing Disciplines

The queueing discipline describes in which order next entity


is selected from the queue for service

- FIFO – first in first out


- LIFO – Last in first out
- SIRO – service in random order
- SPT – shortest processing time first
- PR – service according to priority

The order of picking entities from the queue does not


mean that the entities will leave the system in the
same order. This is all because of random service

a l
time for each entity

ep
itn
43
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

43
Queueing Disciplines

Sometimes, the entity may leave the queue even before


being served. Such process is known as ‘reneging’.
The rules for reneging must be defined clearly
If an entity refuses to join the queue (because the queue is
relatively long), the process is known as ‘balking’
If there are multiple lines i.e. queues but a single server, the
entities are selected by the process of polling
In case of priority queue, if the recently arrived entity have
the greatest priority, then the new arrival will interrupt or
preempt the service

a l
ep
itn
44
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

44
Measure of Performance for Queues

Let Ta be mean arrival time, Ts be mean service time, λ be


arrival rate, and µ be service rate then;
The ratio of mean service time to the mean inter-arrival time
is called the traffic intensity (u)
u = Ts / Ta
Let’s denote rate of all of the arrivals (including loses) by λ’
and λ to denote arrival rate of entities that are served.
In this case;
u = λ’.Ts
And server utilization (ρ) is defined as;
ρ = λ’.Ts = λ / µ

a l
If ‘n’ number of servers;

ep
ρ = λ / (n.µ)

itn
45
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

45
Measure of Performance for Queue

Notations for parallel server systems


Pn steady state probability of having ‘n’ customers
in system
Pn(t) Probability of ‘n’ customers in system at time ‘t’
λ Arrival rate
λe Effective arrival rate
µ Service rate of one server
ρ Server utilization
An Inter-arrival time between customers ‘n-1’ and
‘n’
Sn Service time of the nth arriving customer

a l
ep
itn
46
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

46
Measure of Performance for Queue

Notations for parallel server systems


Wn Total time spent in system by the nth arriving
customer
or W Mean time to complete service (including the
wait for service)
WnQ Total time spent in the waiting line by customer
‘n’
L(t) The no. of customers in system at time ‘t’
or Ww Mean time spent waiting for service to begin
LQ(t) The no. of customers in queue at time ‘t’
L Long-run time-average no. of customers in

l
system (Mean no. of entities in the system)

a
ep
itn
47
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

47
Measure of Performance for Queue

Notations for parallel server systems


LQ Long-run time-average no. of customers in queue
or Lw Mean number of entities in the waiting line
W Long-run average time spent in system per customer
wQ Long-run average time spent in queue per customer

The probability that an entity will have to wait more than a


given time is known as delay distribution
P(t)- Probability that the time to complete the service is
greater than ‘t’
Pw(t)-Probability that the time spent waiting for service to

a l
begin is greater than ‘t’

ep
itn
48
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

48
Mathematical Solutions of Queuing Problems

Some times, the queuing problems can be


formulated by some mathematical solutions

Single server, poisson arrival


The mean number of entities in the system when ρ < 1
are;
ρ (2 − ρ )
L= Constant
2(1 − ρ )
ρ
L= Exponential
1− ρ
2kρ − ρ 2 (k − 1)
L= Erlang

a l
2k (1 − ρ )

ep
ρ 2 + ρ (1 − ρ )4 s (1 − s )
L= Hyper-Exponential

itn
4 s (1 − s )(1 − ρ ) 49
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

49
Mathematical Solutions of Queuing Problems

In above cases, the total number of entities waiting for


service (Lw), mean times spent waiting for service to
begin (W), and mean times spent waiting for service
to be completed (Ww) can be derived as;
Lw = L − ρ
L
W= = L.Ta
λ
Lw
Ww = = LwTa
λ

a l
ep
itn
50
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

50
Time-Average Number in the System, L

Given a queueing system operating for some period of


time, T, we'd like to determine the time-
L(t)
weighted average number of people in the
system, T3
3

T2 T2
2

T1 T1 T1 T1
1

al
ep
T0 T0

itn
51
0 2 4 6 8 10 12 14 16 20 t
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

51
Time-Average Number in the System, L

We'd also like to know the time-weighted average


number of people in the queue,
Note that for a single queue with a single server, if the
system is always busy,

However, it is not the case when the server is idle


part of the time

The "hats" indicate that the values are "estimators"


rather than analytically derived long-term values

a l
ep
itn
52
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

52
Time-Average Number in the System, L

We can calculate L for an interval [0,T] in a fairly
straightforward manner using a sum

∧ 1
L=
T
∑ iT
i=0
i

Note that each Ti here represents the total time that


the system contained exactly i customers
These may not be contiguous
‘i’ is shown going to infinity, but in reality most
queuing systems (especially stable queuing
systems) will have all Ti = 0 for i > some value

al
In other words, there is some maximum number in the

ep
system that is never exceeded

itn
53
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

53
Time-Average Number in the System, L

Let's think of this value in another way:


Consider the number of customers in the system at
any time, t
L(t) = number of customers in system at time t
This value changes as customers enter and leave the
system
We can graph this with t as the x-axis and L(t) as the
y-axis
Consider now the area under this plot from [0, T]
It represents the sum of all of the customers in the system
over all times from [0, T], which can be determined with
an integral

a l
T
Area = ∫ L(t ) dt

ep
0

itn
54
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

54
Time-Average Number in the System, L

Now to get the time-average we just divide by T,


or ∞
∧ 1 1 T
L = ∑ iTi = ∫ L(t ) dt
T i =0 T 0
For many stable systems, as T Æ∞ ∧ (or, practically
speaking, as T gets very large) L approaches L,
the long-run time-average number of customers
in the system
However, initial conditions may determine how large T must
be before the long-run average is reached

The same principles can be applied to L Q , the time-

l
average number in the queue, and LQ, the long-run

a
ep
time average number in the queue

itn
55
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

55
Time-Average Number in the System, L

From fig. in slide no. 51,


L̂ = [0(3) + 1(12) + 2(4) + 3(1)] / 20
= 23/20
= 1.15 customers

a l
ep
itn
56
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

56
Average Time in System Per Customer, w

This is also a straightforward calculation during


our simulations
N
∧ 1
w=
N
∑W
i =1
i

where N is the number of arrivals in the period [0,T]


where each Wi is the time customer i spends in the system
during the period [0,T]
If the system is stable, as N Æ ∞ , ŵ Æ w
w is the long-run average system time
We can do similar calculations for the queue alone to
get the values ŵQ and wQ

l
We can think of these values as the observed delay and the

a
long-run average delay per customer

ep
Example: from 216 - Nicol

itn
57
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

57
Average Time in System Per Customer, w

For simple queueing systems such as those we have been


examining, stability can be determined in a fairly
easy way
The arrival rate, λ, must be less than the service rate i.e.
customers must arrive with less frequency than
they can be served
Consider a simple single queue system with a single server
(G/G/1/∞/∞)
– Define the service rate to be µ
– This system is stable if λ < µ
If λ > µ, then, over a period of time there is a net rate of
increase in the system of λ – µ

a l
This will lead to increase in the number in the system

ep
(L(t)) without bound as t increases

itn
58
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

58
Average Time in System Per Customer, w

Note if λ == µ some systems (ex: deterministic) may be


stable while others may not be

If we have a system with multiple servers (ex:


G/G/c/∞/∞) then it will be stable if the net
service rate of all servers together is greater
than the arrival rate
If all servers have the same rate µ, then the
system is stable if λ < cµ

a l
ep
itn
59
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

59
Average Time in System Per Customer, w

Note that if our system capacity or calling population (or


both) are fixed, our system can be stable even if the
arrival rate exceeds the service rate
Ex: G/G/c/k/∞
With a fixed system capacity, in a sense the system is
unstable until it "fills" up to k. At this point, excess
arrivals are not allowed into the system, so it is
stable from that point on
The idea here is that the net arrival rate decreases
once the system has filled
Ex: G/G/c/∞/k
With a fixed calling population, we are in effect restricting the

a l
arrival rate

ep
As arrivals occur, the arrival rate decreases and the system again
becomes stable

itn
60
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

60
Conservation Law

An important law in queueing theory states


L = λw
where L is the long-run number in the system, λ is
the arrival rate and w is the long-run time in
the system
Often called "Little's Equation"
This holds for most queueing systems

a l
ep
itn
61
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

61
Server Utilization

What fraction of the time is the server busy?


Clearly it is related to the other measures we have
discussed (we will see the relationship shortly)
As with our other measures we can calculate this for
a given system (G/G/1/∞/∞)
∧ 1 ∞
ρ = ∑ Ti
T i =1
We assume that if at least 1 customer is in the
system, the server will be busy (which is why we
start at T1 rather than T0)

a l
However, we can also calculate the server utilization

ep
based on the arrival and service rates

itn
62
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

62
Server Utilization

G/G/1/∞/∞ systems
Consider again the arrival rate λ and the service rate
µ
Consider only the server (without the queue)
With a single server, it can be either busy or idle
If it is busy, there is 1 customer in the "server
system", otherwise there are 0 customers in the
"server system" (excluding the queue)
Thus we can define Ls = ρ = average number of
customers in the "server system"
Using the conservation equation this gives us
Ls = λsws

a l
where λs is the rate of customers coming into the server and

ep
ws is the average time spent in the server

itn
63
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

63
Server Utilization

For the system to be stable, λs = λ , since we


cannot serve faster than customers arrive
and if we serve more slowly the line will
grow indefinitely
The average time spent in the server is simply 1/µ
(i.e. 1/(rate of the server))
Putting these together gives us
ρ = Ls = λsws = λ (1/µ) = λ/µ
Note that this indicates that a stable queueing
system must have a server utilization of less
than 1
The closer we get to one, the less idle time for the server, but

a l
the longer the lines will be (probably)

ep
Actual line length depends a lot not just on the rates, but also
on the variance

itn
64
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

64
Server Utilization

G/G/c/∞/∞ systems
Applying the same techniques we did for the
single server, recalling that for a stable
system with c servers:
λ < cµ
we end up with the the final result
ρ = λ/cµ

al
ep
itn
65
(C) Pramod Parajuli, 2004

cs
Source: www.csitnepal.com

65

You might also like