Simulatio of Discrete Evet Systems Uit 9 Queueig Models Fall Witer 2014/2015 Uiv.-Prof. Dr.-Ig. Dipl.-Wirt.-Ig. Christopher M. Schlick Chair ad Istitute of Idustrial Egieerig ad Ergoomics RWTH Aache Uiversity Bergdriesch 27 52062 Aache phoe: 0241 80 99 440 email: c.schlick@iaw.rwth-aache.de
Cotets 1. Itroductio ad model specificatio 2. Performace ad dyamics 3. Simple markovia queueig systems 9-2
Focus of lecture ad exercise model static dyamic time-varyig time-ivariat liear oliear cotiuous states time-drive discrete states Focus of lecture ad exercise evet-drive determiistic stochastic discrete-time cotiuous-time 9-3
1. Itroductio ad Model Specificatio 1. Itroductio ad Model Specificatio 9-4
Approach A basic queueig system is a system, i which discrete objects of arbitrary type arrive, are queued for servig (processig) i a sigle queue that is operated uder a first-come-firstserved queueig regime, are processed i sequece, ad fially depart the system. Fuctio scheme: E = {a, d}; X = {0, 1, } Arrival of object (evet a) A(t) Queue X(t) Server (Processor) B(t) Object departure (evet d) Steps for geeralizatio of the basic model: 1. Specificatio of stochastic models for the arrival ad service processes 2. Specificatio of the structural parameters of the queueig system; for example, the storage capacity of the queue, the umber of servers ad so forth. 3. Specificatio of the operatig policies used; for example, coditios uder which arrivig objects are accepted, preferetial treatmet (prioritizatio) of some types of objects by the server ad so o. 9-5
1. Step i geeralizatio: Stochastic models for arrival ad service processes For the basic queueig model it is assumed that the timig of arrival evets a is govered by a sigle cotiuous probability distributio of iterarrival times A(t). Furthermore, the service timig is govered by a sigle cotiuous probability distributio B(t). The distributio of the waitig time ca be calculated o the basis of the state equatios. The solutio is represeted by distributio W(t). 1. Def.: - Iterarrival time: A(t) = P(Y <= t) - Expected (mea) arrival rate: = 1 / E(Y) - Service time: B(t) = P(Z <= t) - Expected service rate: = 1 / E(Z) - Waitig time: W(t) = P(W <= t) 9-6
2. Step i geeralizatio: Structural parameters 2. Def.: The storage capacity of the queue is deoted by the variable K = 1, 2,... ad specifies, how may objects ca be queued at maximum. A ifiite capacity is deoted by K =. 3. Def.: The umber of servers m = 1, 2,... deotes, how may parallel istaces of servers are available for processig of the objects i the queue. Example: 1. For the simple model we have K = ad m = 1 2. Multi-processor system with K = ad m servers: Server 1 Arrival of object (evet a) Queue 1... Object departure (evet d) m Server m 9-7
3. Step i geeralizatio: Operatig policies The operatig policies i a complex queueig system ca be categorized accordig to the followig factors: 1. Number of customer classes: I the case of a sigle-class system, all objects have the same service requiremets ad the server treats them all equally. This meas that the service time distributio is the same for all customers. I the case of a multiple-class system, objects are distiguished accordig to their service requiremets ad/or the way i which the server treats them. 2. Schedulig: I a multiple-class system, the server must decide upo a service completio of which class to process ext. For example, the server may always give priority to a particular class, or it may preempt a object i process because a higher priority object just arrived. 3. Queueig disciplies: A queueig disciplie describes the order i which the server selects objects to be processed, eve if there is oly a sigle class. For example, first-come-first-served (FCFS, like a physical queue), last-come-first-served (LCFS, like a physical stack), ad radom order. 4. Admissio policies: Eve if a queue has a ifiite storage capacity, it may be desirable to dey admissio to some arrivig objects. I the case of two arrivig classes, for istace, higher priority objects may always be admitted, but lower priority objects may oly be admitted if the queue is empty or if some amout of time has elapsed sice such a object was admitted. 9-8
The A/B/m/K Notatio 4. Def.: I the theory of queueig systems a specific stochastic queueig model is deoted by the tuple A/B/m/K, where - A represets the cotiuous probability distributio of the iterarrival time, - B represets the cotiuous probability distributio of the service time, - m is the umber of servers (or processors) preset, m = 1, 2, - K is the storage capacity of the queue (if K = the parameter is usually dropped). The probability distributios are categorized accordig to: - G: Geeral distributio whe othig else is kow about the arrival/service process - M: Markovia where the iterarrival/service times are expoetially distributed (see lecture 8) - D: Determiistic where the iterarrival/service times are costat. Examples: M/M/1: Simple Markovia queueig model of itroductory example from slide 9-5, satisfyig A(t) = 1 - e - t ad B(t) = 1 - e - t with, > 0. M/M/1/3: As before, but with fiite queue capacity of three objects. M/G/2: System with two processors ad ifiite queue capacity. The iterarrival time is expoetially distributed. The service time is stochastic but with o further costrait. 9-9
2. Performace ad Dyamics 2. Performace ad Dyamics 9-10
Performace measures 5. Def.: I order to aalyze the queueig system performace, the followig radom variables are defied: - A k : Arrival time of k-th object - D k : Departure time of k-th object - Y k = A k A k-1 : Iterarrival time betwee object k ad k-1 - W k : Waitig time of k-th object (from arrival istat util service begiig) - Z k : Service time of k-th object (from service begiig istat util service departure) - S k = D k - A k = W k + Z k : System time of k-th object (from arrival istat util service departure) - X(t): Queue legth at time t (X(t) {0, 1,...}) 6. Def.: The characteristic performace idicators of a queueig system are: - E(W): Expected (average) waitig time of the object - E(S): Expected system time of objects - E(X): Expected queue legth - System utilizatio : The fractio of time that the server is busy - Throughput : The rate at which objects leave the system after service All these quatities are cosidered i the steady queueig system state, that is, i the limit t. 9-11
System dyamics 1. Propositio: The dyamics of G/G/1 queueig systems is specified by the followig recursive state equatios: - W k = max(0, W k-1 + Z k-1 - Y k ) - S k = max(0, S k-1 - Y k ) + Z k - D k = max(a k, D k-1 ) + Z k Usually, it is assumed that the queue is iitially empty ad W 0 = 0, Z 0 = 0, S 0 = 0 ad D 0 = 0 Example: 9-12
Example of system dyamics (cotiued) Whe the k-th object arrives two cases are possible: 1. Case: The system is empty => D k-1 <= A k - Z k = D k - A k - Y k = A k - A k-1 => W k = max(0, W k-1 + Z k-1 - Y k ) = max(0, 0 + D k-1 A k-1 - A k + A k-1 ) = max(0, D k-1 - A k ) = 0, because D k - A k+1 < 0 accordig to iitial assumptio (see 4 = 0 as result of d 3 < a 4 i previous figure) => S k = Z k => D k = A k + Z k 2. Case: The system is ot empty => W k = D k-1 - A k > 0 - Z k = D k - A k W k - Y k = A k - A k-1 => W k = max(0, W k-1 + Z k-1 - Y k ) = max(0, 0 + D k-1 A k-1 - A k + A k-1 ) = max(0, D k-1 - A k ) = D k-1 - A k, because D k-1 - A k > 0 accordig to iitial assumptio => S k = S k-1 - Y k + Z k => D k = D k-1 + Z k 9-13
Little s law 2. Propositio: I a queueig system with arbitrary operatig policies ad arbitrary cofiguratios amog system queues / system servers i the steady state Little s law holds: E S E X : object arrival rate Example: I case of the G/G/1 queueig model with E = {a, d} the queue legth X(t) ca be calculated o the basis of the evet scores (t) such as X(t) = a (t) - d (t). The sample path of arrival ad departure score processes may look like: The shaded area u(t) is formed by the rectagles represetig the amout of time spet by the k-th object i the system ad therefore deotes the total amout of time all objects spet i the system by time t. 9-14
Example of Little s law (cotiued) The average system time per object is: The average queue legth is: The average object arrival rate is: st () x ut () t ut () () a t a () () t t t => x ( t) s ( t) We assume the followig limits to exist: lim ( t) =>, t lim s ( t) s t x s equivaletly we have E( X ) E( S) for a ifiite sample 9-15
3. Simple Markovia Queueig Systems 3. Simple Markovia Queueig Systems 9-16
Birth-death chai Startig poit of the aalysis is the discrete-state discrete-time birth-death chai of the previous lecture: This Markov chai ca be geeralized towards a cotiuous-time process. To do so, the birth ad death rates i steady state are cosidered; the resultig chai ca be modeled as: j 1 EY j Due to the Markov property the birth ad death processes ca be modeled o the basis of expoetial probability distributios with distict rates. 1 j E Z j 9-17
Steady state aalysis of a geeralized birth-death process 3. propositio: The state probabilities i steady state of a cotiuous-time birth-dead process with birth rates 0, 1,... ad death rates 1, 2,... are: 0 1 0 1 0 1 1 0 1 1 1 ( 1,2,...) with Please recall, for istace, that the state trasitio fuctio of M/M/1 queueig systems ca be simply writte as f(x, a) = x+1 ad f(x, d) = x-1 as log as x > 0. Thus, we may thik of a arrival evet as a birth ad a departure evet as a death, ad hece the system ca be modeled as a birth-death chai: x Server f(x, a) = x + 1 f(x, d) = x - 1 The state probabilities i the steady state of a birth-death chai therefore are equivalet to the expected umber of objects beig queued (queue legth) i the queueig system. 9-18
Steady state aalysis of M/M/1 queueig systems (I) We iitially cosider a M/M/1 system, this is a sigle-server system with ifiite storage capacity ad expoetially distributed iterarrival ad service times. Such a system ca be modeled as a birth-death chai with the followig parameters: for all 0,1,... for all 1,2,... State trasitio diagram of the M/M/1 system: Whe these parameters are plugged ito the equatios of propositio 3, the state probabilities of a M/M/1 queueig system ca be derived easily as show o the ext slide. 9-19
Steady state aalysis of a M/M/1 queueig system (II) 4. Propositio: The state probabilities i terms of a statioary probability distributio of the queue legth of a M/M/1 queueig system i steady state are: 0 1 1 1 1 1 (if 1 the geometric series coverges) 1 1 1 with [0;1]: system utilitzatio 1 5. Propositio: The performace idicators of a M/M/1 queueig system i steady state are: 1 E( W ) E( S) E( X ) 1 1 1 M / M /1 0 1 1 M / M /1 0 9-20
Example of expected system time of a M/M/1 queueig systems E(S) 1 / M / M /1 This figure illustrates the tradeoff betwee keepig the utilizatio high (good for the ower of a productio system) ad keepig the average system time low (good for the customer waitig for delivery). As the utilizatio icreases, the expected system time is iitially isesitive to chages (the slope is close to 0). It the suddely becomes very sesitive (as the slope rapidly approaches ifiity). A good operatig area is determied by a idividual weightig of the costs of uderutilized machies ad delays i service. 9-21
Steady state aalysis of M/M/m systems (I) Whe cosiderig a M/M/m system a object is served by ay oe available server. If all servers are busy, the object is queued util the ext departure frees a server. The effective service rate depeds o the state of the system. If there are < m objects preset, the there are servers busy ad the service rate is. If >= m objects are preset, the service rate is fixed at its maximum value m. Therefore, we model the system as a birth-death chai with these birth ad death parameters: for all 0,1,... if 1 m m if m State trasitio diagram of the M/M/m system: 9-22
9-23 6. Propositio: The state probabilities of a M/M/m queueig system i steady state are: 1 1 0 1 0 0 1 1!! 1 1,2,..., 1!, 1,...! m m m m m m m m m m m m Steady state aalysis of M/M/m systems (II)
Steady state aalysis of M/M/m systems (III) 7. Propositio: The performace idicators of a M/M/m queueig system i steady state are: EW ( ) ES ( ) M / M / m M / M / m 1 E( X ) m m m m 0 m! m(1 ) 1 1 m 0 m! m(1 ) m m 2 m 0 m! (1 ) 2 ( average umber of busy servers) 2 ( at steady state arrival ad departure rates must be balaced ) 9-24
Example of expected system time of a M/M/m queueig system E(S) m=1 m=2... 1 / m=10 M / M / m Clearly, if additioal servers support the processig, the tradeoff betwee keepig the utilizatio high ad keepig the average system time low is shifted towards a higher system utilizatio. 9-25
Steady state aalysis of M/M/ systems (I) Fially, the M/M/ queueig system is aalyzed as a special case of the M/M/m system. If the queue capacity is ifiite, the previous case differetiatio cocerig the umber of objects i relatio to the umber of servers is ot ecessary ad we simply have: for all 0,1,... for all 1,2,... State trasitio diagram of the M/M/ system: 9-26
Steady state aalysis of M/M/ systems (II) 8. Propositio: The state probabilities of a M/M/ queueig system i steady state are equal to the statioary state probabilities of a Poisso process with the poit desity parameter (utilizatio as expected umber of busy servers): 0 1 1 e 1! e ( Poisso distributio, 1,2,...)! Numerical distributio example for poit desity = 5: ( 5) 9-27
Steady state aalysis of M/M/ systems (III) 9. Propositio: The performace idicators of a M/M/ queueig system i steady state are: EW ( ) 0 1 ES ( ) E( X ) ( X represets the umber of busy servers) M / M / M / M / 1e ( arrival ad departure rates must be balaced) 9-28
Expected system time of M/M/ queueig systems E(S) 1 / M/ M/ 9-29
Refereces CASSANDRAS, C.,G.; LAFORTUNE, S. (2007): Itroductio to Discrete Evet Systems. 2 d editio. Bosto (MA): Kluwer Academic Publishers. PAPOULIS, A.; PILLAI, S.U. (2002): Probability, Radom Variables ad Stochastic Processes. Forth Editio. Bosto (MA): Mc Graw Hill. 9-30
Questios? Ope Questios??? 9-31