QUEUING THEORY

Jaroslav Sklenar

Department of Statistics and Operations Research University of Malta

Contents

Introduction 1 Elements of Queuing Systems 2 Kendall Classification 3 Birth and Death Processes 4 Poisson Process 4.1 Merging and Splitting Poisson Processes 4.2 Model M/G/ 5 Model M/M/1 5.1 PASTA 6 General Results 6.1 Markovian Systems with State Dependent Rates 7 Model with Limited Capacity 8 Multichannel Model 9 Model with Limited Population 9.1 Model with Spares 10 Other Markovian Models 10.1 Multichannel with Limited Capacity and Limited Population 10.2 Multichannel with Limited Capacity and Unlimited Population 10.3 ’s Loss Formula 10.4 Model with Unlimited Service 11 Model M/G/1 12 Simple Non-Markovian Models 13 Queuing Networks 13.1 Feed Forward Networks 13.2 Open Jackson Networks 13.3 Closed Jackson Networks 14 Selected Advanced Models 14.1 State Dependent Rates Generalized 14.2 Impatience 14.3 Bulk Input 14.4 Bulk Service 14.5 Systems with Priorities 14.6 Model G/M/1 15 Other Results and Methods References Appendices Introduction

This text is supposed to be used in courses oriented to basic theoretical background and practical application of most important results of Queuing Theory. The assumptions are always clearly explained, but some proofs and derivations are either presented in appendices or skipped. After reading this text, the reader is supposed to understand the basic ideas, and to be able to apply the theoretical results in solving practical problems. Symbols used in this text are unified with the book [1]. Acknowledgement: Many thanks go to Ms. Nadia Tagliaferro who wrote down many examples and derivations presented during my lectures. Due to her hard work the text is now more complete and easier to understand.

1 Elements of Queuing Systems

The following figure shows the basic parts of a single queue queuing system:

Population of Customers

Arrival Queue Service Output

Population of Customers can be considered either limited or unlimited. Unlimited population is an abstraction used in theoretical models of systems with a large number of possible customers (a bank on a busy street, a motorway petrol station). In unlimited population systems the number of customers in the system does not affect the arrival process. Example of a limited population may be a number of processes to be run (served) by a computer or a certain number of machines to be repaired by a service man. In limited population systems the number of customers in the system affects the arrival (more customers in the system means less frequent arrivals; if all are in there are no arrivals at all). It is necessary to take the term “customer” very generally. Customers may be people, machines of various nature, computer processes, telephone calls, data packets, manufactured components, etc.

Arrival defines the way customers enter the system. Mostly customers arrive randomly with random intervals between two adjacent arrivals. Typically the arrival is described by a random distribution of intervals also called Arrival Pattern. Models exist both for single and batch (bulk) arrivals.

Queue represents customers waiting for service (of course the queue may be empty). Typically the customers being served are considered not to be in the queue. Sometimes the customers form a queue literally (people waiting in a line for a bank teller). Sometimes the

2 queue is an abstraction (planes waiting for a runway to land, machines waiting for a repair). There are two important properties of a queue: Maximum Size and Queuing Discipline. Maximum Queue Size is the maximum number of customers that can wait in the queue. System Capacity is the maximum number of customers in the system (maximum queue size plus the number of service channels). Queue is always limited, but some theoretical models assume an unlimited queue length. If the queue length is limited, some customers are forced to renounce without being served. Queuing Discipline represents the way the queue is organised (rules of inserting and removing customers to/from the queue). There are these typical ways:

1) FIFO (First In First Out) also called FCFS (First Come First Serve) - orderly queue. 2) LIFO (Last In First Out) also called LCFS (Last Come First Serve) - stack. 3) SIRO (Serve In Random Order). 4) Priority Queue that may be viewed as a collection of FIFO queues for various priorities. 5) Many other more complex queuing methods that typically change the customer’s position in the queue according to the time spent already in the queue, expected service duration, and/or priority. These methods are typical for computer multi-access systems.

Many quantitative parameters (like average queue length, average time spent in the system) do not depend on the queuing discipline. That’s why most models either do not take the queuing discipline into account at all or assume the normal FIFO queue. In fact if there are no priorities the most important parameter that depends on the queuing discipline is the variance of the waiting time. There is this general rule (that may be used for example to verify results of simulation experiments):

The two extreme values of the waiting time variance are for the FIFO queue (minimum) and the LIFO queue (maximum).

Theoretical models (except priorities and networks) assume only one queue. This is not considered as a serious limiting factor because practical systems with more queues (bank with several tellers with separate queues) may be viewed as a system with one queue, because the customers always select the shortest queue. Of course, it is assumed that the customers leave after being served. Systems with more queues (and more channels) where the customers may be served more times are called Queuing Networks.

Service represents some activity that takes time and that the customers ask and possibly wait for. Again take it very generally. It may be a real service carried on persons or machines, but it may be a CPU time slice, connection created for a telephone call, being shot down for an enemy plane, etc. Typically a service takes random time. Theoretical models are based on random distribution of service duration also called Service Pattern. Another important parameter is the number of servers that are called channels. Systems with one channel only are called Single Channel Systems; systems with more channels are called Multichannel Systems. Theoretical models assume that the channels are all equal and the load is distributed evenly. Similarly to arrival there are models for single and batch services.

Output represents the way customers leave the system. Output is mostly ignored by theoretical models, but sometimes the customers leaving the server enter the queue again (“round robin” time-sharing systems). Also in limited population models leaving customers are assumed to ask again (typically after some random time) for service.

3 Queuing Theory is a collection of mathematical models of various queuing systems that take as inputs parameters of the above elements and that provide quantitative effectiveness parameters describing the system performance.

Because of random nature of processes involved; queuing theory is rather demanding and most models are based on very strong assumptions (not always satisfied in practice). Many systems (especially queuing networks) are not soluble at all, so the only feasible technique that may be applied for their analysis is simulation. Nevertheless models of queuing systems are practically very important because of the typical trade-off between various costs of providing service and the costs associated with waiting for the service (or leaving the system without being served). High quality fast service is expensive, but costs caused by customers waiting in the queue are minimum. On the other hand long queues may cost a lot because customers (machines e.g.) do not work while waiting in the queue or customers leave because of long queues. So a typical problem is to find an optimum system configuration (e.g. the optimum number of channels). The solution may be found by applying queuing theory or by simulation. From the Optimization theory point of view, systems optimized by using queuing theory mostly don’t provide a continuous objective function. Typically there are several configurations and the problem is to select the best one.

2 Kendall Classification

The Kendall classification of queuing systems and their models (1953) exists in several modifications. The one used in [1] is based on 5 symbols:

A/B/X/Y/Z Where:

A is the arrival pattern (distribution of intervals between successive arrivals). B is the service pattern (distribution of service duration). X is the number of parallel service channels. Y is the restriction on system capacity. Omitted for unlimited queues. Z is the queue discipline (FIFO, LIFO, ...). Omitted for FIFO or if not specified.

Sometimes another symbol is added for a limited population size (number of possible customers). These symbols are used for arrival and service patterns:

M is the exponential distribution of intervals between arrivals or service duration respectively (M comes from the adjective Markovian). Ek is the Erlang type k distribution of intervals or service duration. D is the symbol for deterministic (known) arrivals and constant service duration. G is a general (any) distribution. GI is a general (any) distribution with independent random values.

Examples (both with FIFO or unspecified queue and unlimited population): D/M/1 = Deterministic (known) input times, one exponential channel. M/G/3/20 = Poisson input (see later), three channels with any distribution, maximum number of customers in the system 20 (maximum queue length 17).

4 3 Birth and Death Processes

Stochastic process is a collection of random variables {X(t), t  T} defined on a probability space and indexed by a parameter t (usually assumed to be time). So for each value of t there is a random variable X(t) with values in a certain state space S. If the state space is discrete (denumerable - not necessarily finite), the process is called a discrete-state stochastic process. If the state space is continuous we deal with a continuous-state stochastic process. Similarly with respect to the time set there are discrete-time stochastic processes and continuous-time stochastic processes.

Birth-death process is a stochastic process with continuous time and discrete state space S={0,1,2, ... } such that from any state n  S\{0} only transitions to the neighbouring states n+1 and n-1 are allowed. From state 0, the only allowed transition is to state 1. If the state space is finite: S = {0,1,2, ... , m-1, m}, the only allowed transition from the last state m is to the state m-1.

When interpreting the current state n  S as the current population in a system, a birth occurs with the rate n>0 resulting in the state n+1. For a finite state process m=0. A death occurs with the rate n>0 resulting in the state n-1. Note that typically 0>0, on the other hand always 0=0.

Classification of birth-death processes:

Markovian birth-death process has transition probabilities dependent only on the current state (not on the past history how the current state has been reached). Exactly:

Probability of exactly one birth in t given a population n is nt + o(t) Probability of exactly one death in t given a population n>0 is nt + o(t) Probabilities of more than one birth and/or death in t is o(t) o(t) Where o(t) is such function that: lim  0 t0 t

Linear Markovian processes have the above probabilities dependent linearly on n and t :

Probability of exactly one birth in t given a population n is nt + o(t) Probability of exactly one death in t given a population n>0 is nt + o(t) So n=n and n=n where  is the birth/arrival rate and  is the death/departure rate.

Poisson birth-death process has probabilities independent of population size, so n= and n=, n>0 where  is the state independent birth/arrival rate and  is the state independent death/departure rate.

Pure birth process has n= 0, n S.

Pure death process has n= 0, n S.

5 Example: Collecting and processing applications may involve all three types of birth-death processes: t0 – collection starts t1 – processing starts t2 – dead-line for accepting applications t3 – dead-line for processing

# of applications to process

Pure birth B & D Pure death process process process process

time

t0 t1 t2 t3

Poisson process

if n=

Poisson process is a pure birth Poisson birth-death process defined by a single constant parameter - arrival rate  - that is of course also time independent. Poisson process has a fundamental place in derivation of many queuing theory models, so we shall study it in more detail in the next chapter.

4 Poisson Process

Using the above classification we can summarize the properties of the Poisson process where [x] means “the probability of the event x”:

1) [one arrival in the time interval (t, t+h)] = h + o(h), where  is a constant.

2) [more than one arrivals in the interval (t, t+h)] = o(h).

3) The above probabilities do not depend on t (“no memory” property = time independence = stationarity).

Let pn(t) = [n arrivals in the time interval (0, t)]. To find this function we apply the usual approach: study how the quantity changes over a very short interval, try to find the differential equation and solve it. By using the above assumptions 1) and 2), it is possible to express the probability pn(t+h). First we list the events that result in the state “n arrivals till (t+h)”:

6 1. n arrivals by t, no more arrivals during h 2. (n-1) arrivals by t, one more arrival during h 3. (n-2) arrivals by t, 2 more arrivals during h : : The above events are mutually exclusive, so we can add their probabilities: pn(t+h) = pn(t)[1 - h - o(h)] + ( n arrivals by t, no more arrival ) n > 0 (1) pn-1(t)[h + o(h)] + ( n-1 arrivals by t, one more arrival) o(h) (all events with more than 1 arrival during h) p0(t+h) = p0(t)[1 - h - o(h)] ( no arrival by t, no more arrival)

By re-arranging equations (1), by taking the limit for h  0 and by using the property of the function o(h) we obtain the following set of equations:

pnn()() t h p t p00()() t h p t lim( ) ( )  pnn t  p1 t lim( )  pt0 (2) h0 h h0 h

As the terms at the left hand sides of (2) are the derivatives, we have the set of differential equations: dp() t dp() t n  p()() t  p t 0  pt() (3) dt nn1 dt 0

Direct solution to differential equations

dp0 (t) To find p0(t) we use directly the second equation of (3)   p (t) or dt 0 dp (t) 0  p (t)  0 which gives the solution p (t)  ce t dt 0 0

t To prove it, differentiate: p0 (t)  ce  p0 (t)

To find the constant c we assume that the system is initially empty, p0(0) = 1:

p0(t) p0 (0)  c 1 t 1 p0 (t)  e

Graphically: t

Similarly we can find p1(t) by inserting p0(t) in the first equation of (3): dp() t 1 lp()()() t l p t l p t l e lt dt 1 0 1

7 Giving the solution

lltt p1() t cete l

To find the constant c we again assume that the system is initially empty:

ppn1(0)(0)n 0, 0 p (0)  c  0 1 t p1 (t)  te … to prove differentiate.

()t 2 Similarly for n = 2 we get: p() te  t 2 2

Generally (can be proved by induction – see Appendix 1) we obtain the following formula:

()t n p() te  t (4) n n!

The following figure shows how the probabilities typically change with time. Note also that for a fixed time, say t1, we get a collection of probabilities that define the distribution of the discrete random variable “number of births/arrivals in (0, t1)”.

pn(t1) p1(t)

p2(t)

t n t1 0 1 2 p (t) 0

See Appendix 2 for the derivation of (4) based on the generating function.

Because of the assumption 3) the formula (4) holds for any interval (s, s+t), in other words the probability of n arrivals during some time interval depends only on the length of this time interval (not on the starting time of the interval).

Number of arrivals Nt during some time interval t is a discrete random variable associated with the Poisson process. Having the probabilities of the random values - (4), it is possible to find the usual parameters of the random variable Nt. Let [X] be the expected (average) value, Var[X] the variance, and [X] the standard deviation of a random variable X:

8   nn1 (tt )( )t   tt  t []()Ntn np t   n e   tete e  t (5) n0 nn  01 nn!( 1)! 

(5) gives the interpretation of the constant  that is the average number of arrivals per time unit. That’s why  is called arrival rate [s-1]. Formula (4) shows that the number of arrivals during some time t has the so-called Poisson distribution with mean value t. In Appendix 2 the expectation of Nt and its variance are computed directly by using the generating function. Here we summarize the results:

 n 22()t t Var[Nnett ]( ) t   (6) n0 n!

[NNttt ] Var[ ] (7)

Another random variable associated with the Poisson process is the random interval between two adjacent arrivals. Let X be the random interval. To find its distribution, let’s express the cumulative distribution function (cdf) F(x): -x F(x) = [X ≤ x] = [at least one arrival during the interval x] = 1 - p0(x) = 1 - e

F(x)

x Because the interval duration is a continuous random variable, it is possible to compute the probability density function (pdf) f(x) as the derivative of the distribution function: f(x) = dF(x)/dx = e-x

f(x)

x Area under graph =1

These two functions define the probability distribution for x  0:

F(x) = 1 - e-x f(x) = e-x (8)

9 The distribution (8) is called exponential distribution (sometimes negative exponential distribution). Its moments computed by integration by parts are:

 1 1 1 []Xt e dt t Var[XXX ] [22 ] ( [ ]) [XX ]Var[ ] (9)  2 0   

(9) gives another interpretation of the constant . Its inverted value is the average interval between arrivals. Like the number of arrivals, the distribution of intervals between arrivals does not depend on time. Note the big value of the standard deviation (equal to the average value). It means, that the exponential distribution is “very random” with the coefficient of variation equal to 1. In fact all intervals from 0 to  are theoretically possible. So it may happen that there will be clusters of very close arrivals separated by very long intervals. Of course not all practical distributions can be treated as exponential ones. There is this general rule:

If a large number of independent event streams are merged together, and if events in each stream occur at a very low rate, then the resulting stream is approximately a Poisson process with exponential intervals.

This rule is more or less satisfied by systems with large populations (each potential customer represents one low rate stream). Some Poisson process examples (small error examples):

 births in a large population  arrivals to a bank on a busy street  petrol station on a busy motor-way  failures from a large number of machines  failures of a complicated machine where many different parts can fail.

Forgetfulness (Memoryless) property of Exponential Distribution

Theorem 1: Assume that T is exponentially distributed. Then:

[ T > t + s / T > s ] = [ T > t ].

Proof: We assume that the mean value of T is 1/ (rate ).

1) Using the cdf of the exponential distribution the probability of exceeding a certain value t can be computed as follows:

[T > t] = 1 – [T ≤ t] = 1 – F(t) = 1 – (1 – e-t) = e-t

10 2) Using the above result and elementary Probability Theory formulae the probability on the left hand side can be written as:

[]TtsTs [   ] [] Tts    Ts/Tts    [T t  s / T  s ]  [T sT ] [ s ]

[T t  s ]  1 e()ts     et [] T t [T s ] es

If T is interpreted as a random interval between two successive arrivals or random service duration then the theorem states that: “The probability that the interval (duration) will be greater than t+s provided it has already been greater than s is equal to the probability that it will be greater than t”.

In other words:

“Information about s - time of last arrival (or time when the service has started) - is useless when assessing probability of the next arrival (or next end of service)”.

Graphically:

Last arrival Now a) time s t

Last arrival Now b) time s t

In both cases the probability of next arrival (end of service) during the next t time units is the same. Note that for other than exponential distributions this counterintuitive property is not true. Assume for example any distribution with bounded support [0, s+t] with s and t being equal to the values depicted above for the case a). Now the probability of next event during t is 1 for the case a), while it is less than 1 for the case b).

When the exponential distribution is applied to a service, the rate is called service rate (). The parameter  is the average number of completed services per time unit (provided there are always customers waiting in the queue), its inverted value 1/ is the average duration of the exponential service. The variance and the standard deviation can be computed by replacing  by  in the formulae (9). Unlike arrival, exponential service is an abstraction that is hardly satisfied by real systems, because mostly it is very unlikely to have very short and/or very long services. Real service duration will be typically “less random” than the theoretical exponential distribution. Note that unlike , the quantity 1/ has a clear interpretation. This explains why software packages (like QTS) often assume  and 1/ as model inputs.

11 Another very important parameter of queuing systems with one service channel is the ratio  of the arrival and the service rates called traffic rate:

   (10) 

The value of  shows how “busy” is the channel. It is obvious, that for   1 the queue will grow permanently and the system will thus be unstable (in the sense that it will never reach equilibrium with constant probabilities of its states). Later we shall see that for most theoretical models  must not be even equal to one.

4.1 Merging and Splitting Poisson Processes

In this chapter we shall prove that merging, random selection and random splitting of Poisson processes preserves the Poisson properties, so the resulting processes are still Poisson. These results are very important for the analysis of queuing networks.

Merging Independent Poisson Processes

We have two independent Poisson processes with rates 1 and 2 respectively. By merging we understand registration of events (arrivals) of both processes.

Theorem 2: The merge of two independent Poisson processes with rates 1 and 2 is a single Poisson process with the rate (1 + 2).

Proof: We compute the cumulative distribution function F(x) of the merged process: F(x) = [at least one arrival during the interval x] = 1 - [no arrival during x] = 1 - [no arrival in process 1 during x][no arrival in process 2 during x] =

(1) (2) 1x   21 xx   1 () 1 – p 0(x) p 0(x) = 1 (e  ee ) 1 . So F(x) is the cumulative distribution function of the Poisson process with rate (1 + 2). 

Merging two Poisson processes can be generalized into merging of n independent Poisson n processes with rates 1 , 2 … n into a single Poisson process with the rate   i . Apart i1 from obvious use in queuing networks we shall also use this result in the limited population model.

Random Selection from a Poisson Process

We create a new Poisson process from the original one in such a way, that each event (arrival) is selected with the probability p.

12 Theorem 3: The resulting process created by random selection from a Poisson process with rate  with probability p is a Poisson process with the rate p.

Proof: We compute the probability of an arrival in the selection process during a short interval h → 0: [arrival in selection process during h] = [arrival in the original process during h][arrival selected] = (λh)p = (pλ)h. The last is by the definition the arrival probability of a Poisson process with rate p. 

Random Splitting of a Poisson Process

We create two Poisson processes from the original one in such a way, that each event (arrival) is selected with the probability p into one process and with the probability (1 – p) into the other process.

Theorem 4: If a Poisson process with rate  is randomly split into two subprocesses with probabilities p and (1 – p), then the resulting processes are independent Poisson processes with rates p and (1 – p) respectively.

Proof: We note that splitting is very similar to selection, so by the Theorem 3 the two processes are Poisson with the rates p and (1 – p). To prove independence we are going to use a result about dividing sets with random numbers of items with Poisson distribution. Let N ~ Poisson(a) represent the fact that N has Poisson distribution with mean a. Then the following theorem will be used:

Theorem 4.1: If the elements of a set with N items such that N ~ Poisson(a) are randomly assigned into 2 groups with probabilities p1 and p2 = (1 – p1) then the sizes N1 and N2 of the two sets are independent and distributed as N1 ~ Poisson(p1a) and N2 ~ Poisson(p2a).

Proof: We compute the probability that the sets have n1 and n2 items respectively:

[][/][]NnNn1 1 2 2 NnNnNnnnNn 1  1 2 2  1 2 

n n1 n 2 n 1 n 2 n!(nn )  a ( a )   p p nnapp   ()  p a  pa p a  pa p1 p 2 e1 2 a 1 2 e 1 2 1 e 1 2 e 2 12 n n12  n  n1!!!!!!! n 2  n   n 1 n 2  n 1 n 2

Above we used the multinomial form of the binomial distribution. The result proves the theorem, the product shows that the two numbers are independent. 

Now we prove that the two split Poisson processes are independent. We take any two time intervals I1 and I2 in the two processes. Let N1(I1) = number of events in the subprocess 1 in I1 N2(I2) = number of events in the subprocess 2 in I2. Let I = I1  I2. Then:

NININIINININII11() 1 ()  112 ( ), 22 ()  2 ()  221 ( )

13 The arrivals in non-overlapping intervals II12 and II21 are independent by the properties of Poisson process. So for independence of N1(I1) and N2(I2) we need independence of N1(I) and N2(I) that are created by random split of a number generated by Poisson distribution with mean |I|λ. By the supporting theorem N1(I) and N2(I) are also independent, so

N1(I1) and N2(I2) are independent. 

Splitting of a Poisson process into two subprocesses can be generalized into splitting into n n subprocesses with probabilities p1, p2 … pn such that  pi  1. This results in n independent i1 Poisson processes with rates p1λ, p2λ … pnλ.

4.2 Model M/G/

Properties of the Poisson process allow surprisingly simple derivation of the equilibrium system state probabilities of the M/G/ systems. We assume a Poisson arrival with rate  and ample service where all customers are served immediately. The service takes on average 1/ and we assume that service times and arrival are all independent. Note that the only assumption on the service time is a finite mean 1/. There is no queue, so the system state represents the number of busy channels.

n (/) / Theorem 5: Steady state probabilities of M/G/ systems are limpn ( te )  . t n!

So at equilibrium the number of busy channels follows the Poisson distribution with mean /. This famous insensitivity result is very useful in various applications. Note that ample service may represent self-service, so for example we can use this result to find the mean number of customers in a department store, etc.

Proof: We prove Theorem 5 for a distribution with finite support. Assume that service time takes finitely many possible values s1, … , sk with probabilities p1, … , pk. We also assume that time t is greater than the maximum possible service time. We can consider arrival of customers with service time si as a Poisson process with arrival rate pi. Then at time t, the number of customers of type i present in the system are those who have arrived in the time interval (t-si, t). We know that this number has a Poisson distribution with mean pisi. Together the total mean number of customers in the system at time t is:

kk pi s i  p i s i /  ii11

Above the second sum is the mean service time equal to 1/. There is another result that we use stating that the sum of independent random variables with Poisson distributions is also Poisson. This completes the proof. Any continuous distribution can be approximated by a distribution with finite support with arbitrary precision. See the book [17] for exact proof based on differential equation approach as we did for Poisson process above.

14 5 Model M/M/1

The M/M/1 model is made of a Poisson arrival (arrival rate ), one exponential channel independent of the arrival (service rate ), unlimited FIFO queue, and unlimited customer population. FIFO     (traffic rate)  

Because arrival and service are independent Poisson processes, it is possible to find probabilities of various states of the system that are necessary to compute the required quantitative parameters. System state is the number of customers in the system. It may be any nonnegative integer number. Let pn(t) = [n customers in the system at time t]. Using the property 2) of the Poisson processes involved the following state diagram applies:

   0 1 n-1 n n+1   

In the state diagram we use the fact that two events of the same type (two arrivals or two completions of services) cannot happen exactly simultaneously so transitions are possible only between neighbouring states. This is the reason why most theoretical results in queuing theory assume Poisson (Markovian) processes. Using the state diagram it is possible to express the probability pn(t+h) by using the reasoning similar to the one used for Poisson process. For simplicity the o(h) terms are not included: pn(t+h) = pn(t)[1 - h][1 - h] + (n customers at t, no came, no left) (11) pn(t)[h][h] + (n customers at t, one came, one left) pn-1(t)[h][1 - h] + (n-1 customers at t, one came, no left) pn+1(t)[1 - h][h] (n+1 customers at t, no came, one left ) n > 0 p0(t+h) = p0(t)[1 - h] + (no customer at t, no came) p1(t)[1 - h][h] (one customer at t, no came, one left)

Note that in (11) we use the facts that the four cases that result in n customers in the system at time t+h are mutually exclusive and each case is made of independent events. So for example the first case is made of these events:

First case event = (n at t)  (no arrival during h)  (no departure during h)

Here are all events together with their probabilities without o(h) terms:

[n at time t] = pn(t)

15 [no arrival during h] = (1 - h) [one arrival during h] = h [no departure during h] = (1 - h) [one departure during h] = h

By re-arranging equations (11), by taking the limit for h  0 and by using the property of the function o(h) we obtain the following set of equations:

pnn()() t h p t lim( )()  ()  pn (), t   p n 011 t   p n t n h0 h

p00()() t h p t lim( ) ( )  p01 t  p t (12) h0 h

As the terms at the left sides of (12) are the derivatives, we have a set of differential equations: dp() t dp() t n  (   )p ( t )   p ( t )   p ( t ) , n 0 0  p()() t  p t (13) dt n nn11 dt 01

Equations (13) are called Kolmogorov - Chapman Differential Equations. Their (very complicated) solution is a set of equations showing how each probability changes with time. Typical curves are as follows.

1 (assuming empty system at t = 0) p1(t)

p5(t) p0(t)

p10(t) 0 t

Fortunately we actually do not need these functions. Because of the third assumption (stationarity) after some transient period the system will become stable provided that it is not overloaded ( < , see later). Of course the state will permanently change, but the probabilities of various numbers of customers in the system will be constant. So the functions pn(t) become constants pn. Constant functions have zero derivatives, so the set (13) becomes a set of algebraic equations for the steady state (equilibrium) probabilities:

pn11(    ) p n   p n  0 , n  0 pp100 (14)

By dividing the equations (14) by  we get the following set of equations that contain only one parameter  - the traffic rate:

pn11(1  ) p n  p n , n  0 pp10  (15)

16 See Appendix 5 that shows how equations (14) can be obtained by the stochastic balance method. Next we solve the equilibrium equations (15) directly, see Appendix 4 for the solution by the generating function.

In (15) p1 is expressed by p0. By inserting p1 and p0 to the equation for p2, we get:

2 p2 = (1+)p1 - p0 = (1+)p0 - p0 =  p0

Similarly p2 and p1 may by used to express p3, etc. which gives the general formula for pn that can be proved by induction (see Appendix 3):

n n pn =  p0 = (/) p0 (16)

See also Appendix 11 where (16) is obtained by the method of operators.

The value of the normalizing probability p0 can be computed by using the obvious requirement, that the sum of all probabilities must be equal to 1:

  n 1  pn  p0    p0 1 giving: p0 1 for  1. (17) n0 n0 1

In (17) the sum of geometric series has been used. From (17) it is obvious that the traffic rate  must be less than 1, otherwise the sum of probabilities would not be 1 (not even limited). Inserting (17) to (16) gives the general formula for pn:

  p   n (1)( ) n (1 ) (18) n  

Formula (18) represents a very important result used later to obtain all the characteristics of the M/M/1 model. The relatively simple derivation of (18) was enabled by the Poisson process assumptions used when expressing the probabilities in (11). The equations (18) may be used directly to express these probabilities:

[service idle] = [not queuing on arrival] = p0 = 1 -  = 1 - /

[service busy] = [queuing on arrival] = 1 - p0 =  = /

n [n customers in the system] = pn =  (1 - ) [n or more customers in the system] = n [less than n customers in the system] = 1 - n

The derivation of [n or more customers in the system]:

    m nk n k n 1 n  pm    (1 )    (1 )  (1 )   (1 )   mn mn k 0 k 0 1 

17 Now the formula (18) will be used to derive quantitative characteristics (measures of effectiveness) of the M/M/1 model. (18) is the distribution of the discrete random variable number of customers in the system (probabilities of all possible random values). So it is possible to compute the expected value L that is the average number of customers in the system (sometimes called LS):

   n n n1 2 2 3 3 4 L npn   n(1   )  n (    ) 1(   ) 2(   ) 3(   ) .... n0 n  0 n  0 L   2   3   4 ....   (1     2   3  ...)

By using the formula for the sum of geometric series we get:

 L  (19) 1  

In Appendix 4 the mean system size L is computed directly from the generating function. Note again, that  must be less than 1, otherwise the number of customers in the system will grow permanently. In a similar way it is possible to find the average number of customers in the queue LQ. We assume, that the customer being served is not a part of the queue. So n customers in the system means that the queue length is n-1.

    LQ( n  1) p n  np n   p n  L (1 p0 )  (1 (1 ))  n1 n  1 n  1 11  2 LL (20) Q 1 

In (20) we have used the fact, that the second sum is a complement to p0 and (17). Note that (20) may be also used to compute LQ provided L is known or vice versa. It is also possible to find an average queue length LQQ provided there is a queue. Explanation:

queue length

A L  Q T Area = A A LQQ  ti

time t1 t2 T

To compute LQQ we need the conditional probability pn/q = [queue length is n / there is a queue]. To find the conditional probability, let’s use the general formula:

18 []AB [/]AB that looks in our case like that (for n  2): []B

[queue length is n -1 and there is a queue] p [queue length is n -1 / there is a queue] n [there is a queue]   pn n2 Using the above formula for pn-1/q , we may find LQQ:  2  2  2 (np 1)   n L 1 1   1   n2 Q LQQ( n  1) p n1/ q      2 n2 nn22 ppnn (1  )    (1  )   n2 nnn  200

1 L  (21) QQ 1

’ Note that in QTS LQQ is called Lq . The average queue length is a parameter that represents the quality of service especially from user’s point of view. Another parameters that we need are the average time W spent in the system (sometimes called WS) and the average time WQ spent in the queue. These parameters are necessary for example to compute costs caused by customers waiting for service. There is a very important the so called Little’s formula, that gives the relation between the average number of customers in the system L and the average time W spent in the system and between the average number of customers in the queue LQ and the average time WQ spent in the queue:

L = W LQ = WQ (22, 23)

First we give the justification (not formal proof) of the formula (22): let’s assume that the average time spent in the system is W. During this time the average number of newcomers is W, because  is the arrival rate (average number of arrivals per unit time). So at the instant a customer is leaving the systems, it sees (on average) W customers left in the system. Because in the stable state the average number of customers in the system is L, we have the above formula. Similar justification can be given for LQ and WQ (average number of arrivals during the time spent in the queue is WQ, that is the average number left in the queue when leaving the queue, that is LQ).

Little’s formula proof

We assume a stable system ( <1). By observing the system at the time t, we can obtain the following figures:

A(t) = number of arrivals till t D(t) = number of departures till t N(t) = number of customers in the system at time t. Clearly:

N(t) = A(t) – D(t)

19 At() We can also compute the arrival rate:   ,  for t ttt

t The total system time spent by all customers is given by the integral: R(t)  N(s)ds 0 Similarly we can compute the following:

Rt() Average time in system: WW W,  for t ttAt()

Rt() Average number in system: LL L,  for t ttt Then we have:

R()()()() t A t A t R t LWt t t t A()() t t A t Similarly for WQ and LQ. for t  we get L   W

By using the Little’s formula we get these formulae:

L 1 1 1 W L 1 W  ()   Q WWQ ()    (24, 25) 1      Q 1    

There is another obvious relationship between the average time spent in the system and the average time spent in the queue, because the total time spent is made of the time in the queue (that may be zero) and the time of the service:

1 WW (26) Q 

(26) can also be obtained from (24). Using the Little’s formula, it is possible to express a similar relation between L and LQ by multiplying both sides of (26) by :

 L L   L   L  r (27) QQQ

Where r =  is the average number of customers being served (that of course must be less than one). For multichannel models with c parallel channels r = / = c, see later.

LQ r

L

20 For a customer it is also important to know the probability, that the time spent in the system (or in the queue) will be greater than a certain value. Together with the queue length this probability represents the quality of service from user’s point of view. These formulae may be used:

t t   [spending more thante in system]  W [spending more than te in queue]   W (28)

Of course the probabilities of spending less than t in the system (or in the queue) are complements of the above values to 1. Because the time spent is a continuous random variable, the probability of spending exactly some time t in system (queue) is zero, but using the formulae (28), we can compute the probability that the time spent will be in a certain interval (t1, t2):

[spending more than t1 and less than t2] = [more than t1] - [more than t2]

Appendix 6 gives the derivation of the distribution of system and queue times that are then used to find the formulae (28).

And finally the variances of the four effectiveness parameters:

 22(1   ) Var[L ]= Var[L ]= (1- )2 Q (1- )2 1 (2 ) Var[W ]= Var[W ]= (29) (1- )22 Q (1- )22

5.1 PASTA

In this chapter we prove an important property of systems with Poisson arrival called PASTA (Poisson Arrivals See Time Averages). Some theoretical models are based on system states as seen by arriving or departing customers. So let’s define the following probabilities of a stable system ( = /c < 1) without any assumptions on arrival and service patterns:

pn = [n customers in the system] = portion of time with n customers in the system an = [an arriving customer sees n customers in the system] dn = [a leaving customer leaves n customers in the system].

Let’s find the relationship among these three probabilities.

Theorem 6: Arrival and departure probabilities are equal: an = dn.

Proof: let’s define the following quantities:

21 A(T) = total number of arrivals during time interval T. An(T) = total number of arrivals during time interval T that see n customers in system. D(T) = total number of departures during time interval T. Dn(T) = total number of departures during time interval T that leave n customers in system.

It can be shown that An(T) = Dn(T) + d, where d  {-1, 0, 1}. As a stable system empties infinitely many times, the difference between the number of arrivals and departures is in any time interval limited. So A(T) = D(T) + D, D < . Then by using the definition of arrival and departure probabilities we have:

D( T )( d ) D T d nn Ann( TD )(T ) DTDTDT()()() adnn= lim = limlimlim = T TTT D() T DD A( TD )( T ) 1 D( TD )( T )

Generally an  pn. To verify that, let’s consider a D/D/1 system with constant arrival intervals equal to 2 and constant service time equal to 1. Then clearly a0 = d0 = 1 and an = dn = 0, n > 0. For equilibrium (time) probabilities we have p0 = p1 = 1/2 and pn = 0, n > 1. Equality holds for systems with Poisson arrivals:

Theorem 7: If the arrival process is a Poisson process and inter-arrival times and service times are independent, then an = pn.

Proof: Let N(t) be the system state at time t. Then we can define the arrival and time average probabilities as follows:

pNn =lim t n [ ( ) ] t

an =lim [ N ( t ) nt /an arrival occured just after time ] t

Let A(t,t+δ) be the event that an arrival occurred just after time t, so we assume that δ0. Then we have

[N ( t ) n  A ( t , t   )] an =limlim [ N ( t ) n / A ( t , t  )]  limlim  tt 00   [A ( t , t   )] [(,Att )/() NtnNtn  ][()  ] [(, Att  )][() Ntn  ] limlim limlim tt 00[A ( t , t )]   [ A ( t , t )]

lim [N ( t ) n ] pn t

Note the key step in the above derivation based on A(t,t+δ) being independent of system state. So for Poisson arrivals we have the PASTA property and moreover we know that also departures leave time averages. Note that in the derivation of system time and queue time distributions in Appendix 6 we have used the PASTA property by replacing arrival probability by the time one.

22 6 General Results

Analysis of the M/M/1 model in the previous chapter contains some results that are general. Let’s consider a multichannel single queue system possibly with limited capacity and limited population and without any assumptions about the distributions:

 G/G/c/K/M 1 2  : : :

c

Here  is the actual arrival rate. Note that for systems with limited capacity it can be smaller than the rate of attempted arrivals. There are c identical parallel channels with mean service duration 1/ (service rate ) each. There are no assumptions on arrival and service distributions. Let’s also assume that the system can reach a steady state in which pn = [n customers in the system]. Clearly the sufficient steady state condition is:

 r   1 or   c  (30) cc

Where  is the traffic rate, here generalized for multichannel systems.

These are the definition formulae for the average number of customers in the system (L) and the average number of customers in the queue (LQ):

  Lnp  n LnQn c p () (31) n0 nc1

Let T be the random actual time spent in the system and TQ the random actual time spent in the queue. Then by definition:

WTWT[][]QQ (32)

Length (31) and time (32) parameters are related by Little’s formulae:

L = W LQ = WQ (33)

Let TS be the actual random service duration. Then:

11 [][][][][]T T  T  T  T  T  or W  W  (34) QSQSQQ

23 Multiplying both sides of (34) by  together with (30) and (33) gives:

L LQQ  c  L  r (35) where  rc (36)  is the average number of served customers. Note that (33) - (35) are general conversion formulae among the four effectiveness parameters (L, LQ, W, WQ). We shall refer to them later in various models because it is enough to derive only one of the four effectiveness parameters. (36) gives the average number of served customers. Then the average number of customers in one channel is r/c =  = /(c) (the traffic rate). Using this we can compute the probability pB that a channel is busy. In any channel there is either no customer with probability 1-pB or one customer with probability pB. Using these two states and their probabilities we can compute in other way the average number of customers in one channel:

1 pB +0(1-pB) =  which gives pB = /(c) =  (37)

Two more general results can be found for single channel G/G/1 systems. From (31) we get - see also (20):

   LQ( n  1)(1 p n   ) np n   p n  L   p0 (38) n1 n  1 n  1

Finally using (35) and (38) we get:

pp001   or 1 (39)

Note that all results in this chapter are very useful because there are no limiting assumptions about the arrival and the service patterns.

6.1 Markovian Systems with State Dependent Rates

Derivation of the M/M/1 model can be generalized for systems where the arrival is still Poisson and service exponential, but the rates depend on the system state. State diagram:

  0 1 n-1 n 0 1 n-1 n n+1  1 n-1 n n+1

We shall prove the following formula for system state probabilities:

n 0  1  2... ni 1  1 pn  p00 p  (40) 1  2  3... nii1 

24 By using the stochastic balance and assuming stability we get:

(rate of leaving state 0) p00 = p11 (rate of entering state 0) (rate of leaving state n) pn(n+n) = pn-1n-1 + pn+1n+1 (rate of entering state n)

From the above we get:

l0 pp10 m1

ln m n l n 1 pn11 p n p n ,0 n mmnn11

lm11 l 0 lml 110 l 0 llmlml 101010 ll 01 p2 p 1 p 0 p 0 p 0 p 0 p 0 m2 m 2 m 2 m 1 m 2 m 2 m 1 m 1 m 2

Similarly

n 012 i1 p3  p0 so we assume pn  p0  , n  0 12 3 i1 i

Proof by induction:

1) shown valid for k = 1, 2, 3 2) we assume the formula valid for n = k 3) inserting for k+1:

kk1 k  k  i1  k  1  i  1  k pk1 p 0 p 0 k11ii11  i  k  i  k k k k p0k  i 1 p 0  k  i  1 p 0  k  i  1 pk1      k1i1  i  k  1 i  1  i  k  1 i  1  i k1 i1 ppk10  i1 i

Note that for constant rates (40) becomes (16). See also Appendix 7 where the formula (40) is found by balancing rates through cuts.

7 Model with Limited Capacity

The M/M/1/K model is made of a Poisson arrival (arrival rate ), one exponential channel independent of the arrival (service rate ), FIFO (or not specified) queue that can contain up to K-1 customers, because the total system capacity is K, and unlimited customer population. The limited system capacity represents the natural limitation of queue length in all practical systems. It means, that if a customer enters the system, that already contains K customers, it

25 has to leave (renounce) without being served. This fact may be expressed by state dependent arrival rates that drop to zero when the system reaches its capacity:

  0 nK n    0 nK

Inserting to (40) with constant service rates  gives:

n n i1  pn  pn0  K(0 ) ppn 0   i1 i  pn 0 ( n K )

Unlike M/M/1 model, the models with limited capacity always reach a steady state, whatever is the value of the traffic rate  = /. The value of p0 can again be found from the fact, that the sum of all probabilities equals to 1, but now the sum has a limited number of terms:

 K 1  K 1 1  n giving: p  if   1 pn  pp00 () 1 0 K 1 nn00 1  1  1 If  = 1, then pn = p0 and the above sum becomes (K+1)p0 = 1 giving: p  0 K 1 By inserting p0 we get a formula for pn:

 n (1 )  K 1   1  1  pn   0  n  K (41) 1   1 K 1

Like with the M/M/1 model the above probabilities are used to compute the measures of effectiveness of the M/M/1/K model. So for the average number of customers in the system L we have for  = 1:

KK1 1 (KKK 1) L npn  n    and for   1: nn00KK1 1 2 2

KKK1  1 1 L np ( ) nn  n (  n   n1 )  1(    2 )  2(  2   3 )  ... n KKK1   1   1  n01 n  0 1   n  0 1  

1 1 (1 K 1 ) LKK  2  3... KKKKK  1   1   1  ( 1)   1 KK11 1 1   1  

Above the last two terms have been at first appended (their sum is zero) and then the third and the second terms from right were swapped. This forms a geometric series whose sum is the first term in square brackets, the second term is the rest. So after multiplying the two terms in square brackets we have the formula (42).

26  (K  1) K 1  K 1  1  11 L   (42) K   1  2

The first term in (42) is the mean size of the corresponding M/M/1 model, the second term represents the loss caused by the limited capacity. Remaining characteristics of the system may be obtained by using the conversion formulae (33) - (35). For convenience we present a summary of conversion formulae where each parameter is expressed by the other three (and the basic parameters , , ):

L LWQQ   W    LQQ LW    W   (43) L 11L L 11L WW   Q  WWQ     Q   Q   

There is only one problem when using the conversion formulae (43). Not all systems have the basic parameters (, , ) constant. For example the M/M/1/K model changes  that becomes zero when the number of customers in the system is K. To use the formulae (43) correctly, we have to insert the average or effective arrival rate that we shall call eff. It is the arrival rate of those customers who enter (are not rejected), so eff < . Graphical explanation:

N(t)

K

t

(t)

eff

t

27 Maximum K-1 in queue

 eff

 - eff

Let pK be the probability that the system is full = probability that a customer is rejected.

KK1 eff  np n    p n  (  p n  p K )    1  p K  (44) n0 n  0 n  0

The second sum is true because K = 0 and n is never bigger than K. The third term was simplified because the sum of all probabilities is 1. pK can be computed by (41). Having L computed by (42), the other three parameters of M/M/1/K models can be computed as follows:

K (1 ) LL 1 pK  K 1 W  WWQ  LWpQ eff W QK Q(1 ) 1  effK (1 p )  (45) Also:

eff  (1  p ) and LL where eff < 1 is the average number of customers effK  Q eff being served.

8 Multichannel Model

The M/M/c (multichannel) model is made of a Poisson arrival (arrival rate ), c independent identical exponential channels with service rate  each, FIFO (or not specified) unlimited queue, and unlimited customer population. In multi-channel systems customers may be served by any channel. Selection of the channel (if there are more idle channels) is not specified, because the four system parameters are independent of the selection algorithm. It is possible to assume for example a random selection that will cause equal utilisation of the channels.

1

Arrival rate 2  =  n n

c

28 Unlike in the M/M/1/K model the arrival rate  is constant for all system states. But because the number of working channels may change, there is no constant effective service rate that may also be called departure rate (number of customers served during a time unit). All channels have the service rate  (average service duration 1/), but if there are two working channels, the average number of customers served during a time unit will be 2, for three working channels 3, etc. until the maximum value c for all channels working. So we have a state dependent service (departure) rate:

nn c0  n   cn c 

Inserting to (40) gives:

... n p  p  p for 1  n  c n  2 3...n 0 n! n 0 ...  n ppp for n  c n 2   3  ...c   c  ...! c  00 c cn c n

 The condition for a system to reach a steady state has the form  1 where  is the c traffic rate of the M/M/c model. Using  and r = c the formulae for pn may be written in the following way: n n n c p00 r p  1 nc   nn!! pn   (46) cc n p r n p  00nc  c!! c cnc

To find p0, let’s compute the sum of all probabilities:

ccn n  c n n c c c () c  c cn1 pn 1   p0   pp 00      n0 n  0n!!!! n  c  1 c n  0 n c n  0

The second sum in square brackets is a geometric series, so we have:

1  1  1 c()()()cn c c  c1   c11 c  n c  c   c r n r c  p0            (47) nnn000n! c !(1 )   n ! c !(1  )   n ! c !(1  r / c ) 

Formula (47) is not very difficult to evaluate because c is mostly not big, the second term in square brackets is evaluated only once, and the sum is in fact this: 1 + r + r2 /2 +r3 /6 + ... - each term is obtained from the previous one by multiplying by r/k, k=1,2,...c. In the M/M/c model, the queue exists only if there are more than c customers in the system. So to compute the average queue length LQ, we have – see (31):

29   c cc cn cn11 c cc  1c  m 1  LQn( ncp  )   ( ncp  )( ) 0   pnc 00    pm n c 1 n  cn  111 cm  c! cc !! cccc dc dc   1 Lcm111 ppp  cc Q 000   2 c!! dcm 11 dc  ! (1 )

  m1 d  m  Above we used the following: m    m1 dp m1 

That gives the result: cpcc 1 L  0 (48) Q c!(1)  2

The other parameters can be computed by conversion formulae (43):

 L L L L  r  LWW  Q Q QQ 

9 Model with Limited Population

In this model we assume that the total number of possible customers is relatively small such that the system state (number of customers in the system) affects the input rate, obviously in negative way (the more customers in; the less frequent inputs). A typical example is a certain number of machines maintained by a serviceman. Arrivals are failures and if all machines are down, arrival rate drops to zero. We assume that the total number of customers is M and that the arrival of each customer is a Poisson process with rate . Using the machines example, 1/ would be the mean exponential time between failures. n= is the state and arrival independent service rate of one exponential channel, the queue is FIFO (or not specified) and unlimited. In this model we have a state dependent arrival rate given by the following formula:  (M n ) 0  n  M n    0 nM

Inserting to (40) and simple derivation gives:

nn i1 (Mi 1) pn  p00 p ii11i n  ()!Mn pn  p0  M( M  1)...( M  n  1)  ()!Mn

nnMn!!M pn  p00 r  n! p r 1  n  M ()!!M n n n

30 nnM ! M pn  p00 r  n!1 p r  n  M (49) ()!Mn n

Scaling factor p0 can be found by computing the sum of all probabilities that equals to 1:

1  M M ! n  pn 1 pr0   (50) n0 n0 ()!Mn

(50) and (49) together with (31) and (43) can be used to compute the effectiveness parameters numerically. For single channel systems a closed formula can be found. If L is the average number of customers in the system, then (M - L) is the average number of customers outside. This means that the effective arrival rate is eff = (M – L). Then the average traffic rate equal to the average number of served customers – see (36) for c = 1 is:

 ()ML r eff (51) eff 

Using (35) and (38) we have the following:

()ML L L  r  L   L (1  p ) Q eff  0

The last two terms represent an equation that solved for L and after inserting for LQ gives:

  L Mp (1  ) L Mp (1  ) (52)  0 Q  0

Finally Little’s formulae take the form:

LL LLQQ W  WQ  (53) eff ()ML eff ()ML

9.1 Model with Spares

In limited population models the customers are typically machines. Then the natural requirement is the maximum expected number of operational machines. This number can be increased by using the so-called spares. These are machines ready to replace any machine that breaks down. Assume that the number of spares is S. Then the above model can be generalized as follows:  M 0  n S  n ()M  S  n S  n  M  S   0 n M S

Effectiveness parameters can be computed numerically.

31 10 Other Markovian Models

This Chapter contains basic results for several Markovian models that have not been dealt with so far, mostly combinations of previous relaxations of the very strong assumptions of the M/M/1 model.

10.1 Multichannel with Limited Capacity and Limited Population

This model is a combination of the M/M/c, M/M/1/K and limited population models from chapters 7, 8, and 9. Let’s take logical assumptions that K > c, otherwise there would be no queue and M > K, otherwise there would be no capacity limitation. Then we have these state dependent rates:

 ()M 0nn  M nn c0  n   n    0 nM cn c  where  is the arrival rate of one customer and  is the service rate of one channel. Inserting these state dependent rates into (40) gives:

n (M iM  1) n n 1( )!  pn  p00  p r M( M  1)...( M  n  1) i1 i nM!( n )! 

nnM ! M pn  p00 r  p  r0 n c n!( M n )! n

cn1 (Mi  1) ( Mi   1) MM (  1)...( McMcMn   1)(  )...(   1) p p  p rAn n 00 nc i1 i i c c c! c cn ()!!!M n  nn  n c M  pn  A  p0 r c  n  K ()!!!M n  n c n 

pnn 0 K (54)

The scaling factor p0 can be computed in usual way:

1 K cK1 cn nnMM    nc!  pn 1 p0  r  r   (55) n0 n0 nn  n c   c!

Closed formulae for this model are not available, the probabilities have to be computed numerically using (55) and (54). Effectiveness parameters can then be computed by using definition formulae (31) together with Little’s formulae (33) where the effective arrival rate has to be used:

KK11 eff  np n   p n () M  n (56) nn00

32 10.2 Multichannel with Limited Capacity and Unlimited Population

This model M/M/c/K is a combination of the M/M/c and M/M/1/K models from chapters 7 and 8. Let’s assume that K > c, otherwise there would be no queue. This model can be obtained from the above one by making M   and M   where  now applies to the whole population and for simplicity we shall use the same symbol. Arrival rate is now constant till reaching the capacity, service rate state dependent as above:

, 0 nK nn, c  n   n    0, nK cn, c 

Inserting to (40) gives:

 n 1 p p  p rn 0  n  c n 00nn!! n

 n 1 p pp rc  n K n n 00c!! ccn c c nn c

pnn 0 K (57)

The scaling factor p0 can be computed in usual way:

1 c1 rrn c(1  K c 1 ) 1   1 cK1 nn rrn0 nc! !(1  ) p    (58) 0 nc  1 n0 n!! n c c c  c1 rrnc   (Kc   1)  1  n0 nc!!

Derivation of the second term of (58): r c 1  K c1  n nc c     1 K r   r r K  c! 1   r  ,   ,  nc    nc     nc nc   c nc c c!  c c c! nc r   (K  c 1)   1  c! 

Closed formulae for this model are available. We can use (31) to find the average queue length:

K p K r n r c rrn n c L  (n  c) p  0 (n  c) and using  nc gives: Q  n  nc c n c c n c nc1 c! nc1 c r c r c

cK c K c c K c c Kc1 p0 rn c 11 p 0 r  i  p 0 r dd i p 0 r  1  LQ () n  c   i       c!n c 1 c ! i  1 c ! d i  1 c ! d  1 

33 prc  LK c 0 [1 K cK 1  c (1   )( 1) ] 1 (59) Q c!(1  )2

For  = 1 we have to apply twice the L’Hopital rule. We then get:

prc LK c0 (1)( K  c ) 1  (59’) Q 2!c

When using the Little’s formulae (33) we have to use the effective arrival rate given here by the formula (44). So we have:

L LLQ  eff/(1  p Q )/(1   L  ) K r  p  Q   K (60)

K LLQQ LL pr0 WQ  W  pK  Kc (61) effK (1) p effK (1) p cc!

Note that the results from the chapter 10.1 can be also used for multichannel with limited population and unlimited capacity. Just replace K with M in formulae (54) – (56) because the number of system states is limited by the number of customers only.

10.3 Erlang’s Loss Formula

The M/M/c/c model is a multichannel with c channels and the system capacity c (it means no queue). If all c channels are busy, the customer must leave without being served. For this model the formula (58) simplifies to: 1 c r n p0   (62) n0 n!

After inserting to (57) – first case – we get the following formula for pn:

rn n! pn c i 0  n  c (63)  r i0 i!

From (63) we get the famous Erlang’s loss formula for n = c that also holds for M/G/c/c models with general service time distribution. This is another useful insensitivity conjectured by Erlang and proved later. For the proof and more discussion see book [1].

rc c! pc  c i = [customer is rejected] = [ system is full] (64)  r i0 i!

34 As the name implies it can be used to compute the probability of loosing a customer in an M/M/c/c model for given r = /. This formula was largely applied in design of old telephone exchanges that were basically M/M/c/c systems.  was then the number of attempted phone calls per unit time (mostly one hour) and 1/ was the average call duration. As there were many clients, the Poisson arrival assumption used to be more or less satisfied and due to the insensitivity it is not required for call duration. Another problem is the numerical evaluation of the formula (for c being typically a large number). One approach is to multiply the numerator and the denominator in (64) by e-r. All terms are then Poisson probabilities – see (4) – that can be taken from tables or in Matlab there is the function poisspdf(c,r)that with these arguments returns rce-r/c!. Note also that the denominator is the cdf, so in Matlab the loss probability can be computed directly as poisspdf(c,r)/poisscdf(c,r).

10.4 Model with Unlimited Service

The M/M/ model deals with systems where all customers are always served immediately (no queue) by identical exponential channels. The only interesting parameter of this system is the distribution of the number of busy channels represented by probabilities pn (where n is the number of customers = number of working channels in the system). Arrival rate is constant, service rate is state dependent n = n. By using (40) we get the formula for pn:

1 nn n rrr r r pn  p00 pe   and after inserting p0: pen  (65) nn!!n0 n!

Note that the system state has Poisson distribution that we already know from the chapter 4.2. From the above formula it is possible to find the probability of not more than n customers in the system: n r k [not more thanne customers]   r (66) k0 k!

Using (31) and simple derivation we can get the average number of customers in the system L equal to the average number of working channels:

 n  n1  m rr  r r  r r  r r  L npenn    er   er   erer   (67) n1 n  1n! n  1 ( n 1)! m  0 m ! 

Note that for unlimited service models LQ = WQ = 0 and W = 1/. Similarly with the previous model, results obtained for this theoretical model can be applied in those cases, where waiting is not possible because of the nature of the system. The above formulae can be used for example to find the required number of channels that will always serve a certain percentage of customers. Self-service is another example. Formula (40) can be used for other models with state-dependent rates. For example if we assume any rates up to a certain state K and then constant rates with / < 1, then the probabilities and the effectiveness parameters can be computed exactly. Closed formulae are also available for systems with 2 different service rates. Other systems can be evaluated approximately by taking large numbers of terms of infinite sums.

35 11 Model M/G/1

The M/G/1 model is made of a Poisson arrival (arrival rate ), one channel independent of the arrival with any (general) distribution, FIFO (or not specified) unlimited queue, and unlimited customer population. For the channel we must know the mean service duration 1/ and its standard deviation  (note that  is the standard deviation of the service time - not of the rate). These parameters can be obtained for example experimentally. For the M/G/1 model we can use the so-called Pollaczek - Khintchin formula that is maybe the most important result of queuing theory for single queue systems. For LQ it is this, where  = r = / is the usual traffic rate:

 2  2 ( ) 2 L  1 2  2  (68) Q 2(1)   2(1)

Other parameters can be computed by conversion formulae (43) without any problems, because the rates are not state dependent. The above formula is very important, because we do not need any more the very controversial assumption of exponential service. Arrival is still Poisson, but this assumption is typically much more acceptable than an exponential service. Note that the output is not Poisson because of general service distribution. Several proofs of the formula (68) exist, Appendix 8 contains the derivation based on moments.

12 Simple Non-Markovian Models

This chapter describes some models where at least one of the two processes is not Markovian. These models are mostly special cases of the M/G/1 model. In the following models we give a formula for one effectiveness parameter, the others can be computed by the conversion formulae (43).

Model M/Ek/1

The M/Ek/1 model is made of a Poisson arrival (arrival rate ), one channel independent of the arrival with Erlang distribution, FIFO (or not specified) unlimited queue, and unlimited customer population. Values of a random variable with Erlang distribution are sums of k independent equally exponentially distributed random values. So it is represented by two parameters: mean value of the corresponding exponential distribution (1/E when applied to service, 1/E when applied to arrival) and the multiple k called shape factor. The distribution is then called Erlang type k or Ek distribution. The mean value and the standard deviation of the Erlang distribution are defined by these formulae:

1 k 2 k 1 []X  Var[XX ] [ ] 22  (69) E E k

For k = 1 the Erlang distribution becomes exponential. For bigger k the Erlang distribution is less and less random, for k   the values become constant equal to 1/. Erlang arrival means registering every k-th arrival, Erlang service means being served by k equal

36 exponential services in serial. Erlang distribution is often used as an approximation of other more general (typically experimentally obtained) distributions. Because the expected value and the standard deviation are known, it is possible to use the Pollaczek – Khintchin’s formula (68):

 2 1 LQ 1 (70) 2(1  ) k

Model M/D/1

The M/D/1 model is made of a Poisson arrival (arrival rate ), one channel independent of the arrival with constant service time 1/ (constant service rate ), FIFO (or not specified) unlimited queue, and unlimited customer population. An example of an M/D/1 system can be a car wash line, runway for planes to take off, and all other systems with practically constant service time. Because  = 0, the Pollaczek - Khintchin formula (68) simplifies to:

 2 L  (71) Q 2(1)

Model D/M/1

The D/M/1 model is made of an arrival with constant intervals 1/ (constant arrival rate ), one channel independent of the arrival with exponential service (service rate ), FIFO (or not specified) unlimited queue, and unlimited customer population. For this system the average number of customers in the system L may be computed by the following formula:

 L  (72) p0 where p0 can be found as the solution of the equation:

p  0  p0 1e that is sometimes expressed graphically (for 0    1).

This model is a special case of the G/M/1 model that we shall deal with later.

Model D/D/1

The D/D/1 model with constant arrival intervals 1/ and constant service time 1/ is either unstable (for  = / > 1) or it has only two states: none or one customer with probabilities:

p1 = / =  and p0 = 1 - p1 = 1 -  (73)

There is no queue, the average number of customers in the system L is equal to p1, and the time spent in the system is the service time 1/.

37 13 Queuing Networks

Queuing networks are systems that contain two or more single queue systems that are not independent. Note that so far all systems were made of one queue; after being served the customer had left the system. In queuing networks a customer may pass through more services that we are going to call stations; at each station (that can be a multichannel) there may be a queue of waiting customers. There are many practical examples of queuing networks:

- bank where a customer is served at first by a teller, than by a cashier. It is also possible to consider separate queues at each counter - production line where components are processed by a number of machines - communication networks that use packet or message switching - all kinds of transportation - processes in a computer that need various resources to run, etc.

All theoretical models are rather complicated and all exact results are based on very strong assumptions. In this text we present just a basic summary of results.

13.1 Feed Forward Networks

As the name suggests, these systems involve acyclic networks without feedbacks. It is obvious that in order to specify the input to a station, we have to know what is the process generated by a single queue system. We know that the output from a stable system with unlimited capacity has the rate , but what is the distribution? There is a very important result given by the following theorem.

Theorem 8: Output from a stable M/M/c/ system is a Poisson process.

For proof see Appendix 9. This theorem suggests a simple method, assuming that all stations with successors are M/M/c/ systems:

Use the theorems about splitting and joining of Poisson processes to find rates of input Poisson processes of all stations. Then solve the stations separately as M/M/c/ systems. Moreover the stations without successors can be M/M/c/K, M/G/1 or anything that we can solve. Obviously we assume stability ( < c) of all stations.

13.2 Open Jackson networks

Theory on Open Jackson networks (1965) represents the fundamental result about queuing networks. Using the following figure we first summarize the assumptions.

38 1 1 1 r1i Station i

ri0

k k k = number of nodes (stations) (subscript 0 is reserved for the environment)

 = rate of the Poisson arrival to the whole network

T r = (r01 r02 …r0k) = vector of input probabilities where r0i = [arrival to station i]

k Obviously r0i 1 i1 R = [rij] = matrix of transition probabilities

where rij = [moving to j after service in i], i, j =1,2 ,…, k. Possibly rii > 0

ri0 = [leaving network after service in i]. This figure is in fact not needed, because it complements the sum of the i-th row of R to 1: k

ri0 =1rij 1 - [other service needed after i] j1

T  = (1 2 …k) where i = exponential service rate of one channel of station i

T c = (c1 c2 … ck) where ci is the number of channels in station i

T n = (n1 n2 …nk) is the network state vector where ni = number of customers in station i.

The above variables define the network including its topology. Note that all services are exponential, all arrivals are Poisson. For computed figures we use these symbols:

i = r0i  = arrival rate from outside to station i (this is a Poisson process)

i = total effective arrival rate to station i vi = mean number of visits to station i by each customer (i = vi)

i i = 1 = traffic rate at i. If i  1 for at least one i, the network is unstable. cii

39 In order to solve the network we need the probabilities p(n) = pn of various network states. They can then be used to obtain various effectiveness parameters of the stations and the whole network. First let’s solve the so-called Traffic Equations to obtain values of vi and i.

The total input to station i is given by the input from outside and all other stations:

i   i  1r1i  2r2i ...  k rki where jrji is the rate of the traffic from j to i. Solution:

k i  i   jrik ji 1, ... , j1

Using i vr i ,  i0 i  k vi  rv0 ij  r ji  ik 1, ..., , 0 j1 Dividing both sides by  and changing summation to matrix notation gives:

k vi rv0 ij  r ji ik 1, ..., j1 v r  RTT vI  R() v r v( I  RT ) 1T rI Assuming R full rank of the matrix

After obtaining v we compute  and  easily. Solving the traffic equations thus provides all figures related to individual stations. To find the probabilities of network states, we can apply the fundamental Jackson Theorem about the solution in product form. This is the Jackson theorem for single channel stations:

nn12 nk Theorem 9: pC(n )... 12  k

For proof see Appendix 10. The normalizing constant C = p0 = [empty network] can as usual be computed from the sum of all probabilities equal to 1:

 nn12 nk C12 ... k  1 nn100k 111         n1 n 2nnkk n 1 11 C 1  2... kk    (  1 ) (  )        11 n110 nkk  0   n  0 n  0  1 k k Cp0 (1 1 ) (1  ki )  (1   ) i1

And inserting to Theorem 9 formula gives

k ni p(n ) (1ii ) (74) i1

40 Using (74) we can compute marginal probabilities of states in individual stations:

    nnii n i n k n1 11 [niii customers i p n ii in p station i k ] ( )...  0       1 1 1 n10 ni 1  0 n i 1  0 n k  0

    k k nniin1 n i11 nn ki 1 ni p0ii 1 i  1 k  1 i  i (1  )  (1ii )       (1  ) n10 ni 1  0 n i 1  0 n k  0 i  1 j  1, ji j

From above we see that we get the same probabilities as for the M/M/1 system though stations are not M/M/1 (due to feedbacks, the inputs and services are not generally independent). Nevertheless the equilibrium probabilities are equal, so we can use the M/M/1 formulae to compute the effectiveness parameters.

Product form solution given by Theorem 9 can be generalized to networks with multichannel stations. Marginal probabilities are then the same as those for the M/M/c systems. Another generalization considers classes of customers that have their own behaviour (input and transition probabilities). This partially relaxes the very strong Markovian behaviour assumption on Jackson networks.

Network effectiveness parameters

From the theory of Jackson networks it follows that we can obtain marginal probabilities of the stations and solve them as M/M/1 or M/M/c systems by known formulae. Let the effectiveness parameters of station i be Li, Wi, LQi, and WQi. Also let’s repeat that vi is the mean number of visits to station i by each customer. Individual parameters can be arranged into vectors:

TTTTT W(W1 ... WkQQQk ) W  ( W 1 ... W ) L  ( L 1 ... L kQQQk ) L  ( L 1 ... L ) v  ( v 1 ... v k )

Then we can compute the following network parameters:

k Mean total number of customers in the network: L   Li i1

k Mean total number of customers waiting in all queues: LQ   LQi i1

k T Mean total time in network (sojourn time): W vWii vW where viWi is the mean time i1 spent by customers in station i.

T Mean total time spent by waiting in all queues: WQQ vW where viWQi is the mean time spent by customers waiting in queue of station i.

kk Probability of all stations being busy: [all busy] (1 pii (0))   ii11

41 13.3 Closed Jackson Networks

Assumptions are similar to open networks, but:

 There is no input:  = 0, r is not defined, i = 0 , i = 1, …, k  There is no output: ri0 = 0, i = 1, …, k (sums of rows in R are equal to 1)

N = total number of customers in the network. k T For all system states n = (n1 …nk) we have nNi  . i1 T Traffic equations get the form  =  R (note that R is singular). Using (i = ii ) we get:

k i  i  jr ji  j , i 1, ..., k j1

In the above one equation is redundant. We solve the equations by fixing one i , removing one equation and solving the remaining equations for the others. Jackson Theorem about product form solution holds, but there is a problem to find the normalizing constant C because there is a finite, typically very large number of states. Two algorithms to compute the constant C approximately (Buzen, MVA) are described in [1].

For about 10 years till 1975 only Jackson networks were used to analyse mathematically computer and other systems that could have been formalised as queuing networks. Since 1972, there were signs of possible extensions that were published in definitive version in 1975. Today these generalised networks are called BCMP networks, where the abbreviation is made of initials of the authors (Baskett, Chandy, Muntz, Palacios). This is a simplified overview of the extensions of BCMP networks compared with Jackson ones:

 There are classes of customers (customers of different types). A class may represent for example a fixed path in the network.  Network state is a vector of vectors of various lengths, because for each station (queue) the currently present customers may have different classes.  Movement in network is Markovian, but probabilities for various classes may be different and a customer may change its class when moving between stations. Probabilities may be state dependent.  There may be a very general service made of parallel, serial, and cascade combination of exponential/Erlang individual channels that may approximate practically all service distributions.  There are four possible service/queuing disciplines: - FIFO, single state dependent server - Time-sharing service with state dependent slices - Sufficient number of servers (no queue) - LIFO, single server with absolute (pre-emptive) priorities of customers  Model with limited queues is also possible.  Poisson arrival with a state dependent rate.

42 There are (complicated) formulae to compute state probabilities and consequently other system characteristics.

Apart from the above exact (rather complicated) methods, there are also approximate methods that intentionally simplify the assumptions to get maybe less accurate, but much more simple procedures to obtain the results. For example the so-called Decomposition Method studies stations (and their queues) independently. Instead of the joint probability p(n), it gives the mean number of customers at each station and its response time. There are several other methods based on forming subsystems (groups of servers) that are analysed separately with possible further analysis of their interaction. Another method called Diffusion Approximation uses results from thermodynamics. Movement of customers in the queuing network is viewed as a chaotic Brownian movement of molecules. To model the network behaviour the differential equations of thermodynamics are used.

14 Selected Advanced Models

14.1 State Dependent Rates Generalized

We have found formula (40) that has been used to derive basic Markovian models. In addition to models from chapters 7 – 10 it can be applied to several other situations. To simplify next derivations, let’s express it as follows:

nn ii11 pnn p00  n p Mwhere M ii11ii

For all Markovian systems with finite number of states with maximum state K it can be applied directly to compute the probabilities numerically, the normalizing constant is also computed numerically by

K 1 pM0 [1]  n n1

The effectiveness parameters are then computed by definition formulae (31), to apply Little’s formulae we need the effective arrival rate computed numerically by

K1 eff  np n n0

Moreover for single channel systems we can use formulae (34) and (38) to compute the mean service duration directly:

LLQ 11 p00 p   WTTQSS [ ] so [ ]  eff  eff  eff  eff

Note that in QTSTM the model is called “Finite Birth-Death Model”.

43 For general case with infinite number of states and at least one rate permanently changing, we can obtain only approximate solution by considering only limited (large) number of states. There is an exact solution to systems with infinite number of states where after some k the rates remain constant with stable traffic rate:

nn01n  kn  k   p0 Mn 1  n k nnn   1 p nk n kn k   p0 Mk  n k

Where p0 is computed numerically:

kk m 11 p0 [1]  [1] Mn  MM kn  M k  nmn111 1 

Definition formula (31) results in:

 k n knn 1 1 Mdk  L npn   nppnM n 000  k  LpM k   kk kk11 n Lp  n1 n  1 n  kn  111 kn  k    d  kkk111 k Mkkk dM1 dM 1( k 1)  (1    )   Lkkk  pL000 kkk111 pL  p   2   dd 1  11(1    )      

The effective arrival rate can be also computed exactly:

k 1  k  1 k  1 eff  nnp    nn p    p n    nn p  (1   p n ) n0 n  0 n  k n  0 n  0

Note that in QTSTM there are two models called “Infinite Birth-Death Model” and “General State-Dependent Birth-Death Queue”.

Several special cases have also been studied. In QTSTM there is an unlimited capacity single channel model called “Simple Markov Queue with State-Dependent Service” with constant arrival rate and two service rates switched at a given system state k:

n 1 1 nk  10p1  n k  n   n kp 11 n k11 n  k  12     2 nk 1 2p 0 n k 12

Exact closed formulae for p0 and effectiveness parameters are available, for details see [1]. This model can be used in practical situations when for example after reaching a certain queue length the service is given some help. Alternatively the service rate may at certain system state decrease due to panicking and/or other reasons.

14.2 Impatience

These models try to incorporate human impatience into queuing models. There are generally three forms of impatience. Balking is the reluctance to join a long queue, reneging is the

44 reluctance to remain in the queue after long waiting and jockeying is changing queues if parallel channels have different queues. Models of the first two cases are available.

Balking

Reluctance to join a long queue can be modelled by state dependent arrival rate where the basic arrival rate (valid for the empty system) is multiplied by a decreasing the so-called balking function b(n) that is the probability of joining the queue in system state n. We assume constant service rate and other M/M/1 assumptions satisfied:

n n n bn()  n   0(1)()1(0)1  bnbnb     pp n 0   /   bi (1)  i1

Generally the normalizing constant is computed approximately by considering a large number of states:  n n 1 pb0  i [1  ( / ) ( 1) ] ni11

In QTSTM there is the model “M/M/1 with Balking …” with two available balking functions:

1 b(),() n ean b n na 1 where the parameter a represents willingness to join the queue.

Reneging

Leaving a queue before service can be modelled by an increasing state dependent the so- called reneging rate r(n) added to the service rate that results in state dependent departure rate. We assume constant arrival rate and other M/M/1 assumptions satisfied:

n n 1 n   nn   r() n r ( n  1)  r () n r (0)  r (1)  0 p  p0  i1   rn()

Generally the normalizing constant can again be computed approximately by considering a large number of states:  n n 1 1 p0 [1 ] ni111 rn ( )

In QTSTM a model is not available. An example reneging rate function is:

an r() n e  where n/ is the estimate of the waiting (system) time in state n. Balking and reneging can be combined in one model in obvious way.

45 14.3 Bulk Input

There are situations where the assumption of single arrivals is limiting. For example people may arrive and ask for individual service in groups, in manufacturing a number of parts arrive to a machine on a palette and then they are processed one at a time, etc. To still make use of the Markovian results, we shall assume that batches of various sizes arrive in separate independent Poisson processes with particular rates, so these are the assumptions:

K = random size of an arriving batch k = arrival rate of the Poisson process of batches of size k, k = 1, 2, …   = composite arrival rate of all batches:   k k1 ck = probability that an arriving batch has size k: ckk /  = constant service (departure) rate of single customers.

The problem is that the process is not a Birth-Death process anymore because each arrival makes a possibly long “jump” in the state diagram to the right. Without any restrictions on the batch size, each state n can be reached by an arriving batch from all states 0, 1, … n-1 and also from state n+1 by a service completion. By an arrival to state n, any state n+1, n+2, … can be reached. So by using the stochastic balance approach, we obtain the following equations:

nn Input rate to state n pn11  p n  k  k  p n     p n  k c k kk11  Output rate from state n pn  p n  k  p n   p n  k1 n Together: pn (  )0  , p n10    1 p n k c k n  p   p  k1

After a (long) derivation based on two generating functions of steady-state probabilities and batch size probabilities respectively a closed formulae are obtained:

 r[][] K2   K L r     r[ K ]  1 L  L   [ K ] 2(1  )   Q eff

These formulae simplify for the case of a constant batch size k:

[],[],[]K22 k K  k  r K  rk r[ K2 ]    k k  1  L     2(1 ) 2(1   ) 2 1   22  (k 1) L L      [] K   k Q2(1  ) eff

Note that the first ratio in the formula for L is the increase caused by k > 1 as compared with M/M/1 and for single arrivals (k = 1) we get the L of M/M/1.

46 14.4 Bulk Service

Similarly to the previous chapter there are situations where the assumption of single services is limiting. For example people are served in groups (various attractions), in manufacturing the parts are processed (painted) in batches, etc. Regarding the batch size, in existing models it is not considered random, but there is a given (maximum) batch size K. To start a service with less than K customers in the queue there are two cases. Either the service can start with a smaller number than K customers or it has to wait until all K customers are available for a complete batch. Both cases have practical applications, so we consider them separately.

Bulk service with variable batch size

These systems (called Type 1 in QTSTM) assume the following in addition to usual M/M/1 properties:

 = arrival rate of the Poisson input of single customers  = service rate of batches, same for any batch size,  = / < 1 K = maximum batch size. Service can start even for smaller number of available customers. Moreover if less than K customers are served, next arrivals join immediately the service, but the service ends for the whole batch irrespective of the portion of time that the additional arrivals were given. Note that this is a rather limiting assumption.

From the above it follows that in the state diagram end of service from states 1, 2, … K moves to state 0. From states n>K end of service moves to state n-K. As in M/M/1 arrivals to state n move state to n+1. This results in the following stochastic balance equations:

p  p   p    p 0 1 2 K pn(  )   p n1   p n K n  1

The second equation takes the form that can be solved by the method of operators explained in Appendix 11. For this purpose we rewrite it for the state n+1 and assuming pn+1=Dpn we obtain:

ppn K 11( p   ) n    n  0

K1 D(    ) D   pn  0 n  0

Let (r0, r1, … , rK) be the roots of the characteristic equation. Then we know (see Appendix 11) that the solution for pn is K n pn C i r i n 0 i0

Since all probabilities sum to 1, it is obvious that constants Ci of all roots such that |ri| ≥1must be zero. To examine the number of roots less than 1 we can use the Rouche’s theorem of complex analysis. The result is, see [1] for the derivation, that there is exactly one real root in (0,1) that we shall call r0. So the probabilities are given by

47 n pn  Cr00  nr 0, 01

To find the constant C we as in M/M/1 use the fact that all probabilities sum to 1 that provides C = p0 = 1 – r0. So we get the formula similar to the one of M/M/1 with  replaced by r0: n prn  r(1  nr0 )0, 00 01  

For effectiveness parameters we use the M/M/1 formulae:

rL0  1 LL LW QQ  W W    1 r0  

So the only problem is finding r0 possibly for large K. You may use the function “roots” of MATLAB.

Bulk service with constant batch size

In these systems (called Type 2 in QTSTM) the service always takes K customers. So if less than K customers are available, the server waits until there is a complete batch. This is typical for example in various manufacturing applications. Other assumptions are the same as above. In the state diagram the states n ≥ K behave in the same way as above, but states n < K can only be left by arrival and entered by arrival to state n-1 or end of service in the state n+K. So we get the following stochastic balance equations:

pn K p n(    )   p n 1  0 n  K

pn K  p n   pn n 1  K01  

ppK 0 0

n The first equation is the same as for the above case, so the solution pCrn  0 holds, but only for states n ≥ K-1. To find the constant C it is necessary to use the other balance equations. Several methods exist, see [1].

Another version of the bulk systems has been solved. The batch size has to be in the range [k,K], if less than k customers are available, the server has to wait. Unlike in the first case, if a batch smaller than K is served, additional arrivals have to wait until the service ends.

14.5 Systems with Priorities

In all models studied so far we made no distinction among customers. There are queuing applications where priorities of customers have to be considered. Examples of high priority customers are emergency patients, processes in control computers that take care of important events, priority messages and packets in communication, etc. There are situations with more than two priorities. We can view these systems as one (multi)channel serving several FIFO queues made of customers with given priority. It is a rule that lower number represents higher priority, so customers in the queue of priority n are served only if all queues for priorities 0, 1,

48 … , n-1 are empty. The arrival can thus be modelled by separate independent (Poisson) processes with generally its own arrival and service rates. It is necessary to resolve the situation what to do if a customer arrives and a lower priority customer is served. In the so- called non-preemptive model the current service is always completed. In the preemptive model the lower priority service is interrupted by a higher priority arrival. This generates other problem what to do when the interrupted customer re-starts later its service. We either continue the preempted customer's service from the point of preemption (called preemptive resume) or else start a new service (preemptive repeat). Note that for Markovian systems there is in fact no difference because due to the memoryless property of the exponential distribution the rest of the service has still the same exponential distribution. Several modifications of the priority systems have been studied, see models available in QTSTM. All derivations are long and tedious because due to several subscripts involved they are based on multi-dimensional generating functions. Next we outline the assumptions and derivation ideas of two example systems.

Two non-preemptive priorities with same service rate

So we have two separate independent Poisson processes with rates 1 (higher priority 1) and 2 (lower priority 2), common service rate  of a single exponential channel and  = / = (1 + 2) / = 1/ + 2/ = 1 + 2 < 1. System states are represented by three figures m, n, r such that:

pm,n,r = [m customers of priority 1 in the system, n customers of priority 2 in the system, customer of priority r = 1 or 2 in service]

State diagrams take 9 forms according to the values of these three numbers. Two most general forms are presented next together with associated stochastic balance equations.

m > 0, n > 1

0  (   )pm,,2 n   1 p m 1,,2 n   2 p m ,1,2 n

49 m > 1, n > 0

0  (   )()pm, n ,1   1 p m 1, n ,1   2 p m , n  1,1   p m  1, n ,1  p m , n  1,2

For this system the M/M/1 assumptions are still valid, so the M/M/1 formulae based on , , and  can be used for composite effectiveness parameters ignoring the customers priorities. Rates 1 and 2 represent the percentage of time when the server is busy serving customers of priority 1 and 2 respectively. To obtain effectiveness parameters for the two priorities it is necessary to solve the stochastic balance equations. The following results have been obtained:

(1   )1   LLWWW1 1  1    111QQQ 1   1    1 1  1 1 1 2(1  1  1 )1  2  LLWWW2QQQ 2  2  2  2  (1 )(1  1 ) (1   )(1   1 ) (1   )(    1 ) 

Note that due to non-preemption the figures for high priority are not independent of low priority customers. For example the term (1 +  - 1) > 1 in the formula for L1 represents the increase caused by non-preempting low priority customers. The rest would be the M/M/1 system size. Also the convergence of the high priority figures requires only 1 < 1. So the stability assumption  < 1 holds for lower priority (and the whole system). The mean waiting of high priority customers is also longer than the M/M/1 value that would have only 1 in the numerator.

Three preemptive priorities

In this model we have three separate independent Poisson processes with rates r , r = 1,2,3, the service rates r of a single exponential channel are generally different for the three priority classes. Also  = 1 + 2 + 3 ,  = 1/1 + 2/2 + 3/3 = 1 + 2 + 3 < 1. System states are represented by three figures m, n, r such that:

pm,n,r = [m customers of highest priority 1 in the system, n customers of priority 2 in the system, r customers of lowest priority 3 in the system]

State diagrams take 8 forms according to the values of these three numbers. The most general form is presented next together with the associated stochastic .

50 m > 0, n > 0, r > 0

0  (  1 )pmnr ,,   1 p mnr 1,,   2 p mnr ,1,    3,,1 p mnr    1 p mnr  1,,

The following result holds for constant service rate case:

i  in  LL Li  n1 i 1,2,3 Qii Qi i11 ii (1n )(1    nn )(1 ) n1 nn  11

For the highest priority 1 the above simplifies to M/M/1 formulae due to pre-emption.

14.6 Model G/M/1

In this model we assume the following: - Arrival process with rate  and i.i.d. intervals with pdf a(t) and cdf A(t) - Unlimited FIFO queue - Single exponential server with rate  independent of the arrival.

To solve this non-Markovian model we shall apply the approach based on the so-called imbedded Markov chain. The random system size represents in this case a non-Markovian continuous time stochastic process with discrete states 0, 1, … . Within this continuous time process we shall define a discrete time process such that the time points are arrival times with states equal to the system size seen by arriving customers. State changes are then caused only by customers leaving the system during the interval between successive arrivals. As the service is independent of the system size (provided it does not get empty – see later), we have state changes independent of the history given only by the duration of inter-arrival intervals. In other words the assumptions of discrete time Markov chains are satisfied. These will then be the derivation steps: - create an imbedded Markov chain and find steady state arrival probabilities {an} - use the arrival probabilities to find the mean queue and system times - use Little’s formulae to find the mean queue and system size.

Let Xn be the random state (system size) immediately before the n-th arrival, let Bn be the random number of customers served during the interval between arrivals n and n+1 and let T be the random interval (independent on n). Then we have:

51 XXBBXXn1  n 1  n n  n  1 n  0

The second inequality is true because only customers present after the n-th arrival can be served. The service is exponential, so the amount of service given already to the served customer till the arrival is irrelevant, the rest still has the same exponential distribution. So we can also denote the random number of customers served during an interval as B independent on n. The probability that it takes a particular value m can be computed as follows because departures are a Poisson process with rate :

ettm() [B m ]  [ B  mT /  tatdtatdt ] ( )( )  00m!

Having this, we can find the transition probabilities of the imbedded Markov chain:

 ett() i 1  j  [B i  1  j ] i  1  ji  11  j  1 a() t dt pij[] X n1  j  X n  i 0 (ij 1 )!  0i 11  ji   j  0

Above the zero case is obvious because the maximum value of j is i+1. Also note that the formula holds only for j > 0 because then the system does not empty and the departure Poisson process does not stop. We shall compute the probability pi0 as the complement to 1:

ii11 pij1 , p iij0  1  p jj01

We can now arrange the transition probabilities into the one step transition probability matrix P that defines the imbedded Markov chain. Let bn be the probability of n services during an inter-arrival time:

1 bb00 0 0 1  10 bk b10 b k0 2  10 bk b2 b 1 b 0 P  k0   n 1 bbbk n n1 k0  

Having the transition probability matrix, we can find the steady state arrival probabilities a =  T T (a0, a1, … ) by solving the stationary equations a P = a , ai  1. Note that adding the sum j0 is necessary because P is a singular stochastic matrix. From the matrix equation we get the following:

52  aaii k bi k 1 1 k0  j aab0 jk(1) jk00

As the equations contain infinite sums, we shall solve them by the method of operators explained in Appendix 11. Assuming ai+1 = Dai we can rewrite the above equation for i ≥ 1 as follows:

23 ai( ababab i1 0 i 1 i  1 2 ) 0 aDbDbDbDb i  1 (  0 1 2 3 ) 0

So for a nontrivial solution we get the characteristic equation

 n D bn D 0 n0

We know that bn is a probability, so the second term is the probability generating function of the probabilities {bn}. Let’s call it (z) after changing D to the usual z. So we have:

 n ()()z z z bn z n0

We have already found the formula for bn, so we can insert it for (z):

 et()() t n   tz n   ()()()()()z bzn  zatdt n  e t atdt  eeatdt   t  tz  e   t(1  z ) dAt n      n0 n  00nn!! 0 n  0 0 0

Next we compare the above with the definition formula of the Laplace-Stiltjes transform by considering only non-negative values of t:

 A*( s )( ) est dA t 0 By inserting s = (1-z), we get our formula. So we can express the characteristic equation by using the LS transform of the cdf A(t):

z A*( (1 z ))

Next we show that the equation (z) = z has exactly one root r0 in (0,1) because only this root can have a nonzero constant in the solution for the operator. For the function (z) we get:

   nn12 (0)b0  1  (1)  bn  1  '( znbz )   n  0  ''( znnbz )   (  1) n  0 n0 n  1 n  2

53 So (z) is for z > 0 an increasing strictly convex function because all probabilities bn are positive. Solving the equation (z) = z can be expressed as finding the intersection point of the functions y = z and y = (z). Graphically:

1 b 0 ’(1) ≤ 1

b ’(1) > 1 0 0 r0 1

We can see that there are two cases that differ by the value of ’(1) and we also note the following:

  1 '(1)nbn  [number of completed services during an interval]= [interval]= n1 

No solution case has ’(1) = 1/ ≤ 1 that is an unstable system with  ≥ 1. So the condition of the solution case with exactly one root in (0,1) is the system stability  < 1. The solution for arrival probabilities is then n an  Cr0 n 0

The normalizing constant is as usual found from all probabilities summing to 1:

 nn1 ann C r00  C 1 0 0 C  1  r a  (1  r ) r nn001 r0

Again we see the analogy with the M/M/1 formulae, so they can be used to compute the effectiveness parameters at arrival times LA, LQA, WA, WQA. The first two are not very useful because they are the mean system and queue size seen by arriving customers. Fortunately the other two are the actual mean system and queue times because in their derivation we have actually used the arrival probabilities an – see Appendix 6. So having WA = W, WQA = WQ we can use Little’s formulae to compute L and LQ by using the (actual) arrival rate . For convenience the summarized formulae are:

1 rr00 WWLWLWQQQ      (1r0 ) (1  r 0 ) 1  r 0 1  r 0

One problem remains, computation of r0, because for many distributions we cannot find the LS transform A* of the cdf in closed form. It is easy for discrete distributions because the LS definition formula takes the summation form and the characteristic equation becomes:

 * tzi (1 ) z A( (1  z ))   ai e i1

54 This algebraic equation can be solved numerically, for example by the function “fsolve” of MATLAB where we take a starting point close to 0.

Systems D/M/1 are a special case with constant inter-arrival time T = 1/. In the above algebraic equation there is only one term, so we solve

(1z )  z A*(1( (1)  z ))or  ezTz e 

We can change the variable by the substitution q = 1 - z, so the equation becomes

qq   1orq  eq  1  eq with r root 1 00

Effectiveness figures are then computed as follows, see also (72) in chapter 12.

1 1(1qq00 )  W WLQQ  W Q  L  W   qqqq0000

15 Other Results and Methods

This chapter lists some results that have not been described so far. For more details see for example [1]. Among others these results are available:

 A group of models exist for Erlang arrival and/or service. These models are based on the fact that Erlang distribution is a sum of exponential distributions, so the processes can still be treated as Markovian. These models can be used for example as an approximation of systems with general (empirical table) distributions because by changing the shape factor we can choose a distribution close to the empirical one. Also systems where Poisson arrivals are distributed circularly to several services and/or systems where the service is made of several exponential stages fit exactly the Erlang assumptions.

 Models for other non-Markovian models are available. Some are based on iterative algorithms, some on approximations: M/G/c, M/D/c, G/M/1, H/M/1 (Hyperexponential arrival), G/Ek/1, G/H/1, G/G/1 (approximation only).

Queuing theory should be considered as an alternative to simulation methods, because both have its advantages and disadvantages. Models of queuing theory are all based on very strong assumptions rarely satisfied by real systems. On the other hand, using simple formulae of single queue systems provides results very fast. So for rough estimates, consider using the appropriate model of queuing theory. For a detailed analysis based on concrete experimentally obtained data a simulation study is necessary.

Simulation models of queuing systems can be either programmed in discrete simulation languages like for example GPSS, Simscript, Simulation of Simula, by using simulation libraries in general languages like for example SSJ (Stochastic Simulation in Java) or created by Visual Simulation Environments like for example Arena, Extend, Simul8. Today the trend

55 is using visual environments that support fast creation of simulation models without programming. Programmed simulation is necessary for dynamic systems with changing topology, situations where speed is important like applications where a simulation model is a part of an on-line system, or various special applications like simulation-based optimization.

References

[1] Gross, D.- Harris, C.M. (1998) Fundamentals of Queuing Theory, John Wiley & Sons.

[2] Cohen, J.W. (1969) The Single Server Queue, North Holland.

[3] Prabhu, N.U. (1997) Foundations of Queuing Theory, International Series in OR & Management Sciences.

[4] Saaty, L. (1961) Elements of Queuing Theory, McGraw-Hill.

[5] Allen, A.O. (1978) Probability, Statistics and Queuing Theory, Academic.

[6] Cooper, R.B. (1981) Introduction to Queuing Theory, North Holland.

[7] Newell, G.F. (1982) Applications of Queuing Theory, Chapman and Hall.

[8] Gelenbe, E. - Pujolle, G. - Nelson, J.C.C. (1987) Introduction to Queuing Networks, John Wiley and Sons.

[9] Chao, X. – Miyazawa, M. – Pinedo, M. (1999) Queuing Networks. Customers, Signals and Product Form Solutions, John Wiley and Sons.

[10] Banks, J. - Spoerer, J.P. - Collins, R.L.: (1986) IBM PC Applications for the Industrial Engineerer and Manager, Prentice Hall.

[11] Extend User’s Manual (1997) Imagine That, Inc.

[12] Kelton, W.D. – Sadowski, R.P. – Sadowski, D.A.: (2002) Simulation with Arena, McGraw-Hill.

[13] Pidd, M. (1992) Computer Simulation In Management Science, John Wiley & Sons.

[14] Bratley, P., Fox, B.L. and Schrage, L.E. (1987) A Guide to Simulation – 2nd Edition, Springer

[15] Banks, J., Carson, J.S. and Nelson, B. (1996) Discrete Event Simulation, Prentice-Hall Inc.

[16] Chen, H., Yao, D.D. (2001) Fundamentals of Queuing Networks, Springer.

[17] Tijms, H.C. (2003) A First Course in Stochastic Models, John Wiley & Sons.

56 Appendix 1: Proving formula (4) by induction

1. We know that the formula holds for n = 1,2,3.

2. We assume that the formula holds for some k > 0.

3. We show that if the formula holds for k, it also holds for k+1. To show that we insert (4) with n replaced by k and k+1 respectively in (3):

dp() t k1  p()() t  p t dt kk1 kkk11 d( ttt )( )ttt ( ) eee   dt( kkk 1)! ( 1)! !

k111(k 1) t k ( ttt )( kkk ) ( ) eeeetttt()     (kkkk 1)! ( 1)!( 1)! ! ()()ttkk eett kk!!

Appendix 2: Solving differential equations (3) by generating function

We define the generating function P(z,t) for a discrete random variable with probabilities pn(t) by:  n 2 P(z,t)   pn (t)z  p0 (t)  p1 (t)z  p2 (t)z ... n0 where z is generally complex, such that |z| ≤ 1. The above is a generalization of the formula for “probability generating function” of a discrete random variable taking values on some  n subset of non-negative integers P() zp z n by adding the time parameter. First we show n0 why obtaining P(z,t) solves our problem. By differentiating P(z,t) and inserting z = 0, we obtain the required probabilities:

P(,)() z tz00 p t P(,) z t p( t )  2 zp ( t )  ...  p ( t )  1 2z0 1 z z0

2 ''  P( z , t ) Pz (0, t ) 2 2p2 ( t )  6 zp 3 ( t )  ...z0  2 p 2 ( t )  p 2 ( t )  z z0 2

nn()  P( z , t ) Pz (0, t ) n n!()() pnn t  p t  znz0 !

57 Moreover by inserting z = 1 in the first derivative, we obtain the expected value. Note that Nt is the random number of arrivals in (0, t).

P(,) z t   p1()2()3()... t  p 2 t  p 3 t   npnt () t   N  z z1 n1

To find the function P(z,t) let’s first rewrite the differential equations (3):

p()() t p t 00 pnn ( t )  p n ( t )  p1 ( tn ) , where 1, 2, ...

We multiply both sides by zn and sum them:

00 z p00()() t p t z 11 1 z p1()()() t  p 1 t z  p 0 t z

nn n z pn ()()() t  p n t z  p n1 t z

    n n n pn()()() t z   p n t z   p n1 t z n0 n  0 n  1

The sum on the left side is the first derivative of P(z,t):

2 P(z,t)  p0 (t)  p1 (t)z  p2 (t)z ... P(z,t)  p (t)  p(t)z  p (t)z 2 ... t 0 1 2

The first sum on the right is P(z,t), the second sum can be arranged as follows:

 nn1 pnn11( t ) z z p ( t ) z ,(let m n -1) nn11  nm pnm1()()(,) t z  z p t z  zP z t nm10

Together we have a differential equation for P(z,t):

P(,) z t  P(,)(,) z t  zP z t t P'(,) z t ( z  1)(,) P z t  0

This equation has the solution

P(z,t)  ce (z1)t … prove by differentiation.

58 To find the constant c we assume i arrivals already registered at time 0 (generally time origin can be placed anywhere).

pin (0) n 0 ...

pin (0) n 1 ...  ni P( zp ,0)(0) z n z n0

Also P(z,0) = c = zi

Together P(z,t)  zie(z1)t

Next we shall assume that the system is initially empty (i = 0): P(z,t)  e(z1)t

Now we can use P(z,t) to generate the probabilities pn(t):

1n Pt (0, ) pt() n nz!  n

P(,) z t ezt e t

n P(,) z t  ()tn e zt e t zn

()t n p( t ) et where n  0, 1, ....,  n n!

We can use P(z, t) to generate the moments directly. First the expectation:

P(,) z t  np()[] t N z  nt z1 n1 P(,) z t ()[]t ezt e t  N  t z t

The next moment will be used to compute the variance.

2 P(,) z t  2pt ( )  (3)(2) ptz ( )  (4)(3) ptz ( )22  ...  nnptz (  1) ( ) n 2 2 3 4  n z n2 2 P(,) z t  ()t2 ezt e t z2 2 P(,) z t  n(1)() n  p t  [( N N  1)]()  t22 ezt e t  () t 2  n t t z1 z z1 n2

59 Now we compute the variance Var[Nt]:

22 Var[NNNt ] [ tt ] ( [ ]) 22 [(Nt NN tt 1)][ N t N t ][][]  N t  2 [Ntt ] tt [ N  ( NN 1)] [ ] 2 Var[Nt ] [ N  t ( NN ttt 1)]  N [ ] ( [ ]) 22 Var[Nt ] ( t )   t  (  t )

 n 22()t t Var[Nnett ]( ) t   [NNttt ] Var[ ] n0 n!

Appendix 3: Proving formula (16) by induction

1. We know that the formula holds for n = 1,2.

2. We assume that the formula holds for some k > 0.

3. We show that if the formula holds for k-1 and k, it also holds for k+1. To show that we insert (16) with n replaced by k-1 and k respectively in (15):

k k-1 k k+1 k k+1 pk+1 = (1+)pk -  pk-1 = (1+) p0 -   p0 =  p0 +  p0 -  p0 =  p0 

Appendix 4: Solving equations (15) by generating function

 n Define: P(z)   pn z ... z complex, | z | 1 n0

First we use (15) to find the generating function P(z):

n pn11(1  ) p n  p n (multiply both sides by z )

(pp10  ) used later n n n pn11 z(1  ) p n z  p n z (make equal subscripts and exponents) -1n 1 n n 1 zpn11 z (1  ) p n z  zp n z (sum both sides for n  1 ...  )    -1 n11 n n z pn1z(1  )  pnn z  z  p1 z n1 n  1 n  1

Use the following and insert for p1 :    m n m pzm Pzppz( ) 0  1  pz n  Pzp ( )  0  pz m  Pz ( ) m2 n  1 m  0

60 1 z[()](1 P z p0 z  )[() pP 00  z  p ] zP ()  z  11 z P( z )( ) p0  z p  000 (  ) P z  p  (P ) z  p  zP z 11 p0 (1 z )  P ( zz )[1  z   z ] (  ) 2 p0 ( z 1)  P ( z )[ z  z  z  1]

Use the following: z1  z( z  1)  ( z  1)(1  z) to obtain p Pz() 0 1  z  To find p0 we use the fact that Pp (1)1 n n0 p Also Pp (1)1 0  1    1- 0 1- ρ  Together Pz ( ) where  1- ρz 

To find the system state probabilities pn we can differentiate P(z) and insert for z = 0 (see the Poisson process) or alternatively we can compare the coefficients directly:

1 P( z ) (1 -z ) z  (1   )(1    (  )2  ...) 1  z

 P( z ) (1 ) nn z n0

By comparing the above with the definition of P(z) we obtain (18).

As with the Poisson process we can use the function P(z) to find directly the mean system size L. Generally, assuming that N is the random system size:

 dP() z n1 npnn z  np [] N  L dz z1 nn11z1

So in our case:

1  Pz( ) 1 z

dP()() z z   L  (1  )2  (  ) dzz1 (1 z )z1 1  

61 Appendix 5: Obtaining equations (14) by the stochastic balance method

Stochastic balance is a powerful method that simplifies derivation of equilibrium state equations. It can be applied to balance the transition rates of states and cuts. To find (14) we balance the rates of a state. Later we show that balancing rates of a cut enables direct derivation of pn formulae.

   0 1 n -1 n n+1   

Consider the state n. In equilibrium the total “flow” into n and out of n must be equal. In other words the rates of entering n and leaving n must be equal. To express these rates, let’s define the following: pn = portion of time the system is in state n pn = portion of input flow that makes a move from n to (n+1) pn = portion of output flow that makes a move form n to (n-1) total rate of leaving state n = pn + pn

total no. of leavings state n per unit time = leaving n rate Similarly: pn-1 = portion of input flow making transition (n-1)  n pn+1 = portion of output flow making transition (n+1) n pn-1 + pn+1 = rate of arriving to n (at equilibrium)

Together: pn + pn = pn-1 + pn+1 pn+1 - pn(+)+ pn-1 = 0 That is (14) for n > 0

Similarly we obtain p1 - p0 = 0 that is (14) for n = 0.

Appendix 6: System and queue time distribution of Markovian systems

Let WQ(t) be the cumulative distribution function of the random variable TQ = time spent in the queue and similarly let W(t) be the cumulative distribution function of the random variable T = time spent in the system. These cdf’s may look like that:

62 WQ(t) W(t)

1

p0

t t

Note that WQ(t) is a general random variable with nonzero probability of waiting time 0.

First we consider the M/M/1 system in order to find formulae (28). We know that for this system we may use the so-called PASTA property that says that arrival (and departure) and time probabilities are for systems with Poisson arrival equal: an = pn. See chapter 5.1. for related theorems.

Derivation of W(t) for the M/M/1system

W(t) = [system time ≤ t]= [ (1 service ≤ t)  (system empty at arrival)] + [ (2 services ≤ t)  (system state was 1 at arrival)] +  [ ((n+1) services ≤ t)  (system state was n at arrival)] +   an = pn  [(n  1) services  t ] pn n0

Note that above we use the fact that the rest of the service that is on at arrival is still exponentially distributed due to the memory-less property of the exponential distribution. To express the probability in the above formula we need the so-called Erlang distribution that is the distribution of the sum of k exponentially distributed variables with expected values 1/k each (rate k). The expected value of Erlang distribution is then k(1/k) = 1/ (rate ). The parameter k = 1, 2, 3, … is called the shape factor. The probability in the above formula is then the cdf F(t) of an Erlang distribution for k = n+1. In the next derivation we use the known pdf f(t) of the Erlang distribution modified for the expectation 1/:

k() kt k1 t ft() etkt ,0[()0,0],  ft  t  Ft ()   fxdx () (k  1)! 0 In our case each exponential service has the expectation 1/, so we have to insert k=:

63 ()t k-1 k  f ( te )  t (k  1)!

 t n ()x xn W( te )   dx (1 )  n0 0 n!

t  n x ()x W( tedx ) (1 )   0 n0 n! tt W( te ) (1 e  dxe )(1    )x dx   xx   (1 ) 00

By integration we get:

t 1 t W( te ) (1  )1  e x(1 e  )  e   x (1    ) e    tt (1   ) 0   (1   ) 0 (1 ) 0

Inserting for  gives:

   tt(1  )  ( ) W( t ) 1  e  1  e  1  et() cdf, t  0 w( t ) (  ) et() pdf, t  0 [T t ]  1  W ( t )  et()

t  Above T is the random system time. By inserting for W = 1/(-) we get []T t e W which is the first formula of (28).

Derivation of WQ(t) for the M/M/1system

WQ(t) = [waiting ≤ t] = [no waiting] + [one service completed by t)  (system size was 1)] +  [ (n services completed by t)  (system size was n)] +   t ()x n1 p  exn dx  (1  ) 0   n1 0 (n  1)!

Similarly as for the system time we obtain the distribution:

64 (1 )t WQ ( tet ) 1  cdf, 0 (1 )t wQ ( tet ) (1   )pdf, 0 (1 )t [TQQ t ]  1  W ( t )   e

Above TQ is the random waiting time. By inserting for W = 1/(-) we get t t   W WQ []TQ  tee  which is the second formula of (28).

Having the distributions, we can also compute the quantiles, so we can answer questions like “what is the maximum time for 80% of customers to wait?”. Let the quantile level be . By using WQ(t) we get:  ln (1 )t 1 W( t ) 1  e   t   Similarly for the system time. Q  (1 )

Derivation of WQ(t) for general Markovian systems

Now we assume that the system is a multichannel with possibly limited capacity, so in general PASTA does not hold. Also for multichannel waiting occurs only if arrival occurs in state n ≥ c. So we get the following:

WQ(t) = [ TQ ≤ t] = [no waiting] + [one service completed by t)  (system size c at arrival)] + [two services completed by t)  (system size c+1 at arrival)] +  [ (n-c+1 services completed by t)  (system size n at arrival)] + 

As above we express [ (n-c+1 services completed by t)] by the cdf of the Erlang distribution with shape factor n-c+1 with underlying exponential rate c (for n ≥ c all channels work):

ttc() c x nc F( t ) f ( x ) dx ecx dx 00()!nc

c1 Also [no waiting] = [system size < c at arrival] = an n0 Together we get: c1 t c() c x nc W( t ) a a ecx dx Q n n  n0 n c 0 ()!nc

65 Further derivation depends on the particular system type (M/M/c, M/M/c/K), see [1].

Arrival probability of truncated Markovian systems

[(n customers in system) (arrival to occur)] an[ customers in system/arrival to occur] n [arrival to occur] [arrival to occur/nn customers in system] [ customers in system]  [arrival to occur] o() []  pn [ o (  )] ppnn p n   lim lim,  0   n K aK  00KKK111  o() 1 pK [o (  )] ppnn  p [ n  ]  nnn000 

Appendix 7: Obtaining formula (40) by stochastic balance in cuts

We prove the formula (40) by balancing rates through a cut between two states in the state diagram. As a stable system empties infinitely many times, the rates of moves from left to right and vice versa are for all cuts equal.

0 n-1 n 0 1 n -1 n n+1 1 n n+1 So for the cut between states 0 and 1 we get:

0 p0 0 p 1 1  p 1  p 0 1

Similarly for the cut between states 1 and 2 we get:

1  0  1 p1 1 p 2 2  p 2  p 1  p 0 2  1  2

Generally for the cut between states n and n+1 we get:

n pn n p n1 n  1  p n  1  p n n1

By induction we see that (40) holds for n = 1, 2. Assuming that it holds for n = k, we insert in the above equality to show that (40) also holds for n = k+1:

kk1 k  k  i11  i pkk1 p  p 0  p 0 k11  kii11  i  i

66 Appendix 8: Derivation of the Pollaczek - Khintchin formula

Let’s observe the system at departure times. Then we define the following: n = number of customers in the system just after a certain departure n’ = number of customers in the system just after the next departure j = number of arrivals during the next service time.

It is easy to show that these three numbers are linked as follows:

 j nj 0 (1+ arrive, 1 leaves) n'   n10  j ( narrive,  1 j leaves)

We can combine the two cases as follows:

00n  n' n  ( n )  jn where ( )  (8.1) 10n 

The idea of the derivation is that at equilibrium the departure (and the arrival) probabilities are equal to the time probabilities (PASTA) and so the moments are also equal:

[n '] [ n ]  L and [( n ')22 ] [ n ]

Next we find the first two moments of j. Let f(t) be the probability density of the service duration. Also [j/t] = t is the expected number of arrivals provided the next service takes t. Then we get:

 [][/]()()/j jtftdt  tftdt      (8.2) 00

Above the second integral is the expected service time equal to 1/. Note that the same result would be obtained for a discrete service distribution. To find the second moment, we use the well-known formula for the variance, here applied to the number of arrivals during t:

[j22 /] t Var[/]([/]) j 2 t  j t  t  ( t )

The above is true, because the number of arrivals has Poisson distribution for which the mean and the variance are both equal to t - see (6). Now we can compute the second moment:

    [][/]()(())()()()()[]j2 jtftdt 2   t   tftdt 2    tftdt   2  tftdt 2     2 t 2 0 0 0 0 [j2 ]  2 (Var[ t ]+( [ t ]) 2 )    2 ( 2  (1/  ) 2 )   2 2  ( / ) 2

[]j2   2  2   2 (8.3)

67 We shall also need the expectation of δ(n) and δ2(n) that are equal by the definition of δ(n). By taking the expectation of both sides of (8.1) we obtain

[']nnnj []  [()] []

Next we use the fact that the moments od n and n’ are equal and from (8.2) we get:

[ (nn )] [2 ( )] (8.4)

Now we square both sides of (8.1) and take their expectation:

[(')]n2 [] n 2  [ 2 ()] n  []2[ j 2  n ()]2[]2[ n  nj  j ]

To simplify, we use the following: [nj]=[n][j] for independent n and j and similarly for δj, nδ(n) = n by the definition of δ and equations (8.2) and (8.4):

[(')]n2 [] n 2   []2[]2[][]2[][] j 2  n  n jj 

Next we cancel the equal second moments and applying (8.2), (8.3) and (8.4) we get

2 [nj ](1 ) [2 ]   2 2 ( 2 2  2 ) 2 2 2  (1  ) 2 2  2 2 (1  )  2  2   2  2  2   2 []nL    2(1 ) 2(1 )

The formula (68) follows by using the conversion (35).

Appendix 9: Proof of Poisson output from M/M/c/

Let T be the random time between successive departures whose cumulative distribution function C(t) we want to find. Let’s also define:

N(t) = number of customers in the system at time t after the last departure. In steady state

[N(t) = n] = pn at any time.

Fn(t) = [N(t) = n  T > t].

We can use the probabilities Fn(t) to compute the marginal probability [T > t] and C(t):

 C( t ) [ T  t ]  1  [ T  t ]  1   Fn ( t ) n0

So by finding the probabilities Fn(t) we solve our problem. We use the differential approach as we did with the M/M/1 model, again for simplicity most o(t) terms are omitted:

68 Fn(t+dt) = [N(t+dt) = n  T > t] = o(t) + [no arrival during dt] [no departure during dt] [n in system at time t] + [one arrival during dt] [no departure during dt] [n-1 in system at time t] n > 0 [no arrival during dt] [system empty at time t] n = 0

(1dt )(1  cdtFt  )nn ( )   dt (1  cdtF  )1 ( t ) nc  Ftdtnnn( )  (1  dt )(1  ndtFt  ) ( )   dt (1  ndtFt   )1 ( ) 0 nc   (1dt ) F0 ( tn )0

Again we rearrange the above terms, take the limits for dt  0 and by using the definition of derivatives we obtain the following set of differential equations:

()()() c  Fnn t  F1 t n c  Fnn'( tn ) F n ( t   F )  t( )  n1 ( c ) 0   F0 ( tn )0

with boundary condition Fn(0) = [N(0) = n  T > 0] = [N(0) = n] = pn. We expect the

t solution Fnn() t p e whose validity we prove by inserting in the above differential equations. To find Fnn1( t ) and F '( t ) we use the formula (46) for equilibrium probabilities of the M/M/c/ systems:

 n  p00 n  c p  n  c n  n 01 n pn 0  n c nn!    ppnn   or 1 n c   p n c p n c n n c p0 n c nn1  cc!  c 

Inserting in the expected formula for Fn(t) and by differentiation we get:

n p et 0  n c  n tt  Fn11( t ) p n e  F n '( t )   p n e c  p et n c   n

Inserting into the differential equation, first case gives:

c Ft'() pet  (  cFtFt  )()   ()(   cpe  )   t   pe   t   pe   t n n n n1 n n n

The second case differs only by n replacing c and validity for the third case is obvious. Now we can compute the required cdf C(t):

69  t   tt C( t ) 1  Fnnn ( t )  111  p e   e p   e nnn000

So the intervals between departures have exponential distribution with rate  and hence the output is the Poisson process which proves the Theorem 8.

Appendix 10: Proof to open Jackson networks product form solution

Let’s start with notation in order to simplify the stochastic balance equalities: ni+ = (n1, … ,ni+1, … nk) compared with n, one more customer in station i ni- = (n1, … ,ni-1, … nk), ni > 0 compared with n, one less customer in station i ni+j- = (n1, … ,ni+1, … ,nj-1, … nk), nj > 0 compared with n, one more customer in station i and one less customer in station j.

To prove Theorem 9, we show that the network state probabilities satisfy the stochastic balance. Let In be the total arrival rate into the network state n. Then

k Ipnn  ii transitions caused by one arrival to network i1 k  irp i0 n i transitions caused by one departure from network i1 kk  irp ijn i j transitions caused by moves among stations i1 j  1, j  i

Similarly let On be the total departure rate from network state n:

k Opnn  i transitions caused by one arrival to network i1 k i(1rp ii )n transitions caused by one end of service and no return to same station i1

To show that In = On , we shall use the following.

nnnn12 nk pn ii R12 ... k , pn  CR , p n i  , p n i   p n  i , p n i  j   p n ,  i  i  j  i

IOnn k k k k k k nii n n n n CR CR i r i0  i  CR    i r ij  CR   i  CR   i(1  r ii ) i1ij i  1 i  1 j  1, j  i i  1 i  1

n We divide both sides by positive CR and we insert for i and j:

70 k k k k k i  i  i  i  j  ir i0     i r ij  ()  i   i   i r ii i1i i  1  i i  1 j  1, j  i  i  j i  1

From the traffic equation we obtain:

kk j  j   irrr ijij   i   j  j j jj ij11, i  j

And inserting in the double sum gives:

k k kk ii  j  rrriij0   j() jjj    ()   i i  iii      i1ij i  1 ji  11

In the 3rd sum we change the summation index to i and we join the three sums:

kk i  i  i [ ()i   i ]  iiir ()  rr ii0   i iii      ii11ii

kk This simplifies to ri0 i  i  ii11

Appendix 11: Solving difference equations by the method of operators

Let’s assume a sequence {a0, a1, …} such that the items are linked by ann1  Da,0  n  m 0 where D is a linear operator. As an m D a n ,,0  m n  and D  1 then a linear difference equation

n k n k in CaCannnn11    Ca nknkii    Ca 0 can be re-written as CDa in  0 i n i n

nk in Let the roots of the algebraic characteristic equation CDi  0 be r1, r2, … , rk. Then the in k n solution to the above difference equation is an  d i r i where di are constants to be found by i1 n boundary conditions. To verify this claim, let’s first show that any single term drjjof the sum is a solution to an . Inserting in the difference equation gives: n k n  k n  k i n i n Ci a i  C i( d j r j )  d j r j  C i r j  0 i n i  n i  n

71 k n It is true since rj is a root of the characteristic equation. Similarly inserting adni ri  gives i1 nk nkk  knk k nk ii n i n Caii  C i(  dr jj )0  Cdr ijj  dr jj  Cr ij in inj  1 jin  11  j  in 

As an example let’s use this method to find the steady state probabilities of the M/M/1 system. Equation (14) for n > 0 with n replaced by n+1 takes the form

ppnnn21 ( pn )0  0 

Inserting pDpnnn1  ,0provides

2 [()]DD  0  p  n

The quadratic is easy to factorize:

 (D 1)( D   ) p   ( D  1)( D  ) p  0 nn

n nn So the solution is pn  d1(1)  d 2  d 1  d 2 . As the boundary conditions we use the  second part of (14) for n = 0 and sum of all probabilities equal to 1. We see that d1 = 0, n otherwise the sum of probabilities does not converge. So pdn  2 and for n = 1, pd12  . n From (15) we have that pp10  , so dp20 , ppn  0 that is (16).

72