Computer Science, Informatik 4 Communication and Distributed Systems
Simulation Simulation
Modeling and Performance Analysis with Discrete-Event Simulation g y
- Dr. Mesut Güneş
Simulation Simulation Modeling and Performance Analysis with - - PowerPoint PPT Presentation
Computer Science, Informatik 4 Communication and Distributed Systems Simulation Simulation Modeling and Performance Analysis with Discrete-Event Simulation g y Dr. Mesut Gne Computer Science, Informatik 4 Communication and Distributed
Computer Science, Informatik 4 Communication and Distributed Systems
Computer Science, Informatik 4 Communication and Distributed Systems
Queueing Models
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 3
Computer Science, Informatik 4 Communication and Distributed Systems
S W i i li Calling population
Server Waiting line
S tili ti l th f iti li d d l f t
Chapter 8. Queueing Models 4
p y y q
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 5
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 6
Computer Science, Informatik 4 Communication and Distributed Systems
service, e.g., people, machines, trucks, emails. S f t th t id th t d i
repairpersons, retrieval machines, runways at airport. System Customers Server System Customers Server Reception desk People Receptionist Hospital Patients Nurses Airport Airplanes Runway Production line Cases Case-packer R d k C T ffi li h Road network Cars Traffic light Grocery Shoppers Checkout station Computer Jobs CPU disk CD
Chapter 8. Queueing Models 7
Computer Jobs CPU, disk, CD Network Packets Router
Computer Science, Informatik 4 Communication and Distributed Systems
customers being served and waiting e g model of one corporate jet if it customers being served and waiting, e.g., model of one corporate jet, if it is being repaired, the repair arrival rate becomes zero.
customers being served and waiting e g systems with large population customers being served and waiting, e.g., systems with large population
Chapter 8. Queueing Models 8
Computer Science, Informatik 4 Communication and Distributed Systems
t it i li t t th h i to wait in line to enter the mechanism.
concert ticket sales with no limit on the number
Server Waiting line
Chapter 8. Queueing Models 9
Server Waiting line
Computer Science, Informatik 4 Communication and Distributed Systems
distribution distribution.
represents the interarrival time between customer n-1 and customer n, and is exponentially distributed (with mean 1/λ) exponentially distributed (with mean 1/λ).
minus a small random amount to represent early or late arrivals minus a small random amount to represent early or late arrivals.
airport
never idle, e.g., sufficient raw material for a machine.
Chapter 8. Queueing Models 10
Computer Science, Informatik 4 Communication and Distributed Systems
e.g., machine-repair problem: a machine is “pending” when it is
the repairman.
queueing system until that customer’s next arrival to the queue e g queueing system until that customer s next arrival to the queue, e.g., machine-repair problem, machines are customers and a runtime is time to failure (TTF).
be the successive runtimes of customer i and S (i) S (i)
(i), A2 (i), … be the successive runtimes of customer i, and S1 (i), S2 (i)
be the corresponding successive system times:
Chapter 8. Queueing Models 11
Computer Science, Informatik 4 Communication and Distributed Systems
R l ft b i i th li h it i t l l
Last-in-first-out (LIFO)
Chapter 8. Queueing Models 12
Computer Science, Informatik 4 Communication and Distributed Systems
identically distributed random variables e g exponential Weibull identically distributed random variables, e.g., exponential, Weibull, gamma, lognormal, and truncated normal distribution.
Each service center consists of some number of servers, c, working in parallel, upon getting to the head of the line, a customer takes the 1st available server.
Chapter 8. Queueing Models 13
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 14
Computer Science, Informatik 4 Communication and Distributed Systems
customer requires several servers simultaneously.
Chapter 8. Queueing Models 15
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 16
Computer Science, Informatik 4 Communication and Distributed Systems
Assumption:Allways sufficient supply of
Chapter 8. Queueing Models 17
pp y raw material.
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 18
Computer Science, Informatik 4 Communication and Distributed Systems
y p q
represents the interarrival-time distribution
represents the service-time distribution
represents the number of parallel servers
represents the system capacity
represents the size of the calling population
Markov, exponential distribution
Constant, deterministic E E l di t ib ti f d k
Erlang distribution of order k
Hyperexponential distribution
General, arbitrary
Chapter 8. Queueing Models 19
G/G/1/5/5: Single server with capacity 5 and call population 5.
Computer Science, Informatik 4 Communication and Distributed Systems
steady-state probability of having n customers in system
probability of n customers in system at time t
arrival rate
effective arrival rate
service rate of one server
server utilization A i t i l ti b t t 1 d
interarrival time between customers n-1 and n
service time of the n-th arriving customer
total time spent in system by the n-th arriving customer W Q total time spent in the waiting line by customer
Q
total time spent in the waiting line by customer n
the number of customers in system at time t
the number of customers in queue at time t
long run time average number of customers in system
long-run time-average number of customers in system
long-run time-average number of customers in queue
long-run average time spent in system per customer
long-run average time spent in queue per customer
Chapter 8. Queueing Models 20
wQ long run average time spent in queue per customer
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 21
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 22
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 23
Computer Science, Informatik 4 Communication and Distributed Systems
exactly i customers, the time-weighted-average number in a system is defined by: defined by:
∞ = ∞ =
⎟ ⎠ ⎞ ⎜ ⎝ ⎛ = = 1 ˆ
i i i i
T T i iT T L
∞ T
= T i i
probability 1:
T
Chapter 8. Queueing Models 24
T ⎯
∞ →
Computer Science, Informatik 4 Communication and Distributed Systems
Number of customers in the system y Time
Chapter 8. Queueing Models 25
Computer Science, Informatik 4 Communication and Distributed Systems
Q T T Q i Q i Q
∞ → ∞
K ≥ 3).
i
=0
customers 3 . 20 ) 1 ( 2 ) 4 ( 1 ) 15 ( ˆ = + + =
Q
L
Chapter 8. Queueing Models 26
20
Computer Science, Informatik 4 Communication and Distributed Systems
N i
where W1, W2, …, WN are the individual times that each of the N
= i i
1
customers spend in the system during [0,T].
N
= ∞ →
N i Q N Q i Q
1
Chapter 8. Queueing Models 27
Computer Science, Informatik 4 Communication and Distributed Systems
i i 6 4 ) 16 20 ( ... ) 3 8 ( 2 ... ˆ
5 2 1
− + + − + + + + W W W
units time 6 . 4 5 ) 16 20 ( ... ) 3 8 ( 2 5 ... ˆ
5 2 1
= + + + = + + + = W W W w
Q
Chapter 8. Queueing Models 28
Computer Science, Informatik 4 Communication and Distributed Systems
Average System time Average # in t Arrival rate System time system
number of servers, the queue discipline, or other special circumstances).
and each arrival spends 4 6 time units in the system Hence at an and each arrival spends 4.6 time units in the system. Hence, at an arbitrary point in time, there are (1/4)(4.6) = 1.15 customers present on average.
Chapter 8. Queueing Models 29
Computer Science, Informatik 4 Communication and Distributed Systems
[0,T ].
ρ ˆ
Chapter 8. Queueing Models 30
Computer Science, Informatik 4 Communication and Distributed Systems
T Q s
Chapter 8. Queueing Models 31
Computer Science, Informatik 4 Communication and Distributed Systems
∞ →
s T s
1 < = μ λ ρ
μ
Chapter 8. Queueing Models 32
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 33
Computer Science, Informatik 4 Communication and Distributed Systems
L λ/ E(S) 1/ L W L = ρ = λ/μ, w = E(S) = 1/μ, LQ = WQ = 0
between 0 and 1.
Chapter 8. Queueing Models 34
Computer Science, Informatik 4 Communication and Distributed Systems
p p y schedules patients every 10 minutes and spends Si minutes with the i-th patient: y with service times: S1= 9, S2=12, S3 = 9, S4 = 9, S5 = 9, ….
y
⎩ ⎨ ⎧ = 1 . y probabilit with minutes 12 9 . y probabilit with minutes 9
i
S
A1 = A2 = … = λ-1 = 10. S i t h ti
utilization = ρ = λ/μ = 0.93 < 1.
long service time (S2 = 12) causes a waiting line to form
Chapter 8. Queueing Models 35
causes a waiting line to form temporarily.
Computer Science, Informatik 4 Communication and Distributed Systems
per hour per customer.
W Q is the time
p p
Q N Q j
Wj
Q is the time
customer j spends in queue
hour is:
Q j
1
=
λ ˆ
hour is:
Q Q Q
servers (1 ≤ c ≤ ∞) have utilization r, each server imposes a cost of $5 per hour while busy.
Chapter 8. Queueing Models 36
y
ρ ⋅ ⋅c 5 $
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 37
Computer Science, Informatik 4 Communication and Distributed Systems
Q di i li i FIFO
system is in a given state is not time dependent:
n n
results even when the model assumptions do not strictly hold, as a rough guide.
Chapter 8. Queueing Models 38
representation for complex systems.
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 39
Computer Science, Informatik 4 Communication and Distributed Systems
∞
=
n n
Q Q Q
Q Q Q
Chapter 8. Queueing Models 40
Computer Science, Informatik 4 Communication and Distributed Systems
S g e se e queues
a a s a d u ed capac y
steady-state parameters of M/G/1 queue:
λ 1 ρ μ λ ρ − = = P ) 1 ( 2 ) 1 ( 1
2 2 2
ρ μ σ ρ ρ ρ − + + = L P
The particular distribution is not known!
) 1 ( 2 ) / 1 ( 1
2 2
ρ σ μ λ μ − + + = w ) / 1 ( ) 1 ( 2 ) 1 (
2 2 2 2 2
λ ρ μ σ ρ − + =
Q
L
Chapter 8. Queueing Models 41
) 1 ( 2 ) / 1 (
2 2
ρ σ μ λ − + =
Q
w
Computer Science, Informatik 4 Communication and Distributed Systems
2 2 2
Q
service times.
Chapter 8. Queueing Models 42
Computer Science, Informatik 4 Communication and Distributed Systems
B k b B k l i b i Baker on average, but Baker claims to be more consistent,
customers 711 . 2 ) 5 / 4 1 ( 2 ] 400 24 [ ) 30 / 1 (
2 2
= − + =
Q
L
P0 = 1-ρ = 1/5 = 20%.
Baker: 1/μ 25 minutes and σ 2 4 minutes :
customers 097 . 2 ) 6 / 5 1 ( 2 ] 4 25 [ ) 30 / 1 (
2 2
= − + =
Q
L
P0 = 1-ρ = 1/6 = 16.7%.
Chapter 8. Queueing Models 43
Although working faster on average, Able s greater service variability results in an average queue length about 30% greater than Baker’s.
Computer Science, Informatik 4 Communication and Distributed Systems
λ
( )
1 ρ λ ρ ρ μ ρ − = =
n n
P ρ − =1 P ) 1 ( 1 1 1 λ ρ ρ λ μ λ = = − = − = w L
( )
1 ) 1 (
2 2
ρ ρ λ μ μ λ ρ μ λ μ − = − = − −
Q
L
Chapter 8. Queueing Models 44
( )
) 1 ( ρ μ ρ λ μ μ λ − = − =
Q
w
Computer Science, Informatik 4 Communication and Distributed Systems
= = 3 2 μ λ ρ Customers 2 2 3 2 = − = − = λ μ λ L ⎟ ⎞ ⎜ ⎛ = − =
1
2 2 1 3 1 1 P P ρ h 2 1 1 1 hour 1 2 2 = = = λ L w = ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ ⋅ = = ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ ⋅ =
2 2 1
4 2 1 9 3 3 P P Customers 3 4 ) 2 3 ( 3 4 ) ( hour 3 3 1
2
= = = = − = − = λ λ μ
Q Q
L w w
= ≥
= − = ⎟ ⎠ ⎜ ⎝
3 4 2
81 16 1 27 3 3
n n
P P Customers 2 3 2 3 4 3 ) 2 3 ( 3 ) ( = + = + = − − μ λ λ μ μ
Q Q
L L
Chapter 8. Queueing Models 45
n
Computer Science, Informatik 4 Communication and Distributed Systems
λ 5 6 7.2 8.64 10 ρ 0.5 0.60 0.72 0.864 1
increase as arrival rate, λ, increases from 5 to 8.64 by increments of 20%
L 1.0 1.50 2.57 6.350 ∞ w 0.2 0.25 0.36 0.730 ∞
increments of 20%
continually grow in length
14 16 18 20 L w
continually grow in length
8 10 12 14 mber of Customers
time (w) and average number in system (L) is highly nonlinear as a function of ρ.
2 4 6 Num
Chapter 8. Queueing Models 46
0.5 0.6 0.7 0.8 0.9 1 rho
Computer Science, Informatik 4 Communication and Distributed Systems
2
expected value
Chapter 8. Queueing Models 47
( ) µ cv = 1
Computer Science, Informatik 4 Communication and Distributed Systems
Q
+ = ) 1 (
2 2 2
L μ σ ρ ⎟ ⎟ ⎞ ⎜ ⎜ ⎛ + ⎟ ⎟ ⎞ ⎜ ⎜ ⎛ = − = ) ( 1 ) 1 ( 2
2 2
cv LQ ρ ρ ⎟ ⎠ ⎜ ⎝ ⎟ ⎠ ⎜ ⎝ − 2 1 ρ
L for M/M/1 LQ for M/M/1 queue
C t th M/M/1 Corrects the M/M/1 formula to account for a non-exponential service time dist’n
Chapter 8. Queueing Models 48
Computer Science, Informatik 4 Communication and Distributed Systems
distribution with mean 1/ distribution, with mean 1/μ.
λ/μ < c, where λ/(cm) = ρ is the server utilization.
1
Waiting line Calling population
λ 2
Chapter 8. Queueing Models 49
c
Computer Science, Informatik 4 Communication and Distributed Systems
μ λ ρ c = λ μ μ μ λ μ λ c c c n P
c c n n
⎪ ⎭ ⎪ ⎬ ⎫ ⎪ ⎩ ⎪ ⎨ ⎧ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ =
− − =
! 1 ! ) / (
1 1
( ) ( )
ρ ρ ρ ρ c L P P c c P c c L P
c c
≥ ∞ ⋅ − = ≥ ∞
+
) ( ) ( ) 1 ( ! ) ( ) (
1
Probability that ll
( )
λ ρ ρ ρ ρ ρ ρ L w c L P c c c P c c L = − ≥ ∞ + = − + = 1 ) ( ) 1 )( ! ( ) (
2
all servers are busy
( )
ρ ρ λ c L P LQ − ≥ ∞ ⋅ = 1 ) (
Chapter 8. Queueing Models 50
ρ c L L
Q =
−
Computer Science, Informatik 4 Communication and Distributed Systems
Probability of empty system Number of customers in system Probability of empty system Number of customers in system
Chapter 8. Queueing Models 51
Computer Science, Informatik 4 Communication and Distributed Systems
⎟ ⎞ ⎜ ⎛ + ⎟ ⎞ ⎜ ⎛ ) ( 1
2 2
cv ρ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − = 2 ) ( 1 1 cv LQ ρ ρ
LQ for M/M/1 queue
Corrects the M/M/1 formula
be approximated from those of the M/M/c/∞/∞ model. f f
servers where the total system capacity is N ≥ c customer. When an arrival
Chapter 8. Queueing Models 52
Computer Science, Informatik 4 Communication and Distributed Systems
when we want to know how many servers are required so that customers are rarely delayed
− n
μ λ
μ λ
0 =
− n
μ λ
Q
Chapter 8. Queueing Models 53
Q
Computer Science, Informatik 4 Communication and Distributed Systems
y g µ
users is infinite
p
parallel users c has to be restricted
parallel users c has to be restricted
= − =
≥ = = ≤ ∞
c n n c n n
n e P c L P
1500
95 . ! ) 1500 ( ) ) ( (
Chapter 8. Queueing Models 54
Computer Science, Informatik 4 Communication and Distributed Systems
time unit who enter and remain in the system
a a P
c N c n c n
ρ ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ + + =
− −
! ! 1
1
λ a =
P c c a P c n
c N N N n c n
ρ = ⎥ ⎦ ⎢ ⎣
− = + =
! ! !
1 1
μ λ ρ μ c =
( )
P c N c a P L
N e c N c N c Q
λ λ ρ ρ ρ ρ ρ − = − − − − − =
− −
) 1 ( ) 1 ( ) ( 1 ) 1 ( !
μ
w w L w
e Q Q
λ + = = 1
(1 - PN) probability that a customer will find a space and be able to
Chapter 8. Queueing Models 55
w L w w
e Q
λ μ = + =
space and be able to enter the system
Computer Science, Informatik 4 Communication and Distributed Systems
246 . 114 28 = = =
Q Q
L w λ
415 . 3 2 3 2 3 2 1 1
3 2 1
= ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ + + =
= − n n
P
114
e
λ
66 1
( )
123 . 65 8 1 ! 1
2 3 3 2 3
= = = = P P P
N
579 . 114 66 1 = = + = μ
Q
w w
customers in shop
65 1 ! 1
431 . =
Q
L 015 1 66 = = = w L λ
754 . 1 114 8 1 2 = = ⎟ ⎞ ⎜ ⎛ − = λ
015 . 1 65 w L
e
λ
Chapter 8. Queueing Models 56
754 . 1 65 65 1 2 ⎟ ⎠ ⎜ ⎝
e
λ
585 . 1 = = − μ λe P
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 57
Computer Science, Informatik 4 Communication and Distributed Systems
the system has a strong effect on the distribution of future arrivals.
Th ti b t th d f i i it d th t ll f i i
exponentially distributed with mean = 1/λ.
c parallel servers and system capacity is K.
K C
1
Waiting line with capacity K
2
K Customers Mean runtime
1/λ 2
Chapter 8. Queueing Models 58
c
Computer Science, Informatik 4 Communication and Distributed Systems
So e o t e steady state p obab t es o / /c/ / μ λ μ λ c c n K K n K P
K n c n c n
⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ =
− − −
! )! ( !
1 1
μ λ μ μ c n P n K P c c n K n
n c n n
⎪ ⎪ ⎨ ⎧ − = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎥ ⎦ ⎢ ⎣ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝
= =
1 ,..., 1 , , ! )! ( μ λ μ K c c n c c n K K P
n c n n
⎪ ⎪ ⎩ ⎪ ⎨ + = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − ⎠ ⎝ ⎠ ⎝ =
−
,... 1 , , ! )! ( ! μ λ ρ λ c L w nP L
e e K n n
= = =∑
=
, / ,
− =
K n e
P n K ) ( λ λ
service) xiting entering/e (or queue to customers
rate arrival effective run long the is where
e
λ
Chapter 8. Queueing Models 59
= n n e
) (
Computer Science, Informatik 4 Communication and Distributed Systems
1
⎤ ⎡
−
065 . 20 5 2 ! 2 )! 10 ( ! 10 20 5 10
1 10 2 2 1 2
= ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ − + ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ =
= − − =
n n n n n
n n P
10
machines 17 . 3 = =∑
= n n
nP L
Chapter 8. Queueing Models 60
machines 83 . 6 17 . 3 10 = − = − L K
Computer Science, Informatik 4 Communication and Distributed Systems
Chapter 8. Queueing Models 61
Computer Science, Informatik 4 Communication and Distributed Systems
the departure rate out of a queue is the same as the arrival rate into the the departure rate out of a queue is the same as the arrival rate into the queue, over the long run.
are routed to queue j upon departure, then the arrival rate from queue i
Chapter 8. Queueing Models 62
q j p p , q to queue j is λi pij over the long run.
Computer Science, Informatik 4 Communication and Distributed Systems
e o e a a a ate to queue j
i ij i j j
all
Arrival rate from outside the network Sum of arrival rates from other queues in network
long-run utilization of each server is: (where ρj < 1 for stable queue).
j
λ
for each queue j and if there are c identical servers delivering
j j j j
c μ ρ = for each queue j, and if there are cj identical servers delivering exponentially distributed service times with mean 1/μj, then, in steady state, queue j behaves likes an M/M/cj queue with arrival rate
Chapter 8. Queueing Models 63
+ =
i ij i j j
p a
all
λ λ
Computer Science, Informatik 4 Communication and Distributed Systems
C t
80 c = ∞ 0.4 Cust
Customer Population
80 c = 1 0.6 Cust. hour
40% choose self-service. 40% choose self service.
2
( ) p
ρ2 = 48/(3*20) = 0.8 ρ2 ( )
the overall rate to service center 3 is λ3 = λ1 + λ2 = 80 per hour.
Chapter 8. Queueing Models 64
ρ3 = 80/90 = 0.89
Computer Science, Informatik 4 Communication and Distributed Systems
used to estimate the performance measures of a system.
w w ρ and λ
whether to study transient behavior or steady-state behavior.
Si l f l i t f th t d t t b h i f
a rough estimate of a performance measure.
Chapter 8. Queueing Models 65