750 likes | 817 Views
Chapter 6 Queueing Theory. M / M / s M / G / M / M / 1 / blocking M / D / 1. Queueing discipline (optional). Interarrival time M emoryless, G eneral, D eterministic, U niform, etc. Service time is M emoryless, G eneral, D eterministic, U niform, etc.
E N D
Chapter 6Queueing Theory Prof. Bob Li
M/M/s M/G/ M/M/1/blocking M/D/1 Queueing discipline (optional) Interarrival time • Memoryless, • General, • Deterministic, • Uniform, • etc. Service time is • Memoryless, • General, • Deterministic, • Uniform, • etc. Number of servers, where 1 s. Typical queueing system are B-D processes • Assumptions and notation. • Inter-arrival times are i.i.d. The mean is 1/, while the distribution depends on the “1st letter” of queueing model. An “M” Def-C of Poisson process. • Service times are i.i.d. The mean is 1/, while the distribution depends the “2nd letter.” An “M” means exponential service time. • All inter-arrival times and service times are independent.
M/M/s M/G/ M/M/1/blocking M/D/1 Queueing discipline (optional) Interarrival time • Memoryless, • General, • Deterministic, • Uniform, • etc. Service time is • Memoryless, • General, • Deterministic, • Uniform, • etc. Number of servers, where 1 s. Typical queueing system are B-D processes • Inter-arrival times are i.i.d. with the mean 1/. • Service times are i.i.d. with the mean 1/. That is, is the capacity of a server. • / = average number of arrivals in a service time • = minimum number of servers needed to handle the traffic load • = the offered load • Because / is a dimensionless quantity, the telecom community gives it the artificial unit “erlang.” So, one can say something like • “an M/M/2/blocking queue loaded with 1.6 erlangs”
6.1Cost equations, Little’s formula, & steady state Prof. Bob Li
Four fundamental measures of cost • Each of the following fundamental quantities represents a way to measure the “costof queueing” in the long run: • LQ = Average Queue Length (not including customers that are being served) • L = Average population • = Average number of customers in the system • // LQ and L are time-averages, i.e., averages over all nanoseconds until eternity. • WQ = Average Queueing time of a customer • W =Average delay of a customer // WQ and W are averages over customers • = WQ + 1/// Delay = queueing + a service time • // In this formula, 1/ = mean service time. Later • // Later when sometimes stands for average output rate, • // then W = WQ + 1/ only for single-server system. Prof. Bob Li
Four fundamental measures of cost • Besides W = WQ + 1/, two Little’s Formulas establish two more relations among these four measures of cost so that any of them determines the others. • Little’s Formula 1: L = W • L W • W= WQ + 1/ • (1/ = mean service) • LQ WQ • Little’s Formula 2: LQ = WQ Prof. Bob Li
Little’s Formula 1 Little’s Formula 1.L = W for all stationary queueing models. // All stationary models regardless of the arrival process, // service-time distribution, number of servers, and queueing discipline Proof. Think of a measure of the cost as money that customers pay to the system. In this proof, let each customer in the system pay to the system at the rate of $1 per unit time. L = Time-average “rate” at which the system earns // Unit of this “rate” = $/unit time = Average payment per customer when in the system // Time-aveave over customers; Unit of this average = $/person = W // Unit = (person/unit time)•($/person) = $/unit time Prof. Bob Li
Little’s Formula 2 Little’s Formula 2. LQ = WQ for all stationary queueing models. Proof. Let each customer in queue pay $1 per unit time to the system. LQ = Time-average “rate” at which the system earns = Average amount a customer pays in queue = WQ Prof. Bob Li
Four fundamental measures of cost • We have established relations among these four measures of cost so that any of them determines the other three. • Little’s Formula 1: L = W • L W • W = WQ + 1/ • (1/ = mean service) • LQ WQ • Little’s Formula 2: LQ = WQ • Homework. Derive the formula L = LQ + / directly. That is, explain why / is the time-average of the number of customers being served. L = LQ + / Prof. Bob Li
Lecture 10 April 3, 2013 Prof. Bob Li
6.2Time average of population in Q Prof. Bob Li
3 kinds of limiting distributions of population • N(t) = population of the queueing system at time t • Pn = , where n 0 • = The proportion of time (in the long run) when there are exactly n customers in the system • = Timeaverage// = Average from the outsider’s view • an = Proportion of customers (in the long run) that, upon arrival, see exactly n in the system, n 0 • = Arrival-timeaverage// Average over customers rather than time • = • dn = Proportion of customers (in the long run) leaving behind n others to the system upon departure, n 0 • = Departure-timeaverage// Average over customers rather than time • =
Handicap on arrival- & departure-time averages • The three kinds of averages{Pn}n0, {an}n0, and {dn}n0 are all limiting distributions of population. They are the same under suitable assumptions in the sequel but, in general, may differ from each other: • Think of the time average as the fair average. • The arrival-time average, as a quantity, incurs the handicap of not counting the arriving customer himself. // Not seeing oneself • Symmetric handicap applies to the departure-time average. • Example. Consider a G/D/1 system such that: • Service time = 1 deterministically. • Inter-arrival time always > 1. // Not exponentially distributed • Every arriving customer sees an empty system and every departing customer leaves an empty system behind. Thus, the population seen by an arriving or departing customer is 0 deterministically. Hence a0 = 1 = d0. However, P0< 1.
Poisson arrival sees time average • Proposition 8.2. If the arrival process is Poisson, then an= Pn for n 0 • Proof. • N(t) is determined by arrivals and departures during (0, t). The Poisson assumption implies independentarrivals over the two disjoint intervals (0, t) and (t, t+h). Departures in (0, t) are naturally irrelevant to arrivals in the future interval (t, t+h). Thus N(t) is independent of arrivals in (t, t+h). Thus, • and an= • // This is the explicit meaning of arrival-time average. • = • = Pn Prof. Bob Li
Poisson departure sees time average? Symmetrically the handicap of the departure-time average would diminish when the departure process is Poisson. • However, there is no natural way to create a Poisson departure process starting right at the time 0. Prof. Bob Li
B & D see the same. • Proposition 8.1. In a birth-death queueing system, an =dn for all n 0. • Proof. // When / < s and, in some cases, when / = s, the system converges. • // When the system diverges, the Proposition still stands because all an= dn = 0 • So, we assume the system converges and reaches stability in the long run. In a B-D system, there is one B at a time and one D at a time. The number of population transitions from n+1 to n during an interval [0, T], for any T, can differ from the number of transitions from n to n+1 by at most 1. • When T, Number of population transitions from n to n+1 • = Arrival count in (0, T) [an + o(T)] • = T an + o(T) • Number of population transitions from n+1 to n • = Departure count in (0, T) [dn + o(T)] • = T dn + o(T) • Therefore, 1 =
B & D see the same. • The B-D assumption in the above proposition is essential, as evidenced by the following • Counterexample. Suppose that the unique transportation between the airport and a distant tourist attraction is a single shuttle bus. • Tourists arrive at the attraction gate by bus (The whole bus load is regarded as arriving at the same time. Thus the queueing system is not B-D.) Arriving tourists then queue up in front of the ticket window (single server) and then enter the attraction site one by one. • The queue will surely be emptied long before the bus makes another round trip to and from the distant airport. Thus a0 = 1. However, some departing customers do leave others behind. Hence d0 < 1. • Corollary. In a stationary B-D queue with Poisson arrival, • Pn = an = dn for n 0
B-D Queue • Treat a B-D queue as a continuous-time markov chain. Limiting probabilities Pj abide with the law of flow balance: • Through telescoping, for all n 0. • If , then and the process will eventually • Become stationary with the limiting probabilities • If , then P0 = 0 and hence Pn = 0 for all n < . That is, as a continuous-time markov chain, the queue is unstable. Prof. Bob Li
6.3M/M/s queueing system, 1 ≤ s ≤ ∞ Prof. Bob Li
M/M/1 queue • In an M/M/1, for all n. • Write = / = the offered load • The result on a general B-D process is the reduced to for all n 0. • The queue is stable if and only if or, equivalently, < 1. • When > 1, the queue length grows indefinitely longer and longer. • When = 1, then Pn = 0 for all n. // True for a B-D process in general. • This M/M/1 queue = The symmetric 1-dimrandom walk with a barrier at 0. • // Fold the symmetric 1-dim random walk at the point ½ so that • // every state k, k > 0, coincide with the state k1 for all. • Some consequences are: • 1) The empty state will always be renewed, but the average renewal time is . • 2) The population will keep achieving new all-time highs.
Stable M/M/1 queue (< 1) • From the equation for all n 0, we find • = n(1) for all n 0 • That is, the limiting probabilities Pn are Geometric0(1) distributed. • // Actually this has been derived in Chapter 5 before. • From this distribution, we derive: • The fraction of time 1P0 that the single server is working is called the utilization. In this case, the utilization 1P0 = =the offered load. • The average population is • L = • // Mean of Geometric0(1) • From L we can calculate • W, WQ, and LQ .
Distribution of M/M/1 delay • We now calculate the distribution of thedelay for an average customer in M/M/1. The distribution refers to data sampling over all departing customers in all time. It is the same as the delay of a customer in the steady state. • Proposition. The delay of a customer in a stationary M/M/1 queue is Exponential() distributed. • Proof.Let an arriving customer in the stationary M/M/1 sees X customers in the system. Since Poisson arrival sees time average, X is Geometric0(1) distributed, same as the limiting probabilities Pn of the M/M/1. • Let the r.v. W*represent the delay of a customer in a stationary M/M/1 queue, which is the sum of X+1 service times. • // We have being using the capital letter W for the average waiting time of a customer. • // However, we normally use capital letters for r.v. So, we need here a “super-capital” • // notation for the r.v. representing the delay in the stationary state. Note that EW* = W. • As X+1 is Geometric1(1) distributed, W*is Exponential((1)) distributed. • // See the Waiting for Godot problem on the next slide.
Waiting for Godot • Problem. Buses arrive according to a Poisson process with the intensity , and it takes X buses to wait for Godot, and X is Geometric1(1) distributed. What is distribution of the arrival time W*of Godot. • Proof.Thus W* is a sum ofmemorylesslymanymemorylessi.i.d. Claim that W*is a memoryless r.v., that is, under the condition of W* > w, the residual waiting time for Godot has the same distribution as the unconditional W*itself. In fact, under the stronger condition (more specification) that • x buses have passed and the waiting time for the next bus > y • the residual waiting time still has the distribution of the unconditional W*, which is therefore exponentially. • // The sum of Geometric0(1) many exponential r.v. incurs a pointed prob. mass at 0. • The rate of this exponential distribution is the reciprocal of the mean, which is • W = E[W*] = (EX+1)/ = 1/(1) = 1/() • In conclusion, the arrival time W* of Godot is Exponential() distributed.
Distribution of M/M/1 delay • Alternative proof by calculation. Under the condition of seeing n in the system upon arrival, the residual service time has the same distribution as a complete memoryless service time. Thus the conditional r.v. • (W* | Seeing n in the system upon arrival) • is Gamma(n+1, ) distributed. • P{W* a} • = n0P{nin the system upon arrival}P{W* a | n in the system upon arrival} • = n0PnP{W* a | n in system upon arrival} // Poisson arrival sees time average. • = n0 [Pn] // W* is Gamma(n+1, ) density function • = n0 [(1)n] // Pn is Geometric0(1) distributed • = n0[] • = …
Alternative proof (cont’d) • P{W* a} = … • = n0[ ] • = () n0[] • = ()// Interchanging order • = ()dt • = 1|x = a • = 1 Prof. Bob Li
M/M/1/blocking queue with a finite capacity Example. The buffer of a processor can hold at most only N1 jobs in the queue (plus another job being processed). // Here N is a deterministic integer. M/M/1 is a birth-death Markov process regardless of the queueing discipline. Again, time reversibility leads to for 0 nN. For the M/M/1/blocking queue, N • // This formula stands regardless of how large is, • // because the queueing discipline of blocking sets an • // upper bound on the population and thereby • // precludes divergence. In other words, regardless of • // the traffic load, the fraction of arrivals that actually • // enter the system makes a load below 1.
M/M/1/blocking queue with a finite capacity Example. The buffer of a processor can hold at most only N1 jobs in the queue (plus another job being processed). // Here N is a deterministic integer. The average population L is:
M/M/1/blocking queue with a finite capacity • Example. The buffer of a processor can hold at most only N1 jobs in the queue (plus another job being processed). // Here N is a deterministic integer. • From the formula for L, we can also derive the formula for W, the average delay of a customer by Little’s Formula W = L/. Note that the arrival rate includes blocked customers and hence this average Wcounts blocked arrivals as customers with zero delay. • The fraction of arrivals that actually enter the system is 1PN. If the delay is averaged only among the entering customers, then the actual arrival rate is a = (1PN) and hence the average delay is Wa= L/a = L/[(1PN)]. • // As N , 0 and thereby a and WaW Prof. Bob Li
s M/M/s without buffering space (Erlang Loss System) • Example. At a parking lot with the capacity of s automobiles, arrivals at a full lot are immediately turned away. • Example. An old telephone exchange is equipped with s digit receivers shared by all ports. Call arrivals are blocked when all digit receivers are busy. • A stable B-D process is time-reversible. Its stationary probabilities abide with the simplified laws of flow balance: Pn1 = n Pnfor 0 < n s. • Or, equivalently, Pn= Pn1 / n = Pn1 / n for 0 < n s Prof. Bob Li
s M/M/s without buffering space (Erlang Loss System) Prof. Bob Li
s M/M/s queue with infinite buffering capacity • . . . • Laws of flow balance are: Pi= Pi1 / i = Pi1 / i for 0 < i< s and • Pi= Pi1 / s = Pi1 / s for i s
M/M/1 queue with bulk service • An exemplifying problem.A two-seat cable car serves two customers simultaneously when there are two or more customers present in the queue. When the system is empty, the cable car waits for the next arriving customer. The service time is Exponential() whether one or two customers are served. • Model as acontinuous-time markov chain. In order to calculate the limiting probabilities, we treat this queueing system as a continuous-time markov chain where the “state” is labeled by the queue length rather than the population. There are two different states corresponding to an empty queue: • State 0 the queue is empty but the server is busy • State 0the whole system is empty Prof. Bob Li
M/M/1 queue with bulk service The straightforward form of flow balance in the stationarystate follows the red cuts. Taking advantage of the fact that all states in this transition diagram almost line up in a row, there is the better alternative of blue cuts that intersect with fewer transition arrows. // similar to time reversible M C vs. Either one consists of homogeneous difference equations. // Discrete counterpart to homogeneous differential eq. It is clear that , and we shall try a solution in the form of // Discrete counterpart to trying f(x) = kex
M/M/1 queue with bulk service It is clear that , and we shall try a solution in the form of vs. The only feasible root is The geometric form of the solution shows that: The system is stable < 1 < 2 < 2 // 2is the maximum service rate. Hence must be strictly less than 2.
M/M/1 queue with bulk service The boundary condition translates into In the stable case, Homework. What can you say about a 3-seat cable car? Prof. Bob Li
M/M/1 queue with bulk service The average number of customers in the queue is // This is similar to the mean of a geometric distribution.
6.4Network of queues Prof. Bob Li
Tandem of an M/M/1 queue and a ~/M/1 queue (“~” refers to whatever is output by the M/M/1 queue.) • To consider the stationary situation, we assume that < 1 and < 2. • Since Queue 1 is M/M/1 and < 1, its stationarypopulation is Geometric0(1/1) • distributed. That is, • Moreover, the stationaryoutput from Queue 1 is a Poisson process at the intensity by Burke’s Theorem. // Burke’s Thm applies more generally toM/M/swith < s. • Thus, when Queue 1 reaches equilibrium, Queue 2 becomes another M/M/1. • Since < 2. Queue 2 lateralso reach a stationary Geometric0(1/2) distributed population. Prof. Bob Li
Tandem of an M/M/1 queue plus a ~/M/1 queue • The following argument proves independence between the populations of the two individual queues in the stationarystate and, in particular, in the stationarystate. • Population of Queue 1 is independentof the future arrival times. By time reversibility of a B-D process, the stationary population is also independentof the future arrival times in the reversed process, which are the past departure times in the forward process. In short, the stationary population of Queue 1 is independent of its past departure times. • On the other hand, the past departure times are the only thing from Queue 1 that affects the status of Queue 2 at any moment. Prof. Bob Li
Tandem of an M/M/1 queue plus a ~/M/1 queue • Therefore the joint limiting probabilities are simply: • Averagepopulation in the tandem network is • From Little’s Formula, • //Averagedelay in going through the whole tandem Prof. Bob Li
Alternative derivation without using time reversibility Laws of flow balance are: • A markov chain with states (i, j), where i, j 0: These are 2-variable homogeneous difference equations. So, we try a solution in the form of Luckily, it works with Normalization of probability then gives K = (1)(1) Prof. Bob Li
skipRemarks on stationary state • Let the random variables N* and M* represent the stationary populations in the two queues seen by customers upon entering the respective queues. Since Poisson arrival sees time average, N* and M* also represent the time averages, which are independent of each other from the above calculation. • On the other hand, the two stationary populations N* and Mthat a particular customer sees upon entering the respective queues are not independent in general. • Example. When is small in comparison with 2, P{M* > 0} = /2is also small. Assume also that 1 = 2. There is a correlation between the two stationary populations that a particular customer sees upon entering the respective queues, because • P{A customer sees M > 0 | The same customer saw nonempty Queue 1 upon entering Queue 1} ½
N* Almost proportional Dependent Independent Positive correlation Waiting time in Q1 M Negative correlation Service time in Q1 Independent! The positive and negative correlations cancel out. Any simple explanation? Delay in Q1 skipRemarks on stationary state (cont’d) • (3) The stationarydelay in Queue 1 is Exponential(1). Remarkably enough, M is independent of this stationary delay and hence the delay times that a customer incurs at the two queues are independent. It is an open problem to find a simple explanation for this fact.
General (open) system of queues • There are K nodes in the network. Each node j consists of sjexponential servers, each at the rate j. • Customers arrive from outsidethe system to each node j in accordance with an independent Poisson process at the rate rj. • Once a customer is served by a server at node i, he joins the queue of node j with probability Pij and departs from the system with the probability . • We are interested in the stationary probability • P(n1, …, nK) = P(There are nj customers at each node j)
General (open) system of queues • Let j denote the stationary output “rate” of node j. • // Our language: rate = memorylessrate; while “rate” = anyaverage per unit time • The stationary probability P(n1, …, nK) must abide with Law of Flow Balance: jis equal to the total “rate” of customer arrivals at node j from both inside and outside of the stationary system. That is, Prof. Bob Li
General (open) system of queues • Jackson’s Theorem. Assume that for j = 1, 2, …, K. Then, • where Pj(nj) is the limiting probability of an M/M/sj queueing system with the arrival rate j and the service rate j for each server. • // It is as if there were an independent M/M/sjqueue at each node j. • Proof. The solution magically abides with all the laws of flow balance. • Open problem. Find a non-calculativeexplanationof Jackson’s Theorem. Prof. Bob Li
The case with a single server at every node • The total arrival process to a node j is not Poisson initially and not clear even in equilibrium. However, the stationary population at each node j has an independent geometric distribution, which is the same as an M/M/1 queue with the arrival intensity j. • The joint distribution P(n1, …, nK) is the same as the joint distribution of K independent M/M/1 queues. • The average time a customer spends in the network is, by applying Little’s Formula to the whole network,
1 = 8 ½ Poisson(4) external input ½ ¼ Poisson(5) external input ¾ 2 = 10 Exemplifying network of two single-server queues Following previous notation, Prof. Bob Li
Two single-server queues in a feedback loop Poisson() external input 1 q Following previous notation, p 2 Prof. Bob Li
skipDirectderivation of the formula for Pm,n • // instead of using Jackson’s Theorem Poisson() external input 1 q The possible transitions: Current Next Average “rate” state stateof transition (m, n) (m+1, n)Arrival of new customer (m, n) (m+1, n1) 2Feedback to Server 1 (m, n) (m1, n) q1Departures of customer (m, n) (m1, n+1) p1Feedback to Server 2 Corresponding laws of flow balance: p 2 Solve for Pm,n.