Waiting time distributions in the accumulating priority queue

We are interested in queues in which customers of different classes arrive to a service facility, and where performance targets are speciﬁed for each class. The manager of such a queue has the task of implementing a queueing discipline that results in the performance targets for all classes being met simultaneously. For the case where the performance targets are speciﬁed in terms of ratios of mean waiting times, as long ago as the 1960s, Kleinrock suggested a queueing discipline to ensure that the targets are achieved. He proposed that customers accumulate priority as a linear function of their time in the queue: the higher the urgency of the customer’s class, the greater the rate at which that customer accumulates priority. When the server becomes free, the customer (if any) with the highest accumulated priority at that time point is the one that is selected for service. Kleinrock called such a queue a time-dependent priority queue , but we shall refer to it as the accumulating priority queue . Recognising that the performance of many queues, particularly in the healthcare and human services sectors, is speciﬁed in terms of tails of waiting time distributions for customers of different classes, we revisit the accumulating priority queue to derive its waiting time distributions, rather than just the mean waiting times. We believe that some elements of our analysis, particularly the process that we call the maximum priority process , are of mathematical interest in their own right.


Introduction
Historically, priority queues have been analyzed under the assumptions that classes of customer have fixed priorities, and that no customer from a given class is admitted to service while there are customers present from classes of higher priority. In many situations, this type of priority queueing discipline is appropriate. However, in a situation where separate service requirements are simultaneously specified for each class, there is no reason to expect that an absolute priority discipline will yield performance levels that satisfy the service requirements. For example, high-priority classes might receive better service than specified, while the service level of low-priority customers might not be adequate. It is therefore desirable to seek a modification to the classical structure, which would enable the manager of a queue to fine-tune the customer selection discipline so that the service requirements of all customer classes are simultaneously satisfied.
The simplest discipline for achieving such an objective was first proposed in 1964 by Kleinrock in [12]; it is also widely known through its presentation in [11]. He termed it the time-dependent priority queue, but as this phrase has come to mean many things, we shall refer to it as the accumulating priority queue. Kleinrock's objective was to achieve desired ratios of stationary mean waiting times experienced by customers from the different classes. He achieved this by stipulating that customers accumulate priority as a linear function of their time in the queue, with customers from classes for whom mean waiting times should be shorter accumulating priority at a greater rate. When the server becomes free, the customer (if any) with the highest accumulated priority at that time point is the one that is selected for service. Kleinrock's main result was a set of recursive formulae for the stationary mean waiting times of the different classes in such a queue, expressed in terms of the parameters of the arrival and service distributions involved, and the rates of accumulation. He further showed that, for a stable queue, it is possible to achieve any set of ratios of stationary mean waiting times (within a region determined by the values of these ratios in an absolute priority queue) by suitably tuning the accumulation rates. Of course, the actual values of the mean waiting times depend on the traffic intensity.
Kleinrock's primary motivation in [12] was the scheduling of computer jobs as a function of the queue length. Ours comes from healthcare applications. Patients in many jurisdictions around the world are classified according to an acuity rating system. The performance of such systems is assessed typically in terms of compliance with a set of Key Performance Indicators (KPIs) expressed in terms of distributional tails. These KPIs specify, for each priority class, both a benchmark time standard, and a proportion  Immediate  98  2  Emergency  15 min  95  3  Urgent  30 min  90  4 Less urgent 60 min 85 5 Not urgent 120 min 80 of patients whose waiting times before accessing treatment should not exceed the stipulated standard. For example, as is depicted in Table 1, the Canadian Triage and Acuity Scale (CTAS) [4] formulates five priority classifications for assessment in an emergency department, each with its own time standard and compliance target for the proportion of that class's patients that need to meet that standard. The Australasian Triage Scale [3], on which CTAS is based, likewise, has five priority classes, but with different compliance targets. Elective patients awaiting surgery or treatment are also categorized into priorities with compliance targets; we cite as particular examples hip and knee replacement priority scoring in Canada [2] and New Zealand [7], and coronary artery bypass graft surgery in New Zealand [15]. Curtis et al. [6] gave an overview of prioritisation in Australia, as well as a discussion of the Clinical Priority Assessment Criteria (CPAC) tools used in New Zealand and the Western Canada Waiting List Project (WCWL) in Canada. A variant of the accumulating priority mechanism has been considered previously by healthcare modellers in a simulation of emergency care. Hay et al. [9] proposed a mechanism which they term "operating priority" whereby all tasks have an initial priority score which then increases as a function of time. Both the initial score and the rate of increase are functions of the patient class. The authors went on to observe that their mechanism tracks the actual behaviour of an emergency care facility better than the classical priority mechanism.
In this paper, we extend Kleinrock's analysis to derive the stationary waiting time distribution for each class in a single-server accumulating priority queue with Poisson arrivals and generally distributed service time distributions. Our analysis involves the introduction and study of a stochastic process, the maximum priority process, that we believe is of interest in its own right.
The remaining sections proceed as follows. Following a description of our model and preliminary definitions in Sect. 2, we discuss the maximum priority process for the two-class queue in Sect. 3, and define the concept of an accreditation interval in Sect. 4. We then recall some useful results concerning the waiting time and busy period distributions in a standard first-come-first-served M/G/1 queue in Sect. 5 and derive expressions for the Laplace transforms of the accumulated priority of customers entering service in a two-class accumulating priority queue in Sect. 6. Section 7 contains preliminary results for a multiclass system and Sect. 8 the derivation of the waiting time distribution of customers of all classes. Section 9 contains some comments concerning an alternative derivation of the waiting time distribution for the lowest priority class in the general multiclass case. Section 10 shows how to utilise our results to design an efficient method for simulating an accumulating priority queue, while Sects. 11 and 12 present a numerical example and some comments and suggestions for further research, respectively.

Our model
We consider a single-server queue with Poisson arrivals and general service times. Customers of class i, i = 1, 2, . . . , N arrive at the queue as a Poisson process with rate λ i . Upon arrival, a customer of class i starts accumulating priority at rate b i , where b 1 > b 2 > . . . > b N . Thus, if a customer of class i arrives at time t and is still in the system at time t > t, their accumulated priority at time t is b i (t − t). When a customer completes service, the next customer to be served is the one with the greatest accumulated priority at that instant. Figure 1 plots the accumulated priorities of customers against time for the sample path of such a process with two classes and priority factors b 1 = 1, b 2 = 0.5. The arrival instants are those points (1,3,10,15,17) where the priority functions are initiated. The departure instants (14,21,23,26,31) are marked by vertical lines. The priority function for the customer that is in service (if any) is highlighted, and we see that the sequence of services is: class 1, class 2, class 1, class 1, and class 2. In this plot we see examples of both a class 2 arrival being served before a class 1 customer that arrived while it was waiting (at time 14), and of a later class 1 arrival overtaking an earlier class 2 arrival and being served first (at time 23).
Let T = {T n ; n = 1, 2, . . .} be the process of inter-arrival times at the queue, with T 1 being the time of the first arrival and τ n = n k=1 T k being the time of the n th arrival. For each n, let χ(n) be the class and X n the service time of the n th customer, with χ = {χ(n); n = 1, 2, . . .} and X = {X n ; n = 1, 2, . . .}.
Let X (i) be a random variable having the service time distribution of a class i customer, with mean 1/μ i , distribution function B (i) , and Laplace-Stieltjes transform (LST) B (i) (s) = E(e −s X (i) ), defined in the right complex half-plane and for at least some s with (s) < 0. Under the assumption that the interarrival times and service processes are independent of one another, and that the queue is stable (that is,  32  30  28  26  24  22  20  18  16  14  12  8  6  4  2 time class 2, b2 = b = 0.5

Fig. 1 Accumulated priorities
queueing time (that is, waiting time prior to service) for customers of different classes. Throughout the paper, we shall denote by F the LST of a random variable with distribution function F.

The maximum priority process for the two-class accumulating priority queue
In this section we present a detailed discussion of the two-class accumulating priority queue, before considering the more general multiclass accumulating priority queue.
We begin with the accumulating priority function for the nth customer, defined by Note that, here we have permitted priority to continue accumulating for a customer during their service and after their departure. This is simply for ease of notation. Although arrivals of a given class are served in the order in which they arrived, this is no longer a FIFO queue. Define n(m) to be the position in the arrival sequence of the mth customer to be served. So, for instance, if the 10th arrival was actually the 4th to be served, then n(4) = 10. When the system starts empty, we see that n(1) = 1, and, more generally, if the kth customer to arrive is the first customer in a busy period then n(k) = k. Note that if n(m) > m then the mth customer to be served must be of class 1, whereas if n(m) < m then the mth customer to be served must be of class 2. If n(m) = m, then the customer can be of either class.
Let C n be the time at which service commences for the nth arrival (so that the time at which the m th service commences is given by C n(m) ), and D n = C n + X n be the departure time of the nth customer to arrive, with C = {C n ; n = 1, 2, . . .} and D = {D n ; n = 1, 2, . . .}. The departure of the mth customer to be served occurs at time D n(m) . If there are no other customers queued at this time, then the busy period ceases and the next customer to arrive commences service immediately. Otherwise, the queueing discipline chooses the customer with the highest priority from those that are yet to be served. So we can write The minimum here covers those instances where the mth departure instant coincides with the end of a busy period, at which time the priority function for all unserved customers is zero. We have C n(1) = C 1 = T 1 = τ 1 and, for m > 1, C n(m+1) = max{D n(m) , τ n(m+1) }.
We are now ready to define the maximum priority process for the accumulating priority queue in the two-class case.

Definition 3.1
The maximum priority process M = {(M 1 (t), M 2 (t)), t ≥ 0} for the accumulating priority queue in the two-class case is defined as follows.
2. At the sequence of departure times {D n(m) , m = 0, 1, 2, . . .}, 3. For t ∈ [C n(m) , D n(m) ) with max {m:D n(m) >t} V m (t) > 0 (that is, when there are customers present in the queue), The idea underlying this process is that, for each time t ≥ 0 which is not a departure time, it gives the least upper bound for the priorities of queued customers from each class, given only knowledge of the times at which previous customers entered service, and their accumulated priority at these times. At departure times, M 1 (t) is determined by the maximum of the accumulated priorities of customers still in the queue, which is exactly the accumulated priority of the customer just commencing service. Figure 2 plots M 1 (t) and M 2 (t) (in bold) against t for the sample path of Fig. 1, superimposed on the priority functions V n (t).
It is obvious that the M 1 (t) bounds the accumulated priorities of class 1 customers, since it bounds the accumulated priorities for all customers in the queue. Note that t − M 1 (t)/b 1 is also a lower bound on the possible arrival times of the class 1 customers who are still in the queue.
To see that M 2 (t) bounds the accumulated priorities of class 2 customers, we consider the sample path behaviour in more detail. Assume that the queue starts empty, and that the first busy period commences at time τ 1 with M 1 (τ 1 ) = M 2 (τ 1 ) = 0. At any time t during the first service time, any queued customers of class 2, which must necessarily have an arrival time later than τ 1 , must have accumulated priority less than b 2 (t − τ 1 ).  (1) ), while the priority of the class 2 customers is bounded by Fig. 3b. In this case, the customer with priority V can be of either class. At any time t during the next service, the least upper bound on the priority of class 1 customers is V + b 1 (t − D n (1) ), and the priority of the class 2 customers is bounded by V + b 2 (t − D n (1) ).
At later departure times within the first busy period there are again three possible outcomes as above, and the argument follows in a very similar fashion, except that the expressions for M 1 (t) and M 2 (t) may be more complex as given in Definition 3.1 above. In each case we can infer bounds on the earliest possible arrival times of either class 1 or class 2 customers from the accumulated priority of the customer that enters service.
The expressions that we have given above for various quantities hold regardless of distributional assumptions for the queue. However, the assumption that the arrival process is Poisson leads to a result that we can exploit to show that the distributional properties of the maximum priority process are preserved if we do not keep track of the accumulated priority of the waiting customers, but instead sample the maximum such priority at each departure point. To express this, let M(t) ≡ σ {(M 1 (u), M 2 (u)), u ∈ [0, t]} be the filtration generated by the maximum priority process up to time t.

A waiting customer with priority
independently of the class of all other customers present in the queue. 4. The statements 1-3 above also hold at any random time T that is a stopping time with respect to M(t).
Proof If there is no customer in service at time t, the statements of the theorem hold vacuously.
1. Otherwise, let τ < t be the time at which the current service commenced.
independently of any random variable that is measurable with respect to M(τ ). The priorities of these customers at time t are such that V i , and so these occur as a Poisson process with parameter 2. The process of accumulated priorities {V k (t), k = 1, 2, . . .} of all customers still present in the queue at time t is the superposition of the processes of accumulated priorities {V i k (t), k = 1, 2 . . .} of the customers of class i still present in the queue at time t. These processes are independent, since the arrival processes of class 1 and 2 customers are independent Poisson processes, and the result follows from the well-known property that a superposition of independent Poisson processes is Poisson with rate equal to the sum of the individual rates (see, for example, [10, Exercise 2.1]). 3. This also follows from the well-known property that the individual processes in a superposition of independent Poisson processes have the same law as independent thinnings of the overall process [10, Exercise 2.2]. 4. The extension to random times that are stopping times follows from the strong Markov property of the Poisson process.
We conclude this section by recording formal expressions for M 1 (t) and M 2 (t) in terms of the arrival and service processes. Let This can be interpreted as the maximum number of customers who would have commenced service by time u under the permutation n if the system had not experienced any idle time. Let L(t), t ≥ 0 be the cumulative idle time experienced by the server up to time t given by We define K (t) = N S (t − L(t)) to identify the index of the current service, if one is under way. That is, if the server is busy at time t then the current service is the K (t)th, whereas if the server is idle at time t, then exactly K (t) − 1 services have been completed and the next, at the beginning of the next busy period, will be the K (t)th. Then, for t > τ n(K (t)) , with

Accredited customers and accreditation intervals
We shall refer to those class 1 customers in the queue with accumulated priority at time t that lies in the interval [M 2 (t), M 1 (t)) as accredited (at level 1), which we shall abbreviate to just accredited when there is no chance of confusion. Customers with priority in the interval [0, M 2 (t)) are unaccredited or non-accredited. Once a class 1 customer becomes accredited, they remain accredited until they enter service, since their priority is increasing at rate b 1 , whereas M 2 (t) is increasing at rate b 2 < b 1 . Thus, since M 2 (t) bounds the accumulated priority for class 2 customers, accredited class 1 customers are guaranteed service before any waiting class 2 customer.
A customer who enters service without being accredited can be of either class 1 or class 2. The service of such a customer will be followed by a sequence (possibly of length zero) of service times for accredited class 1 customers, before the next non-accredited customer is served, or the busy period ends. We shall refer to such an interval, consisting of the service time of a non-accredited customer followed by a sequence of service times of accredited class 1 customers as an accreditation interval (at level 1). A busy period for the queue can be broken into a sequence of accreditation intervals, and it is these intervals that we will study in greater detail in this section.
We begin with some observations about the process M 2 (t) and accreditation intervals. Thus, the durations of these periods are independent and exponentially distributed with parameter λ 1 + λ 2 . Furthermore, the stationary probability that M 2 (t) = 0 is 1 − ρ.

Consider a customer with priority
Such a customer can be either a customer of class 2, in which case its waiting time has been v/b 2 , or an unaccredited customer of class 1, in which case its waiting time has been v/b 1 . 3. Theorem 3.2(2) tells us that, at time t during a busy period, the priorities of customers lying in the interval [0, M 2 (t)) are distributed according to a Poisson process with rate λ 1 /b 1 + λ 2 /b 2 . These priorities are generated by a mixture of class 1 customers that have been arriving at rate λ 1 over the time and accumulating priority at rate b 1 , and class 2 customers that have been arriving at rate λ 2 over the time interval (t − M 2 (t)/b 2 , t] and accumulating priority at rate b 2 . Nonetheless, the distribution of the priorities at time t is the same as if customers had arrived in a Poisson process with rate and had all been accumulating priority at rate b 2 . 4. The customer who initiates a busy period, and thus the first accreditation interval in a busy period, is of class 1 with probability λ 1 /(λ 1 +λ 2 ), and their accumulated priority at this time is 0. By Theorem 3.2(3), the first customer in all other accreditation intervals during the busy period is of class 1 with probability and their accumulated priority v at this time is, almost surely, strictly greater than zero.
The maximum priority process during an accreditation interval has the form depicted in Fig. 4, which can be described as follows.

Fig. 4 An accreditation interval
• At time t 0 , the accreditation interval commences when an initiating, non-accredited customer of class 1 or 2 with accumulated priority V init moves into service. Note • If a customer completes service at time t, the accreditation interval continues as long as there is at least one remaining customer that has become accredited, which is of necessity of class 1 with priority greater than V init + b 2 (t − t 0 ). This customer moves into service, with service time distribution B (1) . If there are no accredited customers, the accreditation interval finishes. If there are non-accredited customers present in the queue with priority less than V init + b 2 (t − t 0 ), the one with the highest accumulated priority will start a new accreditation interval.
Otherwise an idle period starts, and the next accreditation interval will start when a customer arrives to the empty queue. • The overall service time distribution of the customer initiating the accreditation interval depends on whether the customer is also initiating a busy period of the queue. The customer who initiates the first accreditation interval in a busy period is of class 1 with probability λ 1 /(λ 1 + λ 2 ). The first service in this interval thus has distribution B The first customer in all other accreditation intervals is of class 1 with probability The superscript (2) in the above notation reminds us that we are dealing with the two-class case. We associate the subscript 0 with services occurring at the beginning of a busy period, and our use of the subscript 2 is consistent with our later treatment of the multiclass case. The logic behind it is that an unaccredited customer that initiates an accreditation interval with its priority lying in the interval [0, M 2 (t)) can be considered to be commencing its service 'at accreditation level 2'.
The following lemma will prove useful in our study of the duration of accreditation intervals.

Lemma 4.2 During an accreditation interval, the time points s k at which customers become accredited occur according to a Poisson process with rate
Proof Consider an accreditation interval, such as that illustrated in Fig. 4, initiated at time t 0 by a non-accredited customer with priority V init whose service time is T 0 . Class 1 customers who become accredited during this accreditation interval are either present at time t 0 , as is the customer who becomes accredited at time s 1 in Fig. 4, or arrive subsequently, as does the customer who becomes accredited at time s 2 in Fig. 4.
By Theorem 3.2(1), the priorities v k of those class 1 customers still in the queue at time t 0 are distributed according to a Poisson process with rate λ 1 /b 1 on the interval [0, V init ). These priorities increase at rate b 1 , so that at time t they are equal to , at least during the service time of this first customer. So a waiting customer whose priority at time t 0 was v k will become accredited during the service time of the initiating customer at time , provided that this time is less than t 0 + T 0 . The times s k thus occur according to a Poisson process on the interval [t 0 , min( 1 ), and this Poisson process is independent of T 0 .
On the other hand, the arrival times c k of class 1 customers who arrive subsequent to time t 0 occur according to a Poisson process with parameter λ 1 on (t 0 , ∞). A customer arriving at time c k will become accredited at time If this is less than t 0 + T 0 , then the customer will become accredited during the service time of the first customer. The set of such times s k thus occurs according to a Poisson process on the interval , and this Poisson process is again independent of T 0 . Now, let S 1 be the sum of the service times of all customers who become accredited in the interval [t 0 , t 0 + T 0 ). If there are no such customers, then S 1 = 0 and the accreditation interval finishes at time t 0 + T 0 . Otherwise, it will continue as the accredited customer with the highest priority moves into service. Via similar arguments to those given above, we see that customers become accredited during the inter- For j ≥ 2, let S j be the sum of the service times of all customers who become accredited in the interval Our assumption that the queue is stable leads to the fact that, with probability one, there will be an integer 1 ≤ J < ∞ for which S J −1 > 0 and S J = 0, at which time the accreditation interval finishes. For all j < J , the above argument can be repeated to establish that customers become accredited during the interval We thus conclude that the process of customers becoming accredited is a Poisson process with parameter λ 1

Lemma 4.3
The durations of the accreditation intervals are independent random variables whose distributions depend on V init only via I (V init > 0).
Proof It was observed in the proof of Lemma 4.2 that the duration of an accreditation interval depends only on the service time of the initiating customer and the arrival and service processes of the accredited customers who arrive during the interval. The distribution of the initiating service time depends on whether V init = 0, in which case the initiating service time has distribution B (2) 0 , or whether V init > 0, which ensures that the initiating service time has distribution B (2) 2 . Observe that all the random elements that affect the length of an accreditation interval are independent of the lengths of previous accreditation intervals, and so the lengths of successive accreditation intervals are independent of each other.
We would like to find the distributions of the lengths of the two types of accreditation interval: those that initiate a busy period and those that do not. From the discussion above, and Lemma 4.2, we see that these distributions will be the same as those of the busy period of an M/G/1 queue with arrival rate λ 1 (1 − b 2 /b 1 ) and service time distribution B (1) for all customers apart from the initiating customer, but with the initial service time in the accreditation interval having distribution B (2) 0 if the accreditation interval is the first in a busy period and B (2) 2 if it is the second or subsequent accreditation interval in a busy period.
We shall recall some relevant results concerning busy period and waiting time distributions for M/G/1 queues in the next section.

Waiting times and busy periods in the M/ G/1 queue
In this section we consider an M/G/1 queue with arrivals occurring as a Poisson process with rate λ, service times having mean 1/μ < ∞ with λ < μ and LST B(s). We shall connect the ideas of the maximum waiting time process and accumulating priority in a setting without distinct classes, before returning to discussion of the two-class queue in the next section.
The standard way of deriving the distribution of the busy period or waiting times in a M/G/1 queue is to analyse the virtual workload process U = {U (t); t ≥ 0} that measures the amount of work remaining in the queue at any time t; see, for example, Kleinrock [10, page 206]. In terms of the arrival and service processes, this process can be defined as where is the number of arrivals that have occurred by time t.
On the other hand, we can analyse waiting times via a single class analogue W (t) of the two-class maximum priority process that we defined in Sect. 3. Putting the accumulation rate b = 1, this process is zero at time t if the system is empty, and otherwise is equal to the maximum possible waiting time of any customer still present in the queue at time t, given the history of the process up to the time that the current customer started service.
In the single-class FCFS M/G/1 context, this is just the time in the system of the customer currently in service. Via reasoning similar to that used in Sect. 3, this process can be expressed as where K (t) is as defined previously, with the permutation n set to be the identity, The connection between the virtual workload process and the maximum waiting time process is illustrated in Fig. 5. The waiting time W n of the nth customer is the left limit of the virtual workload process at the time τ n . It is also the value of the This allows us to use known results about waiting times, obtained by analysing the virtual workload process, to analyse random variables associated with the maximum waiting time process at the points where customers go into service. The first such known result is the expression for the LST G(s) of the distribution of the length of a busy period, obtained by solving the functional equation . A related expression that we shall make heavy use of is the LST G 0 (s) of the duration of a busy period initiated by a service whose LST is given by B 0 (s) with subsequent services having LST B(s). This is shown in [5, page 151, equation (9)] to be given by where G(s) is the solution to (10). The second known result gives the LST of the waiting time distribution before a customer enters service in the stationary regime; see for instance Kleinrock [10, equation (5.105)], which is From Eq. (12), it follows in a straightforward manner that the LST of the stationary waiting time, conditional on it being positive, is Now consider the situation where b can be any real number in the interval (0, ∞) and let M(t) be the maximum accumulated priority at time t. Then and we see immediately that the priority that customer n has accumulated when it goes into service is bW n , where the sequence {W n } gives successive waiting times for the M/G/1 queue. It follows from Eq. (12) that in equilibrium the Laplace-Stieltjes transform of the accumulated priority at such a point of discontinuity is given by This last expression can also be interpreted as the LST of the waiting time in a timedilated M/G/1 queue (Eq. 12) with arrival rate λ/b and service times multiplied by a factor b relative to the original queue. The LST of the accumulated priority, conditional on it being positive, is

The LST of accumulated priority in the two-class queue
We return now to discussion of the two-class queue, and to determining the LST of the stationary accumulated priorities at the time points that customers move into service. Once we have the LST for the stationary accumulated priority, we immediately also have the LST for the stationary waiting time, by a simple rescaling of the argument, since a customer of class i with accumulated priority v upon entry to service has waited for time v/b i in the queue. First consider the case where service times have the same distribution for the two classes, with B (1) = B (2) = B and common mean 1/μ = 1/μ 1 = 1/μ 2 . By Lemma 4.2, customers become accredited as a Poisson process with rate λ 1 (1 − b 2 /b 1 ), so the duration of an accreditation interval has the same distribution as the busy period of an M/G/1 queue with arrivals at rate λ 1 (1 − b 2 /b 1 ) and service time distribution B. It then follows from expression (10) that the duration of an accreditation interval has a LST that satisfies the functional equation We shall employ this solution of Eq. (17) in a variety of contexts, and so we write its solution in terms of its parameters as (s; b 1 , b 2 , λ 1 , B). Following Eq. (10), an alternative notation for this is G(s; If the distribution B 0 of the initial service time in the accreditation interval is different from the succeeding service times, which still have distribution B, then for (s) satisfying (17), the length of the accreditation interval has LST given by Following Eq. (11), an alternative notation for this is G 0 (s; Taking derivatives and putting s = 0, or referring to Conway, Maxwell and Miller [5, page 151, Eqs. (7a), (9a)], we see that the mean duration of an accreditation interval of the form described by (17) is and the mean duration of an accreditation interval of the form described by (18) is where μ −1 0 is the mean of B 0 . We would like to derive the distribution of the value V of the accumulated priority of a customer at the point that it enters service during an accreditation interval. Suppose the accreditation interval commences at time t 0 . Let V init = M 1 (t 0 ) = M 2 (t 0 ) denote the initial priority level in the accreditation interval. If the accreditation interval initiates a busy period for the queue, then V init = 0. However, if the accreditation interval does not initiate a busy period then V init > 0 with probability one. Then the random variable V can be written as V = V init + V where V is any additional priority that the customer accumulates during the accreditation interval, after having accumulated priority V init . To calculate the distribution of V , we modify the delay cycle approach of Conway, Maxwell and Miller [5, p. 151] to obtain the following theorem. with parameters b 1 , b 2 , λ 1 and B, that starts at time t 0 with initial priority level V init , let V = V init +V denote the accumulated priority of customers at the point that their service starts.

The random variable V is independent of V init .
Proof Let S 0 denote the service time of the customer who initiates the accreditation interval and, for j = 0, 1, 2 . . ., recursively define S j+1 to be the time taken to serve customers who become accredited during the interval (t 0 + δ j−1 , t 0 + δ j ] where δ j = j i=0 S i and δ −1 is equal to zero. Note that these customers must have attained priority level v during the interval We shall denote the length of this interval by A j . For j = 0, 1, 2, . . ., define α j = (1−b)δ j , H j to be the distribution function of S j and H j (s) = E{e −sS j }. By Lemma 4.2, customers become accredited according to a Poisson process with parameter λ 1 (1 − b), and we readily obtain the fact that In a similar fashion to Conway, Maxwell, and Miller [5, pp. 152-155], consider a marked customer that attains priority level v in the interval (t 0 + α j−1 , t 0 + α j ] (so becomes accredited during the interval (t 0 + δ j−1 , t 0 + δ j ]), and condition upon S j , the residual duration Y of (t 0 + α j−1 , t 0 + α j ] at the time that the customer has priority level v, and the number N of customers who attained priority v during (t 0 + α j−1 , t 0 + α j ] prior to the marked customer, with the region of feasibility for Given that Y = y, the additional waiting time V /b 1 of the marked customer is equal to y, plus the N = n service times of the customers who attain priority v ahead of it in the interval (t 0 + α j−1 , t 0 + α j ], plus the difference between the time instant at the end of the interval, t 0 + α j , and the time instant t 0 + δ j . Thus Removal of the conditioning on N yields To remove the conditioning on S j = t, Y = y, we apply the direct analogue to the last expression in [5, page 153], and integrate over the region S against the joint density dyd H j (t)/[(1 − b)E(S j )]. Denoting by j the event that the tagged arrival occurs in the interval S j and paralleling the steps in Conway, Maxwell and Miller [5], we see that Evaluation of the final integral yields

and multiplying the conditional transform (27) by the probability P( j) = E(A j )/E(A) = E(S j )/E(S)
that the marked arrival attains priority v during (t 0 + α j−1 , t 0 + α j ] and summing over j, the intermediate terms cancel, yielding . Since S is just the total length of the accreditation interval, we can substitute the solution of the functional equation (17), evaluated at sb, for E{e −sbS }, and also use (19) to observe that E(A) = (1 − b)/(μ − λ 1 (1 − b)). Finally, remembering that S 0 is the initial service time and multiplying the argument of the LST by b 1 , because that is the rate of priority accumulation, we obtain expression (21).
In most circumstances below, the service time distribution for the customer that initiates an accreditation interval will differ from that of the customers who continue it. The result for this slight variant of (21) is given in the next theorem.

Theorem 6.2 If the initial service time distribution B 0 differs from the service time distribution of the subsequent customers within the accreditation interval, the LST of the priority accumulated during the interval is
where 0 (s) = 0 (s; b 1 , b 2 , λ 1 , B, B 0 ) in (18).
If B (1) = B (2) then accreditation intervals are all periods of the kind considered in Eq. (18) and Theorem 6.2, with B = B (1) . An accreditation interval starting a busy period at time 0 . On the other hand, an accreditation interval starting in the middle of a busy period with 2 . We will denote the LSTs of the distributions of the lengths of these accreditation intervals by, respectively, 2 ), both interpreted as in Eq. (18). The LST of the overall busy period distribution follows from the observation in Remark 4.1 that it can be considered as an accreditation interval with V init = 0, arrival rate λ 2 + λ 1 b 2 /b 1 , priority rates b 2 and 0 (rather than b 1 and b 2 respectively), and service time distributions (1) and (1) 0 (rather than B and B 0 , respectively). Thus, we can write the LST of the distribution of the length of this busy period as 0 (s; b 2 , 0, λ 2 + λ 1 b 2 /b 1 , (1) , (1) 0 ) as defined in Eq. (18). It is readily shown, after straightforward algebra and substitutions, that the implicit equation for this busy period LST yields an expression that is identical to that for an FCFS M/G/1 queue with both classes of customers, as one would expect.
The LST of the stationary accumulated priority of the non-accredited customers at the time that they enter service, conditional on it being positive, also follows from the above observation. It is given by the accumulated priority distribution with parameters b 2 , 0, λ 2 + b 2 λ 1 /b 1 , (1) and (1) 0 . That is, in the sense of Eq. (29). Class 2 customers must, of necessity, be non-accredited when they enter service and, by Remark 4.1, the class of such a customer is independent of its priority. Also by Remark 4.1, class 2 customers who start service with priority v have been in the system for time v/b 2 . Thus the LST of the stationary waiting time for class 2 customers is given by the weighted sum of the LSTs of zero and V (2) (s/b 2 ), A class 1 customer experiences one of the following outcomes: 1. It arrives to an empty queue. 2. It arrives to a non-empty queue, and is not accredited when it enters service. Since, by Theorem 3.2(3), the class of a non-accredited customer is independent of its priority, in this case the LST of its stationary accumulated priority on entering service is V (2) (s), given by equation (30). 3. It enters service during the first accreditation interval of the busy period, in which case its stationary priority has LST in the sense of Eq. (29). 4. It enters service during an accreditation interval which is started by an unaccredited customer of either class, with priority V init > 0, in which case the extra priority that the arriving customer accumulates above V init before it enters service has LST 2 ) (33) again in the sense of Eq. (29). Furthermore, this extra priority is independent of V init , which is distributed according to a random variable with LST V (2) (s), because V init is the priority of the non-accredited customer entering service at the beginning of the accreditation interval.
By Lemma 4.2, class 1 customers become accredited at rate λ 1 (1 − b 2 /b 1 ) when the queue is non-empty, while they arrive at rate λ 1 , so the probability that an individual class 1 customer, arriving during a busy period, becomes accredited is (1 − b 1 /b 2 ), while the probability that it enters service while unaccredited is b 2 /b 1 . Using the fact that class 1 customers arrive according to a Poisson process and so observe time averages, we derive the fact the stationary probability that a customer finds the queue empty is 1 − ρ, the probability that it begins its service as an unaccredited customer is ρb 2 /b 1 . The probability that a customer is accredited is ρ To derive the probabilities of the third and fourth cases, that is whether a customer is accredited during the first accreditation interval of a busy period or a subsequent one, we need to calculate the ratio of the mean length of the first accreditation interval to the mean length of the whole busy period. By (19) and (20), this is So the probabilities of the third and fourth categories are and respectively. So we finally arrive at the conclusion that the LST of the distribution of the priority of a class 1 customer when it enters service, conditional on this being positive, is and the LST of the waiting time is

The multiclass accumulating priority queue
In this section, we give multiclass versions of the results developed in Sects. 3, 4, and 6, that we will be using in later sections. These results will also form the basis for an efficient method for simulating an accumulating priority queue, which we will present in Sect. 10 below. We first define the maximum priority process M = {(M 1 (t), M 2 (t), . . . , M N (t)} for the multiclass queue.

Definition 7.1
The maximum priority process for the multiclass queue is defined as follows.
1. For all k = 1, . . . , N , M k (t) = 0 for all times t when the queue is empty. 2. At the sequence of successive departure times D n(m) , and, for 1 < k ≤ N ,

A waiting customer with priority V ∈ [M k+1 (t), M k (t)) is of class i with prob-
independently of the class of all other customers present in the queue.

The statements 1-3 above also hold at any random time T that is a stopping time with respect to M(t).
Proof Since arrivals occur as a Poisson process, the accumulated priorities of the customers of class k present in the queue at time t are distributed as a Poisson process with rate λ k /b k on the interval [0, M k (t)). The result then follows via similar reasoning as we used in the proof of Theorem 3.2.
We shall say that a customer (which must be of class j ≤ k) is at accreditation level k at time t if its priority lies in the interval (M k+1 (t), M k (t)]. Similarly, we shall say that a customer becomes accredited at level k when its priority moves into the interval (M k+1 (t), M k (t)]. An application of Lemma 4.2 yields the following as a corollary to Theorem 7.2.

Corollary 7.3 Within a busy period, the time points at which customers of class i ≤ k become accredited at level k occur as a Poisson process with rate
Thus, within a busy period, the time points at which customers of all classes i ≤ k become accredited at level k are distributed as a Poisson process with rate We say that a customer from class j ≤ k is served at accreditation level k if its priority lies in the interval [M k+1 (t), M k (t)) when it is admitted into service. An accreditation interval at level k is a period of time that starts either at the beginning of a busy period or when a customer is served at some accreditation level 1 for 1 > k, and finishes either at the end of a busy period or when another customer is served at some accreditation level 2 for 2 > k. Whenever a customer is served at accreditation level k, accreditation intervals at all levels < k commence. In particular, considering accreditation intervals at level 0 to be services of a single class 1 customer, an accreditation interval at level k can be divided into a sequence of accreditation intervals at level k − 1, all except the last of which finish when a customer is served at accreditation level k. Figure 6 illustrates this. It depicts the maximal priority process for a three-class accumulating priority queue. Accreditations intervals at levels 1 and 2 both start at the beginning of the busy period. The entire busy period can be thought of as an accreditation interval at level 3. The fourth customer to be served also starts accreditation intervals at levels 1 and 2. The third and fifth customers to enter service start an accreditation interval at level 1, but not level 2, while the service of the second customer can be thought of as constituting an accreditation interval at level 0. Notice that, for each k = 1, 2, 3, accreditation intervals at level k consist of a sequence of accreditation intervals at level k − 1.
We have defined the concept of an accreditation interval at level k. Each one of these can be thought of as a delay cycle in the sense of Conway, Maxwell and Miller [5] that starts with the service of the initiating customer and continues as long as there are customers at accreditation levels ≤ k. By Corollary 7.3, these customers arrive at rate k and have service time distribution Thus, conditional on the fact that such a delay cycle is started by a customer of class j, the duration of the cycle is given by in the sense of (11).
The following theorem gives an expression for the stationary proportion of time that the server spends on such customers. Theorem 7. 4 The stationary probability that the server is serving a customer that commenced their service at accreditation level k is Proof By Corollary 7.3, customers of class j ≤ k become accredited at level k in a Poisson process with rate λ j (b j − b k+1 )/b j , and they become accredited at level k − 1 in a Poisson process with rate j (t) be the number of class j customers served at accreditation level k in the interval [0, t]. Then it follows that the long-term rate λ (k) Thus the stationary probability that the server is serving a class j customer that commenced their service at accreditation level k is ρ (k) j = ρ j (b k − b k+1 )/b j and the stationary proportion of time the server spends on customers of all classes served at accreditation level k is ρ (k) = k j=1 ρ (k) j .

Waiting times in the multiclass queue: the general case
In this section, we establish a recursion between the LST of the waiting time distribution for delayed customers of a given class k with that of customers of class k + 1. Let us consider the waiting time distribution for customers of class k, where 1 ≤ k ≤ N − 1. Arriving customers of class k are of three kinds-those who begin a busy period, those customers within a busy period who are served at accreditation level k, and those customers within a busy period who are served at accreditation level for some ≥ k + 1. A proportion 1 − ρ of the customers of class k begin a busy period, and therefore experience a waiting time of zero. By Theorem 7.4, of those class k customers who arrive within a busy period, a proportion (b k − b k+1 )/b k are served at accreditation level k, and the remainder, a proportion b k+1 /b k , are served at some accreditation level ≥ k + 1. Thus we can decompose the LST of the waiting time distribution for class k customers so that where W unacc (s) denote the respective LSTs of the priority accumulation distributions for class k customers, served at accreditation level k or ≥ k + 1, respectively, within a busy period, and let V (k) (s) denote the LST of the class k priority accumulation distribution, conditional on it being positive. Then Using reasoning similar to the observations in Remark 4.1, we observe that those class k customers who arrive within a busy period and who are served at accreditation level ≥ k + 1 will have an accumulated priority on entering service that is distributed identically to that of a class k + 1 customer who arrives during a busy period, so that Thus, we can write The final element required to complete the specification of W (k) (s) is the LST of the priority accumulation distribution for class k customers, served at accreditation level k. These are customers who enter service with priority in the interval [M k+1 (t), M k (t)) during an accreditation interval at level k that must have been initiated by a customer served at some accreditation level ≥ k + 1. The length of this accreditation interval will depend on the service time distribution of the customer that initiated it. This will vary depending on whether the accreditation interval at level k started at the beginning of an overall busy period or, if it started within a busy period, according to the accreditation level at which it started.
We begin by considering an accreditation interval at level k − 1 that starts at the beginning of a busy period (and therefore is the first accreditation interval at level k −1 within an accreditation interval at level k that also starts at the beginning of the busy period). The first service in both such accreditation intervals has distribution and the accreditation interval at level k − 1 is continued by customers that are served at accreditation level ≤ k − 1. The duration of this accreditation interval thus has LST with β k−1 , as defined in Eq. (42), denoting the distribution of the service times of customers served at accreditation level ≤ k − 1.
The services that initiate subsequent accreditation intervals at level k − 1 within the initial accreditation interval at level k have service time distribution given by the LST where and the LST of the duration of these accreditation intervals at level k − 1 is The expressions on the right hand side of (49) and (51) should be understood as described in Eq. (11).

Lemma 8.1 The priority accumulation distribution for customers who are served at accreditation level k during an accreditation interval at level k that starts at the beginning of a busy period has LST
where the expression on the right-hand-side is evaluated by using Eq. (29).
Proof We apply the results of Theorem 3.2, with service times in that theorem replaced by durations of accreditation intervals at level k − 1. That is, we decompose an accreditation interval at level k into a succession of accreditation intervals at level k − 1.
The first, S 0 , will be initiated by the customer that initiates the busy period and, by the above reasoning, has a duration with LST (k−1) 0 (s). The remainder will be accreditation intervals at level k − 1 initiated by a customer of class j ≤ k who is served at accreditation level k. Again by the above reasoning, such a period has duration (k−1) k (s). The rate at which customers arrive that will be accredited at level k, but not k − 1 is given by (N ) k which can be rewritten as Now we consider accreditation intervals at level k that do not initiate an overall busy period. For j = 1, . . . , N , define where again the second expression on the right-hand-side of (53) is evaluated by using Eq. (29).

Lemma 8.2 The priority accumulation distribution for class k customers who are served at accreditation level k during accreditation intervals that are not initial accreditation intervals at level k of an overall busy period has LST
Proof The mix of customers initiating an accreditation interval at level k that lies within an overall busy period is different from that for the initiating interval. In particular, the initiating customer must be served at an accreditation level ≥ k + 1. Of those customers from class j ≤ k who are served within a busy period, a proportion (b j − b k+1 )/b j will be served at an accreditation level ≤ k, and so a proportion b k+1 /b j will be served at an accreditation level ≥ k + 1. Now consider the customers remaining in the system at the completion epoch of an accreditation interval at level k. The next customer to be served will be the one with the greatest accumulated priority. Unaccredited customers from class j < k + 1 will have the accumulated priority distribution of a class k + 1 customer. Customers from class j ≥ k + 1 will just have the accumulated priority distribution of a class j customer.
To progress further, we need to condition on the class, say j, of the customer initiating the accreditation interval at level k. Suppose that this customer had accumulated credit V init at the time they commenced service. Then as we observed earlier, the accumulated priority of a customer at the point their service commences can be written as V init + V , where V is the additional priority accumulated after priority V init is attained, which is independent of V init (although the form of its distribution depends on j).
For a customer of class j ≥ k + 1, the LST of the accumulated credit for a customer initiating an accreditation interval at level k will just be V ( j) (s). To find the LST of V , the argument now follows that for the initial accreditation interval, except that the length of the first accreditation interval at level k − 1 within this accreditation interval at level k now has LST (k−1) j,0 (s). The lengths of later accreditation intervals at level k − 1, within the accreditation interval at level k will again have LST (k−1) k (s). We again apply Theorem 6.2, but now with B 0 = (k−1) j,0 . For an unaccredited customer of class j ≤ k, the LST of the accumulated credit for a customer initiating an accreditation interval for class k will be V k+1 (s), and the argument then follows as for j ≥ k + 1.
Finally, we determine the probabilities of the various delay cycle types occurring. In the stationary regime, the system is idle for a proportion (1 − ρ) of the time. The remaining proportion of time ρ when the system is busy can be divided into the following separate cases: 1. An arrival to an empty server induces an accreditation interval at level k for all k = 1, . . . , N . Arrivals to an empty server from customers of class j = 1, 2, . . . , N occur at rate λ j (1 − ρ), and the mean duration of the accreditation interval at level k that such an arrival induces is 1/ is the stationary proportion of time that the server spends on customers served at all accreditation levels ≤ k. The proportion of time occupied by accreditation intervals at level k started by customers of class j that arrive at the beginning of a busy period is thus and, summing over j, the proportion of time taken up by all accreditation intervals at level k that occur at the beginning of a busy period is 2. An arrival finding a busy server must be served at accreditation level ≥ k + 1 to induce a further accreditation interval at level k. All arrivals of classes j > k that arrive to a busy system comply; their contribution due to these later cycles following the same logic as above is For the remaining classes, that is where j ≤ k, a customer must be served at an accreditation level ≥ k + 1 to induce a later accreditation interval at level k, and the contribution of such customers is Summing these two terms over j = 1, 2, . . . , N , we see that Combining these proportions, we see that as we would expect. For 1 ≤ j ≤ N , dividing the π (k) j by ρ and cancelling the common factor (1 − σ k ) from all terms, one arrives at the weights used in Eq. (54).

Finally, to obtain V (k)
acc (s) we need to take the appropriate mixture of V (k,0) (s) from Lemma 8.1 and V Proof This follows immediately from the argument in the preceding Lemma. Let denote the LST for the distribution of the delay incurred within an accreditation interval by a class k customer who becomes accredited either during the initial accreditation interval for class k in a busy period (the case j = 0) or a later accreditation interval with a busy period initiated by a class j service time (the case j > 0). Then, we have the following corollary.

Waiting times in the multiclass queue: the lowest class
In this section, we derive the LSTs of the waiting time distributions for delayed customers in the lowest priority class (class N ). The waiting time distribution for the lowest class is the starting point that we use in the recursive determination for the waiting time distributions of the higher classes presented in the previous section. While one could, of course, merely evaluate the general expressions derived in Sect. 8 in terms of a null lower priority class, as we did for the two-class case in Sect. 6, we gain further insight by an alternative approach, which exploits the fact that the lowest class is the only one incapable of overtaking any customers that it finds in the system upon arrival. This view enables us to establish that its waiting time distribution possesses a classical priority structure that the others do not. where N −1 is defined in (41), as defined in Eq. (10), and W (s; λ, B) is the M/G/1 waiting time LST given in Eq. (12).
Proof Before a marked customer from the lowest class enters service, all work present in the system upon arrival must be processed, as well as that brought by later arriving customers from higher classes whose priority overtakes that of the marked customer. Thus, we can treat the waiting time for the marked class N customer as comprised of two components. The first is the virtual workload present upon their arrival, which in the stationary regime has the same distribution as that of the stationary waiting time in the equivalent M/G/1 queue. By an argument similar to that used in the proof of Lemma 7.3, the instants at which customers of class i, 1 ≤ i ≤ N − 1 overtake the marked class N customer are distributed as a Poisson process with rate λ i (b i − b N )/b i . These customers will be served ahead of the marked customer, and the additional delay they introduce thus represents a "delay busy period" in the sense of Conway, Maxwell, and Miller [5, p. 151], with the arrival rate of customers equalling N −1 . The result then follows from (11) above.

Remark 1
In the N = 2 case, it takes a few lines of algebra to establish the equivalence of (31) and (63), but they are, indeed equivalent.

Remark 2
For appropriate values of the parameters, the waiting time distribution for class N customers turns out to be identical to that of the lower-priority group in a classical priority queue with two classes; see for instance [5,p. 164,Eq. (29)]. After substitution and elementary algebra, one finds that . (65) In the classical priority formulation with the notation of [5], the arrival rate of the higher priority class is

An efficient simulation procedure
We present below an efficient method for simulating an accumulating priority queue. One method to simulate the system, of course, is to use a standard event-scheduling approach, where the simulation maintains a record of all customers in the queue together with their accumulated priorities. The alternative simulation method that we describe here simulates the maximum priority process. It requires only that a record be maintained of the maximal priorities for each of the classes, the length of the current service time, and the time that it commenced. Theorem 7.2 is the basis for our alternative method of simulating the multiclass queue. The idea underlying the simulation is that at each departure instant, the class of the next customer to be served is determined by simulating the maximum accumulated priority as an observation from the non-homogenous Poisson process described in Theorem 7.2. Once the class of the next customer to be served is determined, their service time is drawn from the appropriate distribution for that class, the maximum priority processes are updated, and the simulation continues. The waiting time of a customer can be determined from the accumulated priority at the time it starts service. If the simulation of the non-homogenous Poisson process at a departure instant contains no points, then a busy period finishes, and the next busy period starts when the ensuing idle period is complete. We give a brief outline of the simulation below. Here we let τ m , χ(m), X m and D m be the arrival time, class, service time and departure time respectively of the mth customer to be served, for m ≥ 1 and we put λ = N i=1 λ i . We begin the simulation in the usual way with an exponentially distributed random variable with mean λ −1 giving the first arrival time, τ 1 , letting this arrival be of class k with probability λ k /λ, 1 ≤ k ≤ K , and then drawing a service time X 1 from the appropriate distribution. Given the initial τ 1 , χ(1), X 1 and D 1 = τ 1 + X 1 , then, for At the mth service completion time D m , for m ≥ 1, draw an exponentially distributed random variable E m,1 with mean b 1 /λ 1  If E m,1 > M 1 (D m −) − M 2 (D m −) then set k = 2, and carry out the following loop until a new customer is generated. For each k, draw an exponentially distributed random variable E m,k with mean then the busy period continues with the service of a customer at accreditation level k, and this customer (the m +1 st ) is of class finished. The interval to the first arrival in the next busy period is generated as before, the next service and departure times are generated in the same manner as for the first customer, and the pattern above is repeated until termination.
Notice that the simulation requires only that the maximum priorities be carried forward, and that at each step the service time for a customer be generated, but not their arrival time, unless the customer initiates a busy period.

Numerical example
To illustrate the utility of the accumulating priority queue model, we use it to test whether suggested accumulation rates produce waiting time distributions that comply with Canadian Triage and Acuity Scale (CTAS) [4] delay targets for a particular configuration. Below, we derive the waiting time distributions for an idealized emergency ward area treating only CTAS 4 (less urgent) and CTAS 5 (non urgent) patients. Our class 1 comprises the CTAS 4 stream, with class 2 comprising the CTAS 5 stream. The CTAS 4 Key Performance Indicator (KPI) is that treatment for at least 85 % of less urgent patients should have commenced within one hour. The CTAS 5 KPI is for at least 80 % of non urgent patients to commence treatment within 2 h.
We assume that the arrival rates for both classes are the same: on average, one patient arrives from each class every 25 min. We have assumed exponentially distributed treatment times for both classes, with a common mean of 10 min. Class 1 accumulates priority at rate 1 per minute, while class 2 accumulates at rate b < 1 per minute.
The waiting time distributions were recovered from the LST formulae presented in Sects. 5, 6, 7, 8, and 9 and via numerical inversion using the Gaver-Stehfest method [8,16] employing 10 points. The method of Abate and Whitt [1] could equally well have been used.
We compared the waiting time distributions produced by the LST inversion with data produced by simulating the queue. The simulation produced histograms of the waiting times of a total of half a million customers over the two classes, that were virtually indistinguishable from the numerically-produced distributional curves. We report the waiting times as scaled multiples of the mean service time of 10 min, so that, for example, t = 6 corresponds to 60 min. Figure 7 illustrates that the KPI for CTAS 4 is met provided that the class 2 accumulation rate b does not exceed a value just slightly less than 0.5. It is an interesting question how we solve the inverse problem of identifying the maximum value of b such that the stated KPI is met precisely. Figure 8 indicates that practically any priority accumulation rate 0 < b ≤ 1 will result in the KPI for CTAS 5 being met. As a result, rather than a unique value of b, there is a range of values of b that is compatible with both KPIs being met. It is then open to Emergency Department administrators to choose a value of b that meets some further criterion. In contrast, when the same example is rerun with the arrival rates increased by 12.5 %, there is in fact no value of b for which both criteria are met.
The fact that there may be alternately an entire set of accumulation rates meeting all KPI criteria, or none at all, suggests that a variety of optimization problems can be formulated to identify the best among the feasible solutions available. This aspect is being explored by the authors in follow-up work.

Conclusion and discussion
A number of extensions to the model studied here spring to mind almost immediately. We have mentioned above the task of inverting the problem to identify the extremal class 2 accumulation rate b in a two-class context so that a particular waiting time tail KPI is just met, and the more general problem of formulating a variety of optimization problems that select the "best" set of b i s in some sense that not only meet the stated KPIs, but also optimize other appropriate objectives. There are, in addition, a number of extensions to the basic model itself to consider. The first of these is to derive the waiting time distributions for the case where patients are assigned a strictly positive initial priority (which may depend upon their class) immediately upon arrival, rather than starting from 0. Further generalizations involve models where the priority accumulation function takes a more general form. For example, Kleinrock [13] considered a model where the priority at time t of a customer who arrived at time t 0 < t is of the form b i (t − t 0 ) α . Piecewise linear priority accumulation functions are also possible.
A further performance measure of interest is the joint stationary queue-length distribution of customers of all classes. We believe that this is related to the stationary distribution of the maximum priority process, the derivation of which is an interesting problem in its own right.
A multi-server variant of the present model is called for; at present, it seems to the authors that the only case that is tractable is the special case where all classes have exponentially distributed treatment times with the same mean. Finally, one can consider the case in which the lowest priority stream represents a set of scheduled tasks, to which higher priority customers appear at random. Such a model would seem to be appropriate in a surgical setting in which scheduled elective surgeries are disrupted by a stream of urgent surgeries arriving from the Emergency Department.
Addendum: At the galley proof stage the authors became aware of the paper [14] by Ramanan and Stolyar. This paper analyzes a certain "largest-weighted-delay-first (LWDF) scheduling policy", which is related to our "accumulating priority discipline".
Specifically, the paper [14] uses a large deviations approach to compute the exponential decay rate of the stationary distribution of the maximal weighted delay experienced by a set of different customer classes under the LWDF policy, and also shows that the LWDF policy is optimal (within a large class of work-conserving scheduling policies) with respect to maximizing this exponential decay rate.