We are currently seeing the effect COVID-19 has on healthcare services in vast majority of countries in the world. Healthcare services are also under increasing pressure as demographics change and populations age. Public health services are struggling, and sometimes failing, to maintain services under this increasing load. Given this context of high demand for tightly constrained resources it is instructive to reassess the rationales for prioritization regimes currently in use, and contrast with other possibilities. Specifically, in this paper we characterize the performance of the very commonly used static priority regime, and contrast it with the recently proposed accumulating priority regime, under critical loadings.
Healthcare systems have traditionally used static priority queues in a range of settings from triage in an emergency departments (EDs), to organizing access to elective surgeries, such as hip and knee replacements [5] , [1] . In a static priority regime, patients are assigned to a priority class, and must wait to be treated until all patients in higher priority classes have been treated. Patients may sometimes be moved to a higher priority class if their condition deteriorates, but in practice there is often no automatic mechanism for making such transitions, and any adjustments may rely on patients proactively approaching their healthcare provider. Accumulating priority queues (APQs) have recently been proposed to overcome some of the inherent drawbacks of static priority queues in healthcare [13] . In accumulating priority queues, patients accumulate priority with time spent in the queue, at a rate that depends on their priority class, with higher priority patients accumulating priority faster than lower priority patients. Priority can accumulate linearly, or in a nonlinear fashion. Observational studies of behaviour in emergency departments have revealed that in practice physicians may operate a regime that is similar to an APQ, with the likelihood of being seen increasing more rapidly as waiting times approach threshold targets, see e.g. [5] .
The accumulating priority regime was first proposed by Kleinrock [10] , who obtained expressions for the expected waiting times for all classes. A large-deviations principle has been established in [15] . More recently, Stanford et al. [13] derived expressions for the Laplace Stieltjes Transform of the waiting time distribution, which can then be inverted numerically. A later paper [11] , showed that a wide range of possible accumulation functions (including, for instance, exponential and log) have an equivalent linear regime, in the sense that the order in which patients are seen is the same in both the nonlinear and linear formulation.
This paper considers the performance of a single server queue with total arrival rate ρ and service rate 1, where ρ, the load on the server, either satisfies ρ ↑ 1 or ρ > 1. The heavy traffic regime has been intensively studied, although not for the accumulating priority queue. When ρ > 1 queues are overloaded and hence unstable, and no equilibrium exists. Unstable queues, if unchecked, grow without bound, which is unrealistic for almost every application, and of course, an infinite queue never exists in practice. However, there are many applications where arrival rates are greater than service rates for shorter or longer periods. Traffic networks are an immediate example. In many cities rush hour queues build up, and then decay, not because the system can cope with the increased volume of traffic but simply because the flow into the network has reduced as rush hour passes.
At the time of writing, one cannot overstate the importance of looking at healthcare systems in the situations when demand suddenly exceeds capacity. We see healthcare systems of a very large number of countries being overwhelmed with an influx of patients.
Healthcare can however suffer from a similar excess of demand over capacity in other situations, particularly in winter, and for those healthcare systems which experience loss of capacity over longer periods, addressing the issue of how best to organize patient prioritization is vital [12] . Emergency departments may also see increased demand due to patients who could have been treated by their GP, but were deterred by cost (e.g. in New Zealand, where hospital visits in the public health system are free, but GP visits are not), or long waiting times for GP appointments. No patient arriving in a period when ρ > 1 actually sees an infinite queue -rather they see a large, possibly very large, queue ahead of them. Their waiting time for treatment, given they have joined the queue, is also not infinite, but as a patient's condition deteriorates, it may nevertheless be far too long. In practice also, if ρ is close to 1, then over relatively short periods of time it may be difficult to determine whether ρ < 1 or ρ > 1. Thus there is a strong practical need to address the question of how best to organize patient prioritization in this transient regime.
Indeed, we will see below that the two cases: a) ρ << 1 and b) ρ ↑ 1 or ρ > 1, require fundamentally different approaches to patient prioritization. If ρ << 1, then the accumulating priority regime ensures that all patients are seen in a timely manner, while ensuring health targets are met (if those targets are feasible). On the other hand, if ρ ↑ 1 or ρ > 1, then it is impossible to limit waiting times for all patients, and the static priority regime provides a mechanism for ensuring that healthcare is still available to the most acute, and vulnerable, patients (see Fig. 2 below), whereas under APQ the expected waiting times for all classes increase ( Fig. 1 below) . For this scenario we propose below a mixture of the two prioritization schemes. Section 2 gives a detailed description of the models we consider. Section 3 considers the case where ρ = 1 − , as ↓ 0, while Section 4 considers the case where ρ > 1. In Section 5 we discuss issue related to customers making strategic decisions. We conclude with a short discussion of related models and potential future research directions in Section 6.
We consider a service system with a single server and N + 1 classes of customers. Customers (patients) of class i arrive according to a Poisson process with rate λ i and their priority class is associated with a positive real number b i for 1 ≤ i ≤ N + 1. The higher the number b i , the higher the priority class, and without loss of generality we assume b 1 > b 2 > . . . > b N > b N +1 . Thus arrivals of class 1 are in the highest priority class and arrivals of class N + 1 are in the lowest priority class.
If a customer finds the server idle upon its arrival, the server immediately starts serving this customer. Priority is non-preemptive, that is, if the server is busy when a new customer arrives, the customer joins the waiting room regardless of her priority class. The room is assumed to be of infinite size. Whenever the server finishes serving a customer and the waiting room is non-empty, the server starts to serve the customer with the highest current priority among those currently in the waiting room. We consider two different priority policies:
• Static priorities (SP): in this case a customer of class i has priority level b i which does not change; • Accumulating priorities (AP): in this case a customer of class i that spent s, s ≥ 0, units of time waiting in the waiting room has priority level b i s.
We assume, without loss of generality, that service times for customers are independent and exponentially distributed with mean 1. Therefore
is the load on the system -the average amount of new work arriving per unit of time -and ρ < 1 is necessary for stability. We will consider the system in high loads in two scenarios. In the first scenario we assume that ρ = 1 − ε and ε ↓ 0. The system is stable for any ε > 0, but, as ε decreases to 0, the average number of customers waiting in the queue in the stationary regime (and, by Little's formula, the average waiting time of a typical customer arriving in the system) tends to infinity. In the second scenario ρ > 1 and the system is thus unstable.
Our goal is to study the behavior of the expected waiting time of a customer from each of the classes, in the two scenarios described above, and under the two different priority policies.
In this section we consider a sequence of systems indexed by ε > 0 such that the loads in these systems increase to 1. More precisely, we assume that λ 1 (ε), . . . , λ N +1 (ε) are non-decreasing functions of ε > 0 such that λ i (ε) ↑ λ i as ε ↓ 0 for all i = 1, . . . , N + 1,
An interesting special case of the setting above is the scenario where λ 1 , . . . , λ N are fixed and λ N +1 (ε) = 1 − (λ 1 + . . . + λ N ) − ε, but we do not restrict ourselves to this case.
Regardless of the service discipline chosen, the systems are stable for any ε > 0. Denote by (Q ε 1 , . . . , Q ε N +1 ) the vector of steady-state queue lengths and by (W ε 1 , . . . , W ε N +1 ) the vector of steady-state waiting times (inclusive of the service time), for a particular value of ε. We also let Q ε i = E (Q ε i ) and W ε i = E (W ε i ) be the expected queue length and waiting times respectively, for all i. Regardless of the service discipline,
as ε → 0. The total queue lengths thus increase to infinity, and we are interested in how queue lengths, and waiting times, of the individual classes behave.
Consider first the SP priorities. Let σ i (ε) = i k=1 λ k (ε), 1 ≤ i ≤ N + 1, with σ 0 (ε) = 0. Let also σ i = lim ε↓0 σ i (ε). From Cobham [4] , we obtain that the expected waiting times for the priority classes are given by
and we can write
Thus, we see that as ε → 0,
Thus, as ε → 0, in the (SP) case, the expected queue lengths and waiting times for classes 1 to N are bounded from above, while for class N +1 they grow without bound. The durations of busy periods also increase without bound.
For the AP case we can conclude from the Kleinrock formula ( [10] , see also [13] ) that waiting times for all customers grow without bound as ε → 0, so that if the b i are held constant, this regime does not offer the same protection for the higher priority classes as SP does. Indeed we can prove the following exact statement. Lemma 1. Consider an accumulating priority queue with N + 1 classes, and accumulation
We present a proof of Lemma 1 below but first comment on its implications. The result may be interpreted as follows: a customer from class i entering service after waiting for time W i has, at that time, priority b i W i . Lemma 1 essentially states that the (AP) discipline makes all these priorities just before service equal on average, across classes, in heavy traffic. This is similar to the behaviour in heavy traffic of the MaxWeight protocol (see [14] ) which equates scaled queue lengths (we discuss this connection further below).
Lemma 1 also implies that W ε i → ∞ as ε ↓ 0 for all i, and hence lim ε↓0
which also means that
Proof of Lemma 1. In order to simplify notation, in this proof we will drop the dependence of λ i and W i on ε. The formulas from [10] adapted to our setting are as follows:
We use a proof by induction on i = N + 1, . . . , 1. First write 
These results suggest that in the AP regime, the accumulation rates need to be adjusted if the system is subjected to increasingly heavy loads. A natural solution we propose is to
. This effectively applies the SP regime to the lowest priority class, while maintaining the positive benefits of the AP regime for the remaining classes. More generally, we could consider regimes where b i (ε) = c i /ε for fixed c i , {1, . . . , M } for any M ≤ N . If M < N , then the split between classes following AP and those following SP will still provide benefits to the higher priority classes. Whatever the split, only the lowest priority class will experience delays that grow without bound.
We illustrate the conclusions above with typical sample paths of a system with N = 2 (there are therefore 3 classes of customers) under different priority regimes. Assume that arrival intensities are given by λ 1 = λ 2 = 1/3 and λ 3 = 1/3 − ε, and priorities b 1 = 3, b 2 = 2 and b 3 = 1.
In the case of accumulating priorities one can see (Fig. (1) ) that the numbers of customers in all classes become large. If static priorities are used (Fig. (2) ), only the number of customers of class 3 grows large, whereas the numbers of customers in classes 1 and 2 remain reasonably small at all times. We can also see from proposed solution is applied, the sample path looks similar to that of the system with static priorities. A further example (see figure 4) illustrates how by changing the priority regime one can avoid long waiting times for high-priority customers if there is a sudden surge of lowerpriority customers. There are, as before, three priority classes, λ 1 = λ 2 = 1/3 for the entire simulation. In the first quarter of the simulation time λ 3 = 1/3 − 0.3, so the total load of the system is 0.7, the system is in relatively light traffic and the accumulating priorities are used. All queue lengths are small. In the second quarter of the simulation time the arrival rate of the low priority customers suddenly jumps (this could represent for instance seasonal effects) to λ 3 = 1/3 − 10 −3 , so the total load in the system is 1 − 10 −3 and the system is in heavy traffic. One can observe all queues becoming large, including that of the highest priority customers. At this point we switch to the static priority regime and apply it for the remainder of the simulation time (arrival rates remain such that the system is in heavy traffic). One can observe that the static priority regime ensures that only the low-priority queue is large, queues of higher-priority customers are small.
In this section we assume that Λ = λ 1 + . . . + λ N < 1 is fixed. We assume in addition that ρ = Λ + λ N +1 > 1 and is also fixed, and further that ρ − λ i < 1 for any i (i.e. the Figure 4 : Switching from accumulating to static priorities stabilises queues of high-priority customers system without any class would be stable). We have two particular cases in mind but do not restrict our attention to these. The first case is similar to the one we had in mind when studying the system in heavy traffic: an increase in the lowest-class arrival rate takes the system load above capacity. Another case may illustrate a catastrophic event, such as for instance a pandemic where a sudden jump in the highest-priority patients may lead to a system operating above capacity. Since ρ > 1, and the system is therefore unstable, in this section we study a fluid version of the model in which we consider separately the queue for each customer class.
We suppose that the level of queue i at time t > 0, L i (t), is given by
where D i (s) denotes instantaneous service rate enjoyed by queue i.
In the case of (SP) D 1 (s) = I(L 1 (s) > 0) + λ 1 I(L 1 (s) = 0) for s > 0. As long as L 1 , the queue for class 1 is strictly positive, all the available service capacity is directed to class 1.
Once L 1 has emptied, the new arrivals of class 1 are assigned a dedicated service rate of λ 1 . Since λ 1 ≤ Λ < 1, this guarantees that L 1 (t) = 0 for all t ≥ T 1 for some finite T 1 . If N ≥ 2, then D 2 (t) = 0 for t < T 1 . For values of t > T 1 , we have D 2 (t) = (1 − λ 1 )I(L 2 (t) > 0) + λ 2 I(L 2 (t) = 0), that is, a fraction λ 1 of the available rate is used to keep L 1 at zero, and the remaining service capacity is all assigned to queue 2, while it is positive. Once L 2 drops to 0, only a fraction λ 2 of the available capacity is required to drain the queue length at the same rate at which arrivals occur. Thus, since λ 1 + λ 2 ≤ Λ < 1, L 2 (t) = 0 for t > T 2 for some finite T 2 .
Similarly to the above, we can conclude that there exists a finite T = T N such that L 1 (t) = . . 
When considering accumulating priorities we define the maximal priority process for each queue i, 1 ≤ i ≤ N + 1, as
Here we have replaced W i (t) by L i (t)/λ i , which is the age of the oldest fluid particles in the system -for the fluid model considered here, these are equivalent.
If arg max j {P j (t)} is unique, then
On the other hand, if arg max j {P j (t)} is not unique, let
Under the accumulating priority regime, if two or more classes have priority max j {P j (t)} then service capacity should be divided between them in such a way that their priorities remain equal (and maximal). Therefore, if |J | > 1, then P i (t) = c, say, for some constant c ∈ R + for all i ∈ J . Thus
and hence
Recall that c = P i (t) for all i ∈ J , and recall that we assume ρ − λ i < 1 for any i. Thus P i (t) < 0 for any i ∈ J as long as J does not consist of the entire set {1, . . . , N + 1} and P i (t) > 0 as long as J = {1, . . . , N + 1}. Thus we can now understand the dynamics of the process of priorities: if we start at time 0 with a unique class with the highest fluid priority, its priority is decreasing until it equalises with the priority of another class. From that point onwards, the two priorities stay the same, and both are decreasing at the same rate, until they equalise with the priority of a further class. This continues until all priorities equalise, from which point onwards these priorities grow infinitely. This of course implies that the levels of fluids grow infinitely.
Note also that the above may be summarised for the level of queue i as follows: once all priorities have equalised,
which shows that the relative queue lengths are exactly as in (5).
As before, a solution to the possibility of queues growing without bound if the accumulating priority regime is applied to all classes is to either employ a static priority regime, or a mixture of accumulating and static priority regimes, but in either case the lowest priority class needs to be operating under the static priority regime. Both the pure static priority regime, and the mixture, yield identical fluid solutions for classes 1, 2, . . . , N as t → ∞, with L i (t) = 0, t > T S for some T S > 0. On the other hand, L N +1 → ∞ as t → ∞, under any of the regimes.
The analysis throughout the previous sections shows the implications of an exogenous growth of demand that loads the system to its (almost) full capacity. As a consequence, depending on the priority regime used, some, or all of the class-specific queues may grow without a bound.
Such an exogenous growth, in the healthcare context, may be a result of a decease outbreak, seasonality, natural disaster, etc. Our findings suggest that the impact of such increase in demand may spread over the whole system. What the analysis so far lacks to capture are secondary effects due to patients behaviour, that is, how patients of different urgency classes adapt to this change. We leave the exact analysis of such an effect to future research. Nevertheless, we provide some insights on this case.
There is a vast literature on strategic customer behavior in queues. For a comprehensive literature review see [8] (until 2003) and [7] (from 2004). The most relevant model to the purpose of our analysis is where customers face a "to queue or not to queue" situation (see, e.g., [6] ) where customers decide whether or not to join an unobservable queue while taking into account that other customers face the same dilemma. Specifically, assume that each customer incurs a cost of C > 0 per unit of time they spend in the system and values the service by R > 0. In the healthcare context, C may be related to the urgency of the patient and R may be seen as the cost and risk associated with no treatment or the price of an alternative (private) treatment that comes with a negligible wait. Here as well, R is related to the urgency of the patient condition where relatively low values of R are associated with elective treatments whereas life threatening condition are associated with extremely high values.
Given a joining strategy of the other customers, a customer evaluates her expected (stationary) waiting time, henceforth denoted by W . Under Nash equilibrium, all the customers use their best-response strategy against the strategy used by the other customers, that is, they decide to join the queue if CW < R, to balk if CW > R, and join with any probability if CW = R. Note that depending on the model under consideration, C, R, and W may be customer specific.
In the basic model, customers arrive according to a Poisson process at rate λ, service times are exponential with rate µ, the service regime is first-come first-served (FCFS), and customers are homogeneous with respect to their economic parameters C and R. A symmetric (mixed) strategy here is to join the M/M/1 queue with probability 0 ≤ p ≤ 1. When all the customers use the strategy p, the resulting stationary expected waiting time at the resulting M/M/1 queue is 1 µ − pλ if µ > pλ, and ∞ otherwise. If p is such that C/(µ − pλ) < R, then an individual customer is better off by joining the queue (with probability 1). Likewise, if C/(µ − pλ) > R, a rational customer balks. An individual customer is indifferent between the two options if R = C/(µ − pλ). Therefore, a symmetric Nash equilibrium, in which no customer has the incentive to deviate from the common strategy used by the other customers, is a joining probability p e such that
where p * is the unique solution in p of
The analysis above suggests that if R is high enough, that is R > C/µ, the equilibrium effective arrival rate as a function of λ equals p e λ = λ λ < µ − C/R µ − C/R λ ≥ µ − C/R, and the corresponding equilibrium expected waiting time equals
In words, for low arrival rates, the system behaves as an ordinary M/M/1 queue, that is, an increased demand affects expected waiting times. However, past some point, an additional increase of demand will drive the expected waiting past the service value R and some customers will therefore prefer the alternative over joining the queue. The resulting effective arrival rate and expected waiting time are therefore unchanged. Equation (6) also suggests that when the potential demand is high enough, the waiting times are in fact determined by the economic parameters R and C. In particular, as R in the healthcare context is typically extremely high-especially in life-threatening situations and expensive elective procedures-so are the expected waiting times. Another way to look at this would be that the existence of private alternatives at a reasonable price may act as a safety valve: the private sector absorbs the public system's over-demand when waiting times are going too high.
This basic idea applies also to the multi-class model and priority queues considered in this paper, where the condition and urgency of the patients not only determines their priority class, but also determines their values for R and C. The analysis in Section 3 suggests that when the arrival rate grows towards system capacity, the expected waiting time of the lowest priority class (class N + 1) grows without a bound. Regarding the rest of the priority classes, their waiting times also grow without a bound in the case of AP whereas they remain finite under SP. Taking into account that patients react strategically leads to the following conclusion. If there exist an alternative to class N + 1 patients at a reasonable price R, their effective arrival rate will stop growing at some point, and their, as well as all the other classes' waiting times will remain finite, even when AP are used. Thus, by creating such an alternative (e.g., in the form of reasonably priced private treatment), the effect of high loads are moderated. For more on equilibrium behaviour in multi-class priority queues, see [9] .
We have seen that in heavy traffic, the highest priority classes need greater protection than is afforded by the accumulating priority queue with fixed accumulation rates. This can be achieved either by permitting accumulation rates to grow in inverse proportion to in the case ρ = 1 − , or by applying a static priority regime to the lowest priority class. In either case the lowest priority class suffers from increasing waiting times, but higher priority classes are protected from this growth.
These results have implications for other scenarios where prioritisation of tasks is a feature. We discuss below two other important areas of application, but we believe that the potential applications are considerably wider.
Prioritisation of tasks has been introduced in models of human dynamics where, upon completing a task, a person chooses the task from their to-do list with the highest priority to be performed next. A variant of static priorities has been considered in [2] and a version of accumulating priorities -in [3] . Few people would disagree with the observation that at least at some points in our lives we all experience an overload of our to-do lists. This may be modelled as the arrival rate being (perhaps temporarily) close to, or even above, the completion rate, exactly the settings considered in this paper. Our results can therefore be interpreted as follows: when the number of tasks on the to-do list grows, if time-dependent priorities are used, the number of outstanding high-importance tasks will grow. In order to prevent this, either static priorities, or a combination of accumulating and static priorities suggested here, should be used.
Another connection we would like to highlight is to wireless transmission protocols, namely the celebrated MaxWeight introduced in [16] . A simple version of it may be described as follows: there are a number of queues, each with its own exogenous stream of arriving jobs, and a single server which, upon completing a job, chooses the next one to perform from the queue with the largest number of outstanding jobs. Other priorities have also been discussed, in particular weighted queue lengths. If one views our model as tasks from the same class forming a queue, then in the case of accumulating priorities the server chooses the next task from the queue with the highest weighted waiting time of the longest-waiting task. Situations considered in this paper are such that the numbers of outstanding tasks in all queues grow to infinity. In this case, the waiting time of the longest-waiting customer is proportional to the number of outstanding tasks. Therefore, in the regimes considered here, the behaviour of the accumulating-priority queue is the same as that of the system governed by an appropriately weighted MaxWeight algorithm.
In this note we focused on average waiting times and queue lengths. It is of course important to study their distributions, which is a subject of our ongoing research. Another research direction we are currently pursuing is a more realistic scenario where customers abandon the system if they waited longer than a certain (perhaps random and perhaps classdependent) threshold. Strategies minimizing the abandonment rate are of great practical interest.