Using the M/G/1 queue under processor sharing for exact simulation of queues

12
Ann Oper Res DOI 10.1007/s10479-013-1408-2 Using the M/G/1 queue under processor sharing for exact simulation of queues Karl Sigman © Springer Science+Business Media New York 2013 Abstract In Sigman (J. Appl. Probab. 48A:209–216, 2011b), a first exact simulation al- gorithm was presented for the stationary distribution of customer delay for FIFO M/G/c queues in which ρ = λ/μ < 1 (super stable case). The key idea involves dominated coupling from the past while using the M/G/1 queue under the processor sharing (PS) discipline as a sample-path upper bound, taking advantage of its time-reversibility properties so as to be able to simulate it backwards in time. Here, we expand upon this method and give several examples of other queueing models for which this method can be used to exactly simulate from their stationary distributions. Examples include sojourn times for single-server queues under various service disciplines, tandem queues, and multi-class networks with general routing. Keywords Exact simulation · Queueing theory · Processor sharing 1 Introduction In Sigman (2011b) the first simulation algorithm for sampling exactly from the stationary distribution of the FIFO M/G/c queue was presented in which, however, it was assumed that ρ = λ/μ < 1 (super stable case; stability only requires ρ<c). It involves the method of dominated coupling from the past (see Propp and Wilson 1996 and Kendall 2004, for example) using as a sample-path upper bound the workload of the M/G/1 queue under the processor sharing (PS) discipline while exploiting its time-reversibility properties. This al- gorithm has the nice property that its termination time has finite k th moment if the service time S has finite k + 1 moment. A different algorithm handling the general ρ<c case was recently presented in Sigman (2011a), but it uses different methods (regenerative cycles, and simulating in forward time) and has the unfortunate property that the expected termination time is always infinite. Our purpose here, then, is to expand upon and exploit the first method K. Sigman ( ) Department of Industrial Engineering and Operations Research, Columbia University, New York, NY 10027, USA e-mail: [email protected]

Transcript of Using the M/G/1 queue under processor sharing for exact simulation of queues

Ann Oper ResDOI 10.1007/s10479-013-1408-2

Using the M/G/1 queue under processor sharingfor exact simulation of queues

Karl Sigman

© Springer Science+Business Media New York 2013

Abstract In Sigman (J. Appl. Probab. 48A:209–216, 2011b), a first exact simulation al-gorithm was presented for the stationary distribution of customer delay for FIFO M/G/c

queues in which ρ = λ/μ < 1 (super stable case). The key idea involves dominated couplingfrom the past while using the M/G/1 queue under the processor sharing (PS) discipline asa sample-path upper bound, taking advantage of its time-reversibility properties so as to beable to simulate it backwards in time. Here, we expand upon this method and give severalexamples of other queueing models for which this method can be used to exactly simulatefrom their stationary distributions. Examples include sojourn times for single-server queuesunder various service disciplines, tandem queues, and multi-class networks with generalrouting.

Keywords Exact simulation · Queueing theory · Processor sharing

1 Introduction

In Sigman (2011b) the first simulation algorithm for sampling exactly from the stationarydistribution of the FIFO M/G/c queue was presented in which, however, it was assumedthat ρ = λ/μ < 1 (super stable case; stability only requires ρ < c). It involves the methodof dominated coupling from the past (see Propp and Wilson 1996 and Kendall 2004, forexample) using as a sample-path upper bound the workload of the M/G/1 queue under theprocessor sharing (PS) discipline while exploiting its time-reversibility properties. This al-gorithm has the nice property that its termination time has finite kth moment if the servicetime S has finite k + 1 moment. A different algorithm handling the general ρ < c case wasrecently presented in Sigman (2011a), but it uses different methods (regenerative cycles, andsimulating in forward time) and has the unfortunate property that the expected terminationtime is always infinite. Our purpose here, then, is to expand upon and exploit the first method

K. Sigman (�)Department of Industrial Engineering and Operations Research, Columbia University, New York, NY10027, USAe-mail: [email protected]

Ann Oper Res

to apply it to other queueing models of interest. Even for single-server queues, for example,the method is useful since it leads to an exact simulation algorithm for stationary sojourntime under any work-conserving discipline for the M/G/1 queue, and has the nice prop-erty of a fast termination time. Other examples (admittedly under the very restrictive “superstability” condition ρ < 1) include tandem queues, and more generally, even multi-classnetworks with general routing.

2 The M/G/1 processor sharing (PS) queue

The M/G/1 PS queue has Poisson arrivals at (assumed known) rate λ, and a (assumedknown) service-time distribution G(x) = P (S ≤ x), x ≥ 0, with (assumed known) mean 0 <

E(S) = 1/μ < ∞. It is assumed stable, that is, that ρ = λ/μ < 1. Under the PS discipline,all customers enter service upon arrival and are serviced simultaneously: whenever there aren ≥ 1 customers in the system (hence all in service), each are processed at the same rate 1/n.There is no “queue”; customers do not wait in a line. (Such a model is used, for example, asan approximation for the way a WEB server processes jobs, and similarly in other computerprocessing applications.) See, for example, Sect. 5.7.3, Page 278 in Ross (1996).

If both the service time distribution G(x) = P (S ≤ x), x ≥ 0, and its equilibrium distri-bution,

Ge(x) = μ

∫ x

0P (S > y)dy, x ≥ 0, (1)

can be simulated from, then the PS stationary distribution can be simulated exactly, and thusits time-reversal can be simulated. We review these facts next.

Letting L(t) denote the number of customers in system, and Y1(t), . . . , YL(t)(t), the corre-sponding remaining service times, it is known that the stationary distribution of the Markovprocess {

X(t) : t ≥ 0} = {(

L(t), Y1(t), . . . , YL(t)(t)) : t ≥ 0

}(2)

is of the form

(L,Y1, . . . , YL), (3)

where the {Yj } are iid distributed as Ge and independently L has a geometric distribution,P (L = k) = ρk(1 − ρ), k ≥ 0. Simulating a copy of (3) can thus be accomplished by firstsimulating a copy of L (easy since L has a geometric distribution with assumed knownparameter ρ) and then simulating L iid copies from Ge defined in (1). Further simulationover time (discrete-event simulation) of the PS model also requires copies of service timesS ∼ G.

The total work in system (the sum of all remaining service times in the system at time t ),

V (t) =L(t)∑j=1

Yj (t), t ≥ 0,

is the same for all work-conserving disciplines (such as FIFO, PS, last-in-first-out (LIFO),shortest job first, random selection, and so on), and its stationary distribution is given by

V =L∑

j=1

Yj , (4)

Ann Oper Res

which, in terms of rvs, is just the classic Pollaczek-Khintchine formula (see, for example,Sect. 8-2, Page 386 in Wolff 1989 and Theorem 5.7, Page 237 in Asmussen 2003 for thebasics of M/G/1 queues).

Actually, the Yj (t) can be modeled as either the age of the service times in service, or theremaining service times (and we usually assume that the Yj (t) are in ascending order). If weassume that they are the remaining service times, then it is also known that if the system isstarted off distributed as in (3), then the time-reversal of {X(t)} is the same Markovian PSmodel in which arrivals are Poisson at rate λ, service times are iid distributed as G, and theYj (t) are now the ages (see for example, Pages 278–280 in Ross 1996).

Actually (explained later in Step 1 of the PS Algorithm) to utilize the PS model for ourpurposes in the present paper, we will need to simulate from the stationary spread distribu-tion Gs of G defined by having tail

Gs(x) = μxG(x) + Ge(x), x ≥ 0, (5)

where F (x) = P (X > x) denotes the tail of a distribution F(x) = P (X ≤ x).The stationary spread distribution Gs is the distribution of the interarrival time covering

a random time t chosen way out in the infinite future in a renewal point process with cycle-length distribution G. It is stochastically larger than G as a result of the so-called inspectionparadox. In the case when G has a density g(x), so does Gs and it is given by gs(x) =μxg(x), which vividly displays the length biasing from the inspection paradox. If we let(Y,B) denote a random vector with the joint stationary age and excess for a renewal processhaving iid inter arrival times distributed as G, then it has joint tail P (Y > y,B > x) =Ge(x + y). For the purpose of simulation, if S∗ is distributed as Gs , and independently U isUnif (0,1), then we can construct (Y,B) via setting (Y,B) = (US∗, (1 −U)S∗). Thus beingable to simulate from Gs gives us the ability to simulate from Ge as a byproduct with nosignificant additional complexity.

3 The basic idea behind the PS Algorithm

Here we give the basics of our algorithm which we shall refer to as the PS Algorithm.The basic set up is that we have a queueing model M, represented by a positive recurrentMarkov process {M(t) : t ≥ 0} (general state space), with an empty state 0, and stationarydistribution π , that uses the same input (of arrival times and service times) as the M/G/1PS model, {X(t) : t ≥ 0}, and is such that if both models are initially started empty at sometime s, M(s) = X(s) = 0, then at any time t > s, M(t) = 0 if X(t) = 0: Whenever the PSmodel empties, so does M. Our objective is to use this kind of set up to output a randomelement M∗ having the desired stationary distribution π .

The algorithm works as follows: We first assume that both models were started initiallyempty at time t = −∞, so that they are both in stationarity at time t = 0; M(0) is distributedas π , and X(0) is distributed as in (3). We will construct a version of this M(0), and then setM∗ = M(0). To this end, observe that because of the assumed set up, it holds on the timeinterval (−∞,0] that M(t) = 0 whenever X(t) = 0. Walking backwards in time from theorigin, we simulate the PS model (e.g., we simulate its time-reversal) to “detect” a time point−τ ≤ 0 when M empties by observing the first time −τ that the PS model empties. For then,we can reconstruct the sample path of M starting empty at that time point −τ , forwards intime up to time t = 0 so as to obtain M(0). The input used to do the reconstruction is thetime-reversed departure process (departure times and service times associated with those

Ann Oper Res

departures) of the PS model. By the Markov property, given that M(−τ) = 0, this input isindependent of the past before time −τ (e.g, “the past is independent of the future given thepresent state”). Thus we can use this input to construct an identically distributed version ofthe desired M(0).

In Sigman (2011b), when M is the FIFO multi-server model with c ≥ 2 servers, theway in which it is derived that M(t) = 0 if X(t) = 0 is to consider total workload (denotedby V1(t) for the PS model, and Vc(t) for the multi-server model), in which case the PSworkload serves as a sample-path upper bound. Hence whenever the PS model empties(because the workload does), so does the multi-server model (Sigman 2011b). The followingis Proposition 1.1 in Sigman (2011b):

Proposition 1 Let V1(t) denote total work in system at time t for the FIFO M/G/1 queue,and let Vc(t) = ∑c

i=1 V (i, t) denote total work in system at time t for the correspondingFIFO M/G/c queue, where V1(0) = Vc(0) = 0 and both are fed exactly the same input ofPoisson arrivals and iid service times. Then

P(Vc(t) ≤ V1(t), for all t ≥ 0

) = 1. (6)

We next more precisely give the algorithm details explaining how such a sample-pathinequality as in (6) is used.

3.1 The PS Algorithm

PS Algorithm

1. At time t = 0, start the PS model with its stationary distribution; that is, set X(0) =(L,Y1, . . . , YL) as in (3). This involves generating L with the geometric distribution, andthen generating L iid copies of the Yj distributed as Ge . To this end: Generate L. IfL > 0, then generate L iid copies S∗

1 , . . . , S∗L distributed as the spread Gs defined in (5).

Generate L iid Unif (0,1) rvs, U1, . . . ,UL. Set Yi = UiS∗i , Bi = (1 − Ui)S

∗i denoting the

age and excess of each such service time. Our initial state is thus the enlarged one,

(L,S∗

1 , . . . , S∗L, Y1, . . . , YL, B1, . . . ,BL

).

If L = 0, the state is defined as 0.The reason that we want to keep track of the whole service time S∗

i is that we needto be able to attach it to the departure time of the customer associated with it, when thatcustomer completes service (so that we can feed the time-reversed input back into M toconstruct M(0)). These initial customers all have service times distributed as Gs (not G)due to the inspection paradox. All new arrivals will have regular iid G service times S,and we will keep track of them too for the same reason.

2. If L = 0, then set M∗ = 0 and stop. (This happens with probability P (L = 0) = 1 − ρ.)3. If L > 0, then simulate the PS model (using ages for the Yi , so that it represents the time

reversal) until it first empties, at time τ = min{t > 0 : X(t) = 0}.This involves a standard discrete-event simulation, in which the events are either an

arrival, or a service completion. The age of each service time increases over time de-pending on the value of L(t). If L(t) = n ≥ 1, then Y (t) for each customer in serviceincreases at linear rate 1/n until either a service completion or an arrival occurs. (Theexcess is always given by B(t) = S − Y (t).) When an arrival occurs, a service time S

distributed as G is generated and placed into service with age Y = 0 and excess B = S;

Ann Oper Res

the value S is stored until service completion. L(t) is re-set to L(t) + 1, and a new nextinterarrival time is generated (exponential at rate λ). If a service completion occurs, thenL(t) is re-set to L(t) − 1. It is a service completion time that coincides with τ , and welet m ≥ 1 denote the total number of service completions that occurred including the lastone at time τ . During the simulation, record and store the (finite) marked point process(mpp) (t1, S1), . . . , (tm, Sm) where ti denotes the time of the i th service completion (the i th

departure time), and Si denotes the service time associated with that service completion(plus any other pertinent information about that service time (we will see from exampleswhat this means)). The simulation stops at time τ yielding the mpp (t1, S1), . . . , (tm, Sm).

4. Time reverse the mpp starting from time tm = τ : Set (S0, . . . , Sm−1) = (Sm, . . . , S1) and

(with t0def= 0): Set ti = tm − tm−i , 0 ≤ i ≤ m.

5. Starting from t = 0, construct M(t) from time t = 0 starting with M(0) = 0 until timetm− by feeding it the input (t1, S1), . . . , (tm, Sm). Set M∗ = M(tm−), the system stateas found by the mth arrival. To be precise: At time t = 0 the initial customer enters anempty system with mark S0. Then at time t1, the first customer arrives and enters thesystem with mark S1. Finally, at time tm, the mth customer arrives. Set M∗ = M(tm−),the system state as found by the mth arrival.

Remark 1 The algorithm stopping time random variable τ conditional on it being positive(recall that P (τ = 0) = P (L = 0) = 1 − ρ) has simply the equilibrium distribution of thebusy period B of an M/G/1 queue; τ = Be. Since E(Bk) < ∞ if and only if E(Sk) < ∞,and since E(Bk

e ) = E(Bk+1)/((k + 1)E(B)) we conclude that E(τk) < ∞ if and only ifE(Sk+1) < ∞. It is also known that Be has finite exponential moments if and only if S does,see Nakayama et al. (2004).

4 Single-server model applications: sojourn times

Any stable M/G/1 queue under any work-conserving service discipline A can be handledusing our approach. Examples include last-in-first-out (LIFO), shortest job first, randomselection, and so on. The point is that since the workload processes {VA(t) : t ≥ 0} and{VPS(t) : t ≥ 0} are identical, we can use our approach; both systems empty at the sametimes. The state process M(t) is the number in system together with the remaining servicetimes of each customer at time t , and we can thus exactly simulate its stationary distributionby using the PS Algorithm.

But what about sojourn times? Except under FIFO, the sojourn time of a given customertypically depends on the future arrival times and service times after the customer arrives,and thus is not a function of the state found by the arrival. But, if the model state is startedoff in stationarity, then we can exactly simulate the stationary sojourn time W as follows:At time t = 0 start off the system state, M(0), in stationarity (using the PS Algorithm). Thisis also the stationary state as found by an arrival (via Poisson arrivals see time averages(PASTA); see Wolff 1989, Sect. 5-16, Page 293, for example). Let a customer denoted byC0 with iid service time S0 arrive at time t = 0 be such an arrival (finding the system in thisstationary state) and now simulate the model over time while tagging this customer until thiscustomer completes their sojourn time at time W . Then this W has the stationary sojourntime distribution.

Even for the PS model itself, this is a useful algorithm because the PS sojourn time dis-tribution, unlike the stationary state distribution, is very complicated even in the case ofdeterministic service times, the PS M/D/1 model, see Egorova et al. (2006); and in this

Ann Oper Res

case (deterministic service times) the termination time τ has finite exponential moments(recall Remark 1). Thus it is important to be able to simulate exactly from the stationary(state) distribution of the M/G/1 model under various disciplines so as to then proceedto simulate the stationary sojourn time. One could also simulate the stationary state distri-bution using a regenerative cycle approach (Asmussen and Glynn 2007 Sect. 8, Page 420,Proposition 8.4, and Example 8.5), using arrivals to the empty state as regeneration pointsas was done in Sigman (2011a) for the FIFO M/G/c queue, but then it always holds that theexpected termination time of the simulation is infinite.

5 Simulating the spread distribution of a sum of independent random variables

In order to apply our PS Algorithm to more complex models, we must first derive someuseful ways of simulating from spread distributions (recall Step 1 of the PS Algorithm); wedo so in this section.

Suppose that l ≥ 2 is an integer (non-random), and that for each i ∈ {1, . . . , l}, X(i)

denotes an independent non-negative rv distributed as F(i, x) = P (X(i) ≤ x), x ≥ 0, withfinite and non-zero mean E(X(i)) = 1/μi . Let Fs(i, ·) denote the spread distribution ofF(i, ·) as defined in (5).

Proposition 2 Let

X =l∑

i=1

X(i),

and let F(x) = P (X ≤ x), x ≥ 0. If for each i ∈ {1, . . . , l}, both F(i, ·) and Fs(i, ·) canbe simulated from, with known means 1/μi = E(X(i)), then the spread distribution of F ,denoted by Fs can be simulated from too, and the following is an algorithm for simulating arandom variable X∗ distributed as Fs :

1. Generate a discrete rv N such that P (N = i) = pi , i ∈ {1, . . . , l}, where, for each i ∈{1, . . . , l},

pi = E(X(i))

E(X)= 1/μi∑l

j=1 1/μi

, i ∈ {1, . . . , l}.

(Use the discrete inverse-transform method, for example.)2. If N = i, generate a rv X∗(i) distributed as Fs(i, ·), and independently for each j �= i

generate X(j) distributed as F(j, ·).3. Set X∗ = X∗(i) + ∑

j �=i X(j).4. Output X∗.

Proof If we consider a renewal point process with iid cycle lengths distributed as F , witharrival times {tn} and counting process {N(t)}, then Fs is the stationary (limiting as t → ∞)distribution of the spread T (t) = tN(t)+1 − tN(t), t ≥ 0. Each cycle length X is the sum of l

independent phases, X(i), and at any time t one such phase is in progress. From the renewalreward theorem, pi is the long-run proportion of time (stationary probability) that a phase i

is in progress. From the inspection paradox, in stationarity, if a phase i is in progress, thenthis phase, denoted by X∗(i), is distributed as Fs(i, ·) and all the other phases denoted byX(j), j �= i, are independent copies distributed as F(j, ·). Thus X∗ = X∗(i) + ∑

j �=i X(j);the algorithm follows. �

Ann Oper Res

6 Tandem queue

Here we consider the two-station tandem queue, the M/GI/ → /GI model. (Generalizingto c ≥ 2 stations is straightforward.) Exogenous arrivals to the first single-server node arePoisson at rate λ. Service times {Sn(1)} at the first node are iid distributed as G(1, ·) andindependently, service times {Sn(2)} at the second single-server node are iid distributed asG(2, ·). We then define Sn = Sn(1)+Sn(2) as the iid service times to be fed to the PS M/G/1queue. We assume that λE(S) < 1 to ensure stability of the PS model. (Stability of thetandem model only requires λE(S(1)) < 1 and λE(S(2)) < 1.) This allows us to conclude(completely analogous to Proposition 1) that workload for the PS model will empty andserves as a sample-path upper bound for workload in the tandem model. As our state processfor the tandem queue we use M(t) = the number of customers at each node together withtheir (whole or remaining) service times at time t . (Then the sum of all these service timesis the workload.) Thus we can apply the PS Algorithm, but we need to clarify how to usethese service times Sn for feeding back into the tandem model. We do so now.

We are using service times Sn = Sn(1) + Sn(2) and doing so in the order of Sn(1) asphase 1, and Sn(2) as phase 2. We assume we can simulate from G(i, ·), and from Gs(i, ·),i = 1,2. For simulating S∗ we are thus in the framework of Proposition 2 with l = 2.

At time t = 0, in stationarity, we need to generate the L iid copies of S∗ but also for eachsuch S∗ we need to keep track of the resulting mixture in Proposition 2. In other words weneed to know the value of i, N = i, in step (2) of Proposition 2 and the corresponding gener-ated values of service times. (This is an example of “other pertinent information” mentionedin Step 3 of the PS Algorithm.) This is because when such a service time S∗ completes ser-vice and departs, we need to feed this back into the tandem queue, so we need to untanglethe S∗ back into its two original service times. One of these service times is biased (inspec-tion paradox), while the other is not. For each S∗, we have either S∗ = S∗(1) + S(2) (withprobability p1 = E(S(1))/(E(S(1)) + E(S(2)))) or S∗ = S(1) + S∗(2) (with probabilityp2 = E(S(2))/(E(S(1)) + E(S(2)))), and so the service time vector corresponding to S∗ tobe fed back to the tandem queue will be either (S∗(1), S(2)) or (S(1), S∗(2)). Meanwhile,before time τ in the PS Algorithm, whenever a new customer arrives, we must generate andstore the vector (S(1), S(2)) (making up the service time S = S(1) + S(2)) so that whenthey depart the PS model we can feed the vector back into the tandem model.

6.1 Tandem queue with feedback

Let us consider two variations of such a model

1. Deterministic path: Each customer passes through the system a deterministic amountl ≥ 1 times. Upon service completion at node 2, a customer goes back to the tail of thequeue at node 1. The customer does this l − 1 times for a total of l passes. Each timea customer passes through, new iid service times are used. We will have the customersto the tandem model bring all necessary service times (l pairs) with them upon arrival:((S1(1), S1(2)), . . . , (Sl(1), Sl(2)). This ensures that workload can be defined. M(t) =the number of customers at each node together with their remaining sequence of servicetimes at time t (including any remaining service times in service).

For the PS model,

S =l∑

i=1

(Si(1) + Si(2)

), (7)

and we must have λE(S) < 1 for it to be stable.

Ann Oper Res

Once again, the PS workload serves as a sample-path upper bound as in Proposition 1;we thus can use the PS Algorithm when ρ < 1.

To generate S∗: We can use Proposition 2 with each F(i, ·) = G(x) = P (S(1) +S(2) ≤ x), x ≥ 0. In this case, pi = 1/l, i ∈ {1,2, . . . , l}, and we already know howto generate the spread Gs as just discussed for the tandem queue without feedback. Weneed to keep track of the mixtures involved and the pairs involved for all k pairs. InStep 4 of Proposition 2, we need to store the value of i ∈ {1,2, . . . , l} that was chosen,and keep stored too all the values X(j), j �= i. For these X(j) (these are the unbiasedones) we generate them as X(j) = Sj (1) + Sj (2) by generating the pair (Sj (1), Sj (2))

and storing it. In addition, for the biased one X∗(i), we need to know if it is S∗(1)+S(2)

or S(1) + S∗(2), and store the generated pair (S∗(1), S(2)) or (S(1), S∗(2)). Meanwhile,before time τ in the PS Algorithm, whenever a new customer arrives, we must store thevector ((S1(1), S1(2)), . . . , (Sl(1), Sl(2))) (making up the service time S) so that whenthey depart the PS model we can feed the vector back into the tandem model.

2. Random path: Upon service completion at node 2, independent of the past, a customergoes back to the tail of the queue at node 1 with probability p, or departs the entiresystem (for good) with probability q = 1 −p. Each time a customer passes through, newiid service times are used. In this case, the total number of passes is a random variable J

with a (explicitly known) geometric distribution:

P (J = l) = pl−1(1 − p), l ≥ 1.

For each arriving customer, we first generate a J , and then generate J iid pairs((S1(1), S1(2)), . . . , (SJ (1), SJ (2))).

For the PS model,

S =J∑

i=1

(Si(1) + Si(2)

),

and E(S) = E(J )(E(S(1)) + E(S(2))); we assume that λE(S) < 1 as usual.If we consider a renewal point process with cycle lengths distributed as S, then (via

the renewal reward theorem) the long-run proportion of time that a cycle-length made upof exactly l passes is in progress is given by

Ql = P (J = l)E(∑l

n=1(Sn(1) + Sn(2)))

E(S). (8)

Conditional on a size l pass in progress (which occurs with probability Ql), we needto generate from the stationary spread distribution of the S given in (7); we already havediscussed how to do that in our deterministic path example; let Z∗(l) denote such a copy.Thus, here, to get a copy of S∗, we have a mixture (over l with probabilities Ql) of suchspreads, and here is the algorithm:

(i) Generate a random variable N such that P (N = l) = Ql , l ≥ 1.(ii) If N = l, then generate Z∗(l) having the spread distribution of the S given in (7).

Set S∗ = Z∗(l).(iii) Output S∗.

We of course need to keep track of the “further pertinent information”: the valueof N = l and the various mixtures/pieces making up the resulting Z∗(l) as discussedfor the deterministic path example. Meanwhile, before time τ in the PS Algorithm,whenever a new customer arrives, we must store both the value of J and the vector

Ann Oper Res

((S1(1), S1(2)), . . . , (SJ (1), SJ (2))) (making up the service time S) so that when theydepart the PS model we can feed the vector back into the tandem model.

Note in passing that more generally, we can allow J to have any (explicitly known)discrete distribution on the positive integers with an explicitly known finite mean E(J );for then (8) still holds and the same algorithm will go through.

7 General networks (multi-class)

Here, we have a network of c ≥ 2 single-server FIFO queues (nodes). There is a Poissonrate λ arrival process.

Routing is general iid among customers: Letting R = (S(1, k1), i1, . . . , S(l, kl), il) denotethe “route” of a generic customer, and Rn the copy for the nth arriving customer, we assumethat {Rn : n ≥ 0} is iid. (i1, . . . , il) denotes the sequence of stations to be sequentially visited,in the order they are visited, and (S(1, k1), . . . , S(l, kl)) denotes the corresponding servicetimes used at the nodes: S(1, k1), i1 denotes that the first node attended by the customer isnode 1 ≤ i1 ≤ c and that the service time to be used there S(1, k1) is of “class” 1 ≤ k1 ≤ K ,meaning that it is an independent draw from a distribution G(k1, x) = P (S(1, k1) ≤ x).(Thus multi-class is allowed here, with 1 ≤ K < ∞ classes, where K is deterministic.) Thesecond node to be visited (if any) after departing from service at node i1 is node i2 with aservice time S(2, k2) independently drawn from distribution G(k2, ·) and so on until finally(last node to be visited) visiting node il with a service time S(l, kl) independently drawnfrom distribution G(kl, ·). The length of the route, l ≥ 1, is a random variable with a finitefirst moment assumed. It is allowed that customers re-attend previously attended nodes, thatis, that two or more values of the ij can be equal in the list (i1, . . . , il). (In other words,feedback is allowed.) But note that if a customer re-attends a given node, it is possible to re-attend it as a different class. As our state process, M(t) = the number of customers at eachnode, together with the remaining routes of each, including the remaining service times ofeach customer in service, at time t . (Workload is thus well defined too: the sum of all wholeand remaining service times over all the remaining routes at time t .)

We define

S =l∑

i=1

S(i, ki) (9)

as the service time for the single-server PS model; we require the harsh condition that ρ =λE(S) < 1 to ensure stability of the PS model. This of course also ensures stability of thenetwork (for which in general, explicit necessary and sufficient conditions for stability areunknown because of the multi-class generality allowed here). Stability conditions for suchnetworks are, however, generally much weaker than ρ < 1. Once again, a PS sample-pathworkload upper bound for the network as in Proposition 1 remains valid (same proof: inthe network, whenever there is work in the system it is processed at rate between 1 and c,whereas in the PS model it is processed exactly at rate 1); we can thus use the PS Algorithm.

We will need to simulate from the spread distribution of such a service time given in (9).In general, this is a formidable task, so we will not attempt this in full generality. Insteadwe will consider some special cases of interest to illustrate the basic idea. the essentialassumption is that we can simulate from each G(k, ·) and from its spread Gs(k, ·), and thatwe explicitly know the means of each G(k, ·).

Ann Oper Res

Remark 2 This network could equivalently (in distribution as a stochastic process) be con-structed (simulated) by having the service times handed out (generated) by the servers (asopposed to having them brought by the customer): When the customer enters service at theirj th node ij , a service time distributed as G(kj , ·) is drawn and used, j ∈ {1, . . . , l}. This ishow one would normally simulate such a model, but then we can’t define the total workloadprocesses, and hence we can’t use the PS model as an upper bound. So for our purposes hereof obtaining the stationary distribution of the network, we need to generate the entire routefor each arrival.

7.1 Finite number of paths

The “path” of the route R is p = ((i1, k1), . . . , (il, kl)) denoting the sequence of nodes to beattended together with the corresponding class designations. There are, in general, (cK)1

paths of length 1, (cK)2 paths of length 2, and so on. Thus in general, there are a countablebut infinite number of possible paths. Of course for a given network the probability distribu-tion of the path would determine which and how many of these possibilities would actuallyoccur. For example, in the tandem queue (with c = 2 nodes), as in Sect. 6, there is only onepossible path, ((1,1), (2,2)). In Sect. 6.1, the first example has only one path (of length 2k)((1,1), (2,2)(1,1), (2,2), . . . , (1,1), (2,2)), while the second has infinitely many paths, thekth one of length 2k, k ≥ 1.

Let us thus consider a network for which there are only a finite number M ≥ 1 ofpaths, denoted by pm, and occurring with (explicitly known) probability P (p = pm) = qm,1 ≤ m ≤ M . Let lm denote the length of the path pm, let (S

(m)

1 , . . . , S(m)lm

) denote the corre-sponding service times, and let

S(m) = S(m)

1 + · · · + S(m)lm

. (10)

If we consider a renewal point process with iid cycle lengths distributed as the resultingS from Eq. (9), then from the renewal reward theorem, the proportion of time that a path pm

is in progress is given by

Qm = qmE(S(m))

E(S), (11)

where

E(S) =M∑

m=1

qmE(S(m)

). (12)

Each path pm gives rise to an S = S(m) (defined in (10)) of the form in Proposition 2.If we assume that we can simulate from each of the K distributions G(k, ·) and its spreaddistribution Gs(k, ·), and that we explicitly know the mean of each G(k, ·), then we cansimulate copies of spread for S(m), denoted by S(m)∗ by using Proposition 2. Then we havean algorithm as follows for simulating S∗:

Algorithm for simulating S∗ when there are finitely many paths

1. Generate a discrete rv X such that P (X = m) = Qm, m ∈ {1, . . . ,M} as defined in (11).2. If X = m, generate a rv S(m)∗ distributed as the spread of S(m) (defined in 10), by using

Proposition 2.3. Set S∗ = S(m)∗.4. Output S∗.

Ann Oper Res

When simulating the PS model, each time an arrival occurs, we must generate an entireroute R, so as to not only construct S, but also for later use: we must attach and retain theentire route so that when the customer departs, we can use the route in the network model.

When simulating the stationary distribution of the PS model, in Step 1 of the PS Algo-rithm in Sect. 3.1, we must initially simulate L (geometric with parameter ρ) iid copies ofS∗ using the above Algorithm. When doing so, if X = m in Step (2), then we attach the pathpm together with the entire list of lm service times that are generated when using Proposi-tion 2 to produce the S(m)∗. This yields the appropriate route to be attached to S(m)∗. Thus,in both cases, we attach an appropriate route to the service time and keep it as the “otherpertinent information” mentioned at the end of Step 3 of the PS Algorithm.

7.2 Markovian routing

In this (classic) case, customers move through the network according to a Markov chain.P(i,k),(i′,k′) denotes the probability that a customer, completing service at node i as a class k,next, independent of the past, goes to node i ′ as a class k′. In addition to the states 1,2, . . . , c

for the nodes i, i ′, there is an additional state 0 denoting the outside: P(i,k),0 denotes theprobability that after completing service at node i, as of class k, the customer then departsthe system (never to return), and P0,(i,k) denotes the probability that upon its arrival to thesystem, the customer initially attends node i as a class k. (See, for example, Chen and Yao(2001).)

A very special case is when each node has its own class, and this is known then as asingle-class network, and is a special case of a generalized Jackson network. In this case,the Markov transitions simplify to Pi,j denoting the probability that a customer, completingservice at node i, next, independent of the past, goes to node j , where service times are alliid with distribution Gj . For example, the tandem model in Sect. 6 (c = 2 case) is such anetwork in which P0,1 = P1,2 = P2,0 = 1.

Given a path p = ((i1, k1), . . . , (il, kl)), from a Markovian route, it is easy to compute itsprobability of occurrence q = q(p) as

q = P0,(i1,k1) × · · · × P(il−1,kl−1),(il ,kl )P(il ,kl ),0.

Thus in principle, one could use the basic method of Sect. 7.1 (even though now thenumber of paths is infinite in general) to simulate a copy of S∗. One would have to first labelthe paths in some fixed ordering p1,p2, . . . and then use the probabilities qm = P (p = pm),m ≥ 1.

References

Asmussen, S. (2003). Applied probability and queues (2nd ed.). New York: Springer.Asmussen, S., & Glynn, P. W. (2007). Stochastic simulation. New York: Springer.Chen, H., & Yao, D. D. (2001). Fundamentals of queueing networks. New York: Springer.Egorova, R., Boxma, O., & Zwart, B. (2006). Sojourn time tails. In The M/D/1 processor sharing queue.

Probability in the engineering and information sciences (Vol. 20, pp. 429–446).Kendall, W. S. (2004). Geometric ergodicity and perfect simulation. Electronic Communications in Proba-

bility, 9, 140–151.Nakayama, M. K., Shahabuddin, P., & Sigman, K. (2004). On finite exponential moments for branching

processes and busy periods for queues. Journal of Applied Probability, 41A, 273–280.Propp, J. G., & Wilson, D. G. (1996). Exact sampling with coupled Markov chains and applications to statis-

tical mechanics. Random Structures & Algorithms, 9, 223–253.Ross, S. M. (1996). Stochastic processes (2nd ed.). New Jersey: Wiley

Ann Oper Res

Sigman, K. (2011a). Exact simulation of the stationary distribution of the FIFO M/G/c queue: the generalcase of ρ < c. Queueing Systems, 70, 37–43.

Sigman, K. (2011b). Exact simulation of the stationary distribution of the FIFO M/G/c queue. Journal ofApplied Probability, 48A, 209–216. Special Volume: New Frontiers in Applied Probability.

Wolff, R. W. (1989). Stochastic modeling and the theory of queues. New Jersey: Prentice Hall.