Modeling & Simulation
Modeling & Simulation
Outline
Introduction. Study of different queues types:
M/M/1 queue. M/M/s queue. M/M/1/c queue.
Introduction
In this lecture we will calculate the different performance measures for some queues types. Note that all these parameters are calculated under the steady state conditions.
j = ,
j0
0 = 0, j = ,
j 1
...
j-1
j+1
4
0 1 j 1 j cj = = 12 j
From Balance equations:
1 = 0 , 2 = 0 , ,
2
j = 0
j
The Hashemite University 5
1 =0 +1 +2 + + j + 1 =0 (1 + + + + +)
2 j
1+ + + + + = 1/1
j
Therefore:
0 = (1 ) j = (1 ),
j The Hashemite University
j 1
L of M/M/1 Queues
L is the expected number of entities in the system.
L = j =0 j P ( j entities in system)
= j =0 j j = j =0 j j (1 )
= (1 ) j =1 j
j 1
d = (1 ) j j =1 d
8
Lq of M/M/1 Queues
Lq is the expected number of entities in the queue.
Lq = j =1 ( j 1) P ( j entities in system)
= j =1 ( j 1) j = j =1 j j j =1 j
= L (1 0 ) = L
Littles Formula I
W is the expected waiting time in the system this includes the time in the line and the time in service. Wq is the expected waiting time in the queue. W and Wq can be found using the Littles formula. (explain it!!)
L = W Lq = Wq
L 1 W= =
10
Littles Formula II
Lets understand this formula using a simple example rather than proving it mathematically:
Assume that every customer pays 1 dollar per unit time it stays in the system. Also, assume that the customer will pay the total amount of dollars when leaving the system. You want to calculate the total amount of dollars paid by all customers per unit time (which is equal to the number of customers currently in the system). Remember each customer will stay in the system for W time units. At equilibrium: flow in = flow out, also W reaches somehow a constant value (mean value). So, W = L (dollars = number of customers). The same is applied for Wq.
The Hashemite University 11
1 W=
L = W = 1 Wq = W = ( ) 2 Lq = Wq = ( )
12
There are s servers. Customers arrive according to a Poisson process with rate , = , j 0 j Service time for each entity is exponential with rate . Let = /s
0 = 0 j = j, j s = s, j > s
13
j-1
1
2
.. .. s s-1 s+1 . . ( s 1) s s
j
s
j+1
Thus
( s ) j = 0, j!
j j
js
( s ) j = 0 , j = s, s + 1, s + 2,... j s s! s
The Hashemite University
14
0 =
1 ( s ) ( s ) j=0 j! + s!(1 )
s 1 j s
15
( s ) s P( j s) = j = 0 s!(1 ) j=s
This probability is used to find L,Lq, W, Wq The following table gives values of this probabilities for various values of and s
16
17
L = Lq +
P( j s) 1 W = = + = + s L Lq 1
The Hashemite University 18
Maximum service rate of the system is number of servers times service rate per server
The Hashemite University 19
j = , j = 0,
j c 1 jc
0 = 0 j = , j 1
1 0 = c+ 1 1
j = 0 , j =0,
j
j c j >c
The Hashemite University 21
(1 ( c +1) + c L= c+ 1 (1 )( 1 )
c
c+ 1
Lq = L (1 0 )
(1 (c +1) + c = c +1 (1 )(1 )
c
The Hashemite University
c +1
(1 ) c +1 1
22
23
L W= (1 c ) Wq = Lq
(1 c )
24
Notes
In Kendalls notations also you must specify the queue discipline (FCFS, LCFS, etc.). If no discipline is specified as we have explored in this lecture then the discipline is FCFS by default. M in Kendalls notation refers exactly to Markovian which is the memoryless property of the exponential distribution. Studying the queue behavior of non-markovian queues is very hard and sometimes there is no closed from solution for the different queue parameters.
25
26
Queuing Networks I
A queueing network is a collection of many queues with some paths between them. In other words it is a multi-stage queue discipline. Example:
C hildren and A dults C hildren
1
A dults
3
27
Queuing Networks II
For a queueing network you may interested in:
The whole network (or system): here you need to find closed form equations to describe the behaviour of the network. or may be you are interested in one queue from it: here you can apply the previous equations we have studied, all what you is to define the correct value of both the arrival and service rates.
28
Example I
Customers arrive at a fast food restaurant at a rate of 100 per hour and take 30 seconds to be served. How much time do they spend in the restaurant?
- Service rate = = 60/0.5=120 customers per hour - W = 1/ = 1/(120-100) = 1/20 hrs = 3 minutes
Example II
30
Example III
You have the following queueing network of four M/M/1 queues labeled as 1, 2, 3, and 4. jobs arrive from outside at a rate of (job/hour) for both queues 1 and 2, jobs leaves queue 1 enters queue 3 as you see while jobs leaves from queue 2 and enter queue 3 with probability of 0.35 and enter queue 4 with probability of 0.65. Find all the performance parameters of queue 3 (i.e. given that average service time of this queue = 15 second.
The Hashemite University 31
0.6 5
Example IV
33
Example IV -- Solution
34
35
36
Additional Notes
It is your task to find the source for this material. This is the last lecture included in the first exam material.
37