Computer Science, Informatik 4 Communication and Distributed Systems
Simulation Techniques
- Dr. Mesut Güneş
Simulation Techniques Dr. Mesut Gne Computer Science, Informatik 4 - - PowerPoint PPT Presentation
Computer Science, Informatik 4 Communication and Distributed Systems Simulation Techniques Dr. Mesut Gne Computer Science, Informatik 4 Communication and Distributed Systems Chapter 7 Queueing Models Computer Science, Informatik 4
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 3 Chapter 7. Queueing Models
Server Waiting line Calling population
Computer Science, Informatik 4 Communication and Distributed Systems 4 Chapter 7. Queueing Models
Computer Science, Informatik 4 Communication and Distributed Systems 5 Chapter 7. Queueing Models
service, e.g., people, machines, trucks, emails.
repairpersons, retrieval machines, runways at airport. Router Packets Network CPU, disk, CD Jobs Computer Checkout station Shoppers Grocery Traffic light Cars Road network Case-packer Cases Production line Runway Airplanes Airport Nurses Patients Hospital Receptionist People Reception desk Server Customers System
Computer Science, Informatik 4 Communication and Distributed Systems 6 Chapter 7. Queueing Models
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
Computer Science, Informatik 4 Communication and Distributed Systems 7 Chapter 7. Queueing Models
to wait in line to enter the mechanism.
Server Waiting line Server Waiting line
Computer Science, Informatik 4 Communication and Distributed Systems 8 Chapter 7. Queueing Models
distribution.
represents the interarrival time between customer n-1 and customer n, and is exponentially distributed (with mean 1/λ).
minus a small random amount to represent early or late arrivals.
airport
never idle, e.g., sufficient raw material for a machine.
Computer Science, Informatik 4 Communication and Distributed Systems 9 Chapter 7. Queueing Models
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., machine-repair problem, machines are customers and a runtime is time to failure (TTF).
(i), A2 (i), … be the successive runtimes of customer i, and S1 (i), S2 (i)
be the corresponding successive system times:
Computer Science, Informatik 4 Communication and Distributed Systems 10 Chapter 7. Queueing Models
Computer Science, Informatik 4 Communication and Distributed Systems 11 Chapter 7. Queueing Models
identically distributed random variables, e.g., exponential, Weibull, gamma, lognormal, and truncated normal distribution.
parallel, upon getting to the head of the line, a customer takes the 1st available server.
Computer Science, Informatik 4 Communication and Distributed Systems 12 Chapter 7. Queueing Models
Computer Science, Informatik 4 Communication and Distributed Systems 13 Chapter 7. Queueing Models
customer requires several servers simultaneously.
Computer Science, Informatik 4 Communication and Distributed Systems 14 Chapter 7. Queueing Models
Computer Science, Informatik 4 Communication and Distributed Systems 15 Chapter 7. Queueing Models
Assumption:Allways sufficient supply of raw material.
Computer Science, Informatik 4 Communication and Distributed Systems 16 Chapter 7. Queueing Models
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
Erlang distribution of order k
Hyperexponential distribution
General, arbitrary
Computer Science, Informatik 4 Communication and Distributed Systems 17 Chapter 7. Queueing Models
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
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
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 queue
long-run average time spent in system per customer
long-run average time spent in queue per customer
Computer Science, Informatik 4 Communication and Distributed Systems 18 Chapter 7. Queueing Models
Time Number of customers in the system
Computer Science, Informatik 4 Communication and Distributed Systems 19 Chapter 7. Queueing Models
exactly i customers, the time-weighted-average number in a system is defined by:
probability 1:
∞ = ∞ =
⎟ ⎠ ⎞ ⎜ ⎝ ⎛ = = 1 ˆ
i i i i
T T i iT T L
∞ = T i i
T T
∞ →
Computer Science, Informatik 4 Communication and Distributed Systems 20 Chapter 7. Queueing Models
K > 3).
customers 3 . 20 ) 1 ( 2 ) 4 ( 1 ) 15 ( ˆ = + + =
Q
L
Q T T Q i Q i Q
∞ → ∞ =
cusomters 15 . 1 20 / 23 20 / )] 1 ( 3 ) 4 ( 2 ) 12 ( 1 ) 3 ( [ ˆ = = + + + = L
Computer Science, Informatik 4 Communication and Distributed Systems 21 Chapter 7. Queueing Models
where W1, W2, …, WN are the individual times that each of the N customers spend in the system during [0,T].
=
N i i
1
1
N Q Q i Q i
=
units time 6 . 4 5 ) 16 20 ( ... ) 3 8 ( 2 5 ... ˆ
5 2 1
= − + + − + = + + + = W W W w
Computer Science, Informatik 4 Communication and Distributed Systems 22 Chapter 7. Queueing Models
number of servers, the queue discipline, or other special circumstances).
and each arrival spends 4.6 time units in the system. Hence, at an arbitrary point in time, there is (1/4)(4.6) = 1.15 customers present on average.
Arrival rate Average System time Average # in system
Computer Science, Informatik 4 Communication and Distributed Systems 23 Chapter 7. Queueing Models
[0,T].
ρ ˆ
Computer Science, Informatik 4 Communication and Distributed Systems 24 Chapter 7. Queueing Models
T Q s
Computer Science, Informatik 4 Communication and Distributed Systems 25 Chapter 7. Queueing Models
∞ →
s T s
1 < = μ λ ρ
Computer Science, Informatik 4 Communication and Distributed Systems 26 Chapter 7. Queueing Models
Computer Science, Informatik 4 Communication and Distributed Systems 27 Chapter 7. Queueing Models
L = ρ = λ/μ, w = E(S) = 1/μ, LQ = WQ = 0.
and 1.
Computer Science, Informatik 4 Communication and Distributed Systems 28 Chapter 7. Queueing Models
schedules patients every 10 minutes and spends Si minutes with the i-th patient:
A1 = A2 = … = λ-1 = 10.
utilization = ρ = λ/μ = 0.93 < 1.
with service times: S1= 9, S2=12, S3 = 9, S4 = 9, S5 = 9, ….
long service time (S2 = 12) causes a waiting line to form temporarily.
⎩ ⎨ ⎧ = 1 . y probabilit with minutes 12 9 . y probabilit with minutes 9
i
S
Computer Science, Informatik 4 Communication and Distributed Systems 29 Chapter 7. Queueing Models
per hour per customer.
hour is:
servers (1 ≤ c ≤ ∞) have utilization r, each server imposes a cost of $5 per hour while busy.
Q N j Q j
1
=
Wj
Q is the time
customer j spends in queue
λ ˆ
Q Q Q
ρ ⋅ ⋅c 5 $
Computer Science, Informatik 4 Communication and Distributed Systems 30 Chapter 7. Queueing Models
system is in a given state is not time dependent:
results even when the model assumptions do not strictly hold, as a rough guide.
representation for complex systems.
n n
Computer Science, Informatik 4 Communication and Distributed Systems 31 Chapter 7. Queueing Models
Computer Science, Informatik 4 Communication and Distributed Systems 32 Chapter 7. Queueing Models
∞ =
n n
Q Q Q
Computer Science, Informatik 4 Communication and Distributed Systems 33 Chapter 7. Queueing Models
steady-state parameters of M/G/1 queue:
) 1 ( 2 ) / 1 ( ) 1 ( 2 ) / 1 ( 1 ) 1 ( 2 ) 1 ( ) 1 ( 2 ) 1 ( 1
2 2 2 2 2 2 2 2 2 2
ρ σ μ λ ρ σ μ λ μ ρ μ σ ρ ρ μ σ ρ ρ ρ μ λ ρ − + = − + + = − + = − + + = − = =
Q Q
w w L L P
The particular distribution is not known!
Computer Science, Informatik 4 Communication and Distributed Systems 34 Chapter 7. Queueing Models
service times.
2 2 2
Q
Computer Science, Informatik 4 Communication and Distributed Systems 35 Chapter 7. Queueing Models
Baker on average, but Baker claims to be more consistent,
= 20%.
1/6 = 16.7%.
average queue length about 30% greater than Baker’s.
customers 711 . 2 ) 5 / 4 1 ( 2 ] 400 24 [ ) 30 / 1 (
2 2
= − + =
Q
L customers 097 . 2 ) 6 / 5 1 ( 2 ] 4 25 [ ) 30 / 1 (
2 2
= − + =
Q
L
Computer Science, Informatik 4 Communication and Distributed Systems 36 Chapter 7. Queueing Models
( ) ( ) ( )
) 1 ( ) 1 ( 1 1 1 1 1
2 2
ρ μ ρ λ μ μ λ ρ μ λ μ ρ ρ λ μ μ λ ρ ρ λ μ λ ρ ρ μ λ ρ − = − = − = − = − = − = − = − = − = =
Q Q n n
w w L L P ρ − =1 P
Computer Science, Informatik 4 Communication and Distributed Systems 37 Chapter 7. Queueing Models
= ≥
= − = = ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ ⋅ = = ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ ⋅ = = − = = =
3 4 2 2 1 1
81 16 1 27 4 3 2 3 1 9 2 3 2 3 1 3 1 1 3 2
n n
P P P P P ρ μ λ ρ Customers 2 3 2 3 4 Customers 3 4 ) 2 3 ( 3 4 ) ( hour 3 2 3 1 1 1 hour 1 2 2 Customers 2 2 3 2
2
= + = + = = − = − = = − = − = = = = = − = − = μ λ λ μ μ λ μ λ λ μ λ
Q Q Q
L L L w w L w L
Computer Science, Informatik 4 Communication and Distributed Systems 38 Chapter 7. Queueing Models
increase as arrival rate, λ, increases from 5 to 8.64 by increments of 20%
continually grow in length
time (w) and average number in system (L) is highly nonlinear as a function of ρ.
λ 5,0 6,0 7,2 8,6 10,0 ρ 0,5 0,6 0,7 0,9 1,0 L 1,0 1,5 2,6 6,4 ∞ w 0,2 0,3 0,4 0,7 ∞
2 4 6 8 10 12 14 16 18 20 0.5 0.6 0.7 0.8 0.9 1 Number of Customers rho L w
Computer Science, Informatik 4 Communication and Distributed Systems 39 Chapter 7. Queueing Models
expected value
cv=1
2
Computer Science, Informatik 4 Communication and Distributed Systems 40 Chapter 7. Queueing Models
⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − = − + = 2 ) ( 1 1 ) 1 ( 2 ) 1 (
2 2 2 2 2
cv LQ ρ ρ ρ μ σ ρ
LQ for M/M/1 queue
Corrects the M/M/1 formula to account for a non-exponential service time dist’n
Computer Science, Informatik 4 Communication and Distributed Systems 41 Chapter 7. Queueing Models
distribution, with mean 1/μ.
where λ/(cμ) = ρ is the server utilization.
1
Waiting line
2 c
Calling population
λ
Computer Science, Informatik 4 Communication and Distributed Systems 42 Chapter 7. Queueing Models
( ) ( ) ( )
ρ ρ ρ λ ρ ρ ρ ρ ρ ρ ρ ρ λ μ μ μ λ μ λ μ λ ρ c L L c L P L L w c L P c c c P c c L c P c c L P c c c n P c
Q Q c c c c n n
= − − ≥ ∞ ⋅ = = − ≥ ∞ ⋅ + = − + = − = ≥ ∞ ⎪ ⎭ ⎪ ⎬ ⎫ ⎪ ⎩ ⎪ ⎨ ⎧ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ = =
+ − − =
1 ) ( 1 ) ( ) 1 )( ! ( ) ( ) 1 ( ! ) ( ) ( ! 1 ! ) / (
2 1 1 1
Probability that all servers are busy
Computer Science, Informatik 4 Communication and Distributed Systems 43 Chapter 7. Queueing Models
Probability of empty system Number of customers in system
Computer Science, Informatik 4 Communication and Distributed Systems 44 Chapter 7. Queueing Models
be approximated from those of the M/M/c/∞/∞ model.
servers where the total system capacity is N ≥ c customer. When an arrival
⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − = 2 ) ( 1 1
2 2
cv LQ ρ ρ
LQ for M/M/1 queue
Corrects the M/M/1 formula
Computer Science, Informatik 4 Communication and Distributed Systems 45 Chapter 7. Queueing Models
customers are rarely delayed
− − Q Q n n
μ λ μ λ
μ λ
Computer Science, Informatik 4 Communication and Distributed Systems 46 Chapter 7. Queueing Models
users is infinite
parallel users c has to be restricted
= − =
≥ = = ≤ ∞
c n n c n n
n e P c L P
1500
95 . ! ) 1500 ( ) ) ( (
Computer Science, Informatik 4 Communication and Distributed Systems 47 Chapter 7. Queueing Models
time unit who enter and remain in the system
( )
w L w w L w P c N c a P L P c c a P c a n a P
e Q e Q Q N e c N c N c Q c N N N c n N c n c n c n
λ μ λ λ λ ρ ρ ρ ρ ρ ρ = + = = − = − − − − − = = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ + + =
− − − − = + = −
1 ) 1 ( ) 1 ( ) ( 1 ) 1 ( ! ! ! ! 1
1 1 1
(1-PN) probability that a customer will find a space and be able to enter the system
Computer Science, Informatik 4 Communication and Distributed Systems 48 Chapter 7. Queueing Models
customers in shop
( )
123 . 65 8 1 ! 1
2 3 3 2 3
= = = = P P P
N
415 . 3 2 3 2 3 2 1 1
3 2 1
= ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ + + =
= − n n
P
431 . =
Q
L
754 . 1 65 114 65 8 1 2 = = ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ − =
e
λ
246 . 114 28 = = =
e Q Q
L w λ
579 . 114 66 1 = = + = μ
Q
w w
015 . 1 65 66 = = = w L
e
λ 585 . 1 = = − μ λe P
Computer Science, Informatik 4 Communication and Distributed Systems 49 Chapter 7. Queueing Models
the system has a strong effect on the distribution of future arrivals.
exponentially distributed with mean = 1/λ.
1
Waiting line
2 c
K Customers
λ
Computer Science, Informatik 4 Communication and Distributed Systems 50 Chapter 7. Queueing Models
μ λ ρ λ μ λ μ λ μ λ μ λ c L w nP L K c c n c c n K K c n P n K P c c n K K n K P
e e K n n n c n n n K c n n c n c n n
= = = ⎪ ⎪ ⎩ ⎪ ⎪ ⎨ ⎧ + = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − − = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = ⎪ ⎭ ⎪ ⎬ ⎫ ⎪ ⎩ ⎪ ⎨ ⎧ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ =
= − − = − − =
, / , ,... 1 , , ! )! ( ! 1 ,..., 1 , , ! )! ( !
1 1
=
− =
K n n e
P n K ) ( λ λ
service) xiting entering/e (or queue to customers
rate arrival effective run long the is where
e
λ
Computer Science, Informatik 4 Communication and Distributed Systems 51 Chapter 7. Queueing Models
065 . 20 5 2 ! 2 )! 10 ( ! 10 20 5 10
1 10 2 2 1 2
= ⎪ ⎭ ⎪ ⎬ ⎫ ⎪ ⎩ ⎪ ⎨ ⎧ ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ − + ⎟ ⎠ ⎞ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ =
− = − − =
n n n n n
n n P
machines 17 . 3
10
= =∑
= n n
nP L machines 83 . 6 17 . 3 10 = − = − L K
Computer Science, Informatik 4 Communication and Distributed Systems 52 Chapter 7. Queueing Models
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 to queue j is λi pij over the long run.
Computer Science, Informatik 4 Communication and Distributed Systems 53 Chapter 7. Queueing Models
long-run utilization of each server is ρj=λj /(cμj) (where ρj < 1 for stable queue).
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
i ij i j j
all
Arrival rate from outside the network Sum of arrival rates from other queues in network
+ =
i ij i j j
p a
all
λ λ
Computer Science, Informatik 4 Communication and Distributed Systems 54 Chapter 7. Queueing Models
40% choose self-service.
ρ2 = 48/(3*20) = 0.8
the overall rate to service center 3 is λ3 = λ1 + λ2 = 80 per hour.
ρ3 = 80/90 = 0.89
Customer Population
80 c = ∞ c = 1 0.4 0.6 cust hour
Computer Science, Informatik 4 Communication and Distributed Systems 55 Chapter 7. Queueing Models
to estimate the performance measures of a system.
whether to study transient behavior or steady-state behavior.
a rough estimate of a performance measure.