Céline Comte

Jan-Pieter Dorsman
email: j.l.dorsman@uva.nl

Pass-and-Swap Queues

Keywords: Order-independent queue, product-form stationary distribution, network of queues, quasireversibility, first-come-first-served, assign-to-the-longest-idle-server

published or not. The documents may come

Introduction

Since the pioneering work of Jackson [START_REF] Jackson | Networks of waiting lines[END_REF] in the 1950s, queueing networks with a product-form stationary distribution have played a central role in the development of queueing theory [START_REF] Boucherie | Queueing networks: A fundamental approach[END_REF][START_REF] Serfozo | Introduction to stochastic networks[END_REF]. In general, the stationary distribution of a network is said to have a product form if it can be written as the product of the stationary distributions of the queues that compose this network. Further examination of queueing networks with this property led to several breakthroughs, such as the discovery of BCMP [START_REF] Baskett | Open, closed, and mixed networks of queues with different classes of customers[END_REF] and Kelly [START_REF] Kelly | Networks of quasi-reversible nodes[END_REF] networks, which demonstrated the broad applicability of these models. In addition to implying statistical independence between queues, this product-form property is appealing for its potential for further performance analysis.

In a product-form queueing network, the notion of product form is also relevant at the level of an individual queue in the sense that, aside from the normalization constant, the stationary distribution of each queue is a product of factors, each of which corresponds to a customer in the queue [START_REF] Van Dijk | On practical product form characterizations[END_REF]. Dedicated 1 study of this type of product form has gained momentum recently, mainly because of the rising interest in queueing models with arbitrary customer-server compatibilities, in which not every server is able to fulfill the service requirement of any customer. Such compatibility constraints are often described by a bipartite graph between customer classes and servers, like that of Figure 1. These models arise naturally in many timely applications, such as redundancy scheduling [START_REF] Bonald | Balanced fair resource sharing in computer clusters[END_REF][START_REF] Gardner | Queueing with redundant requests: Exact analysis[END_REF] and load balancing [START_REF] Comte | Dynamic load balancing with tokens[END_REF][START_REF] Comte | Resource management in computer clusters: algorithm design and performance analysis[END_REF] in computer systems, resource management in manufacturing systems and call centers [START_REF] Adan | A loss system with skill-based servers under assign to longest idle server policy[END_REF][START_REF] Adan | A skill based parallel service system under FCFS-ALIS -steady state, overloads, and abandonments[END_REF], and multiple instances of stochastic matching models [START_REF] Adan | FCFS parallel service systems and matching models[END_REF][START_REF] Moyal | A product form for the general stochastic matching model[END_REF]. Although the dynamics of these queues are rather intricate, their stationary distributions all have a product form, which facilitates exact derivation of performance measures. A more complete overview of these results can be found in [START_REF] Gardner | Product forms for FCFS queueing models with arbitrary server-job compatibilities: an overview[END_REF].

1 2 1 3 2
Customer (or job) classes Servers (or machines)

Figure 1: A compatibility graph between two customer classes and three servers.

Order-independent queues and pass-and-swap queues A remarkable class of queues that exhibit such a product form is the class of order-independent (OI) queues [START_REF] Berezner | Quasi-reversible multiclass queues with order independent departure rates[END_REF][START_REF] Berezner | Order independent loss queues[END_REF][START_REF] Krzesinski | Order independent queues[END_REF]. These are multi-class queues in which, at any point in time, the rate at which any customer completes service may depend on its own class and the classes of the customers that arrived earlier. OI queues owe their name to the fact that the overall service rate of all present customers, although it may depend on their classes, cannot depend on their arrival order. It was shown in [START_REF] Berezner | Quasi-reversible multiclass queues with order independent departure rates[END_REF] that OI queues have a product-form stationary distribution. Furthermore, as observed in [START_REF] Gardner | Product forms for FCFS queueing models with arbitrary server-job compatibilities: an overview[END_REF], many product-form results found for the above-mentioned applications resemble analogous results for OI queues. Several other studies pointed out connections between the above-mentioned applications and placed them in a more general context of product-form queueing models; cf. [START_REF] Adan | FCFS parallel service systems and matching models[END_REF][START_REF] Ayesta | On a unifying product form framework for redundancy models[END_REF].

In this paper, we show that this class of queueing models can be extended in yet another direction, namely the routing of customers within the queue. We do so by introducing pass-and-swap (P&S) queues, which preserve the product-form stationary distribution of OI queues while covering a wider range of applications. The distinguishing feature of P&S queues is a so-called swapping graph on customer classes, such that there is an edge between two classes if customers of these classes can be swapped with one another. Whenever a customer completes service, it scans the remainder of the queue, passes over subsequent customers that are of a non-swappable class, and swaps roles with the first customer of a swappable class, in the sense that it takes the place of this customer, to start another round of service. The ejected customer, in turn, scans the rest of the queue, possibly swapping with yet another customer, and so on. This is repeated until a customer can no longer find a customer to be swapped with. This is the customer that leaves the queue.

Applications to machine clusters

We shall also see that, in addition to their theoretical appeal, P&S queues can be used to describe the dynamics of load-distribution and scheduling protocols in a cluster of machines in which jobs have assignment constraints. This cluster model, which can represent various computer clusters or manufacturing systems in which not every machine is able to fulfill the service requirement of any job, has played a central role in several studies of product-form queueing models over the past decade; see e.g. [START_REF] Adan | A loss system with skill-based servers under assign to longest idle server policy[END_REF][START_REF] Adan | A skill based parallel service system under FCFS-ALIS -steady state, overloads, and abandonments[END_REF][START_REF] Ayesta | A token-based central queue with orderindependent service rates[END_REF][START_REF] Ayesta | On a unifying product form framework for redundancy models[END_REF][START_REF] Bonald | Balanced fair resource sharing in computer clusters[END_REF][START_REF] Comte | Dynamic load balancing with tokens[END_REF][START_REF] Comte | Resource management in computer clusters: algorithm design and performance analysis[END_REF][START_REF] Gardner | Product forms for FCFS queueing models with arbitrary server-job compatibilities: an overview[END_REF][START_REF] Gardner | Queueing with redundant requests: Exact analysis[END_REF]. Roughly speaking, this cluster model can be interpreted as a P&S queue where customers represent jobs and servers represent machines. To illustrate the diversity of protocols that can be modeled this way, we consider a machine cluster described by the graph of Figure 1, with two job classes and three machines. Machines 1 and 2 are dedicated to classes 1 and 2, respectively, while machine 3 is compatible with both classes. These compatibility constraints, which may for instance result from data locality in data centers, lead to different product-form queueing models depending on the load-distribution or scheduling protocol. We now mention two protocols that were studied in the literature and can be described using P&S queues.

With the first protocol, each incoming job is immediately added to the buffers of all its compatible machines, and each machine applies the first-come-first-served (FCFS) service discipline to the jobs in its buffer. A job may therefore be in service on its two compatible machines at the same time, in which case its departure rate is the sum of the service rates of these two machines. If the jobs of each class arrive according to an independent Poisson process and have independent and exponentially distributed service requirements, the corresponding queueing model is an OI queue (and therefore also a P&S queue). With the second protocol, each incoming job enters service on its compatible machine that has been idle the longest, if any, otherwise the job is kept waiting in a central queue until one of its compatible machines becomes idle. This protocol is called first-come-first-served and assign-to-the-longest-idle-server (FCFS-ALIS). With similar assumptions on the arrival process and job size distribution as before, it was shown in [START_REF] Adan | A skill based parallel service system under FCFS-ALIS -steady state, overloads, and abandonments[END_REF] that, although the corresponding queueing model is not an OI queue, we again obtain a product-form stationary distribution that is similar to that obtained under the first variant.

Although the two protocols that we have just described have already been analyzed, we will shed new light on these protocols by showing that they can be described using P&S queues. Even stronger, we will see that the framework of P&S queues allows for extensions in different directions that, as far as the authors are aware, have not been analyzed in the literature. For instance, going back to the toy example of Figure 1, it may happen that each incoming job is a priori compatible with all machines, but that it can only be assigned to two neighboring machines due to limited parallelism or other operational constraints. This observation leads us to introduce a new load-distribution protocol in which an incoming job is only assigned to some of its compatible machines and is subsequently processed in parallel on any subset of these machines. This extension falls within the framework of P&S queues and, in fact, it is the P&S mechanism that guided the design of this protocol.

In a similar vein, P&S queues can be used to model redundancy scheduling [START_REF] Gardner | Queueing with redundant requests: Exact analysis[END_REF][START_REF] Ayesta | On a unifying product form framework for redundancy models[END_REF][START_REF] Ayesta | A token-based central queue with orderindependent service rates[END_REF] in clusters of machines, where replicas of a job may be routed to (the buffers of) multiple machines, and redundant replicas are canceled whenever a replica completes service at a machine (cancel-on-completion) or enters service at a machine (cancel-on-start). One can verify that the dynamics of the cancel-on-completion protocol are tantamount to the first aforementioned protocol, and, as such, can be modeled by an OI queue (and thus also by a P&S queue). The cancel-on-start protocol is also covered by P&S queues, as its dynamics are tantamount to those of the second aforementioned protocol [START_REF] Ayesta | A token-based central queue with orderindependent service rates[END_REF]. Once again, in addition to covering these two existing protocols, P&S queues can also be used to model new redundancy scheduling protocols. As an example, we introduce the cancel-on-commit protocol which generalizes the cancel-on-start protocol. In this protocol, whenever a replica of a job becomes one of the s oldest replicas in the buffer of a machine s, this replica commits to machine s and all other replicas of the job are canceled. The cancel-on-start protocol corresponds to the special case where s = 1 for every machine.

Contributions Our contributions are as follows. We introduce P&S queues and establish that, although these queues are a non-trivial generalization of OI queues, the product form of the stationary distribution is preserved; this result is proved by careful inspection of the partial balance equations of the underlying Markov chain. This result paves the way for the performance analysis of several applications, such as those we described above, without resorting to scaling regimes. We also provide an easily verifiable necessary and sufficient stability condition for P&S queues that also holds for OI queues. In addition, we study networks of P&S queues. By establishing that P&S queues are quasi-reversible [START_REF] Kelly | Reversibility and stochastic networks[END_REF][START_REF] Muntz | Poisson departure processes and queueing networks[END_REF], we show that open networks of P&S queues exhibit a product-form stationary distribution under mild conditions on the routing process. We also study irreducibility properties of closed networks of P&S queues and demonstrate that, under particular assumptions, the stationary distribution of such closed networks also has a product form. These closed networks form a class of independent interest, since we show later that they can be used to model finite-capacity queues with token-based structures, akin to those of [START_REF] Ayesta | A token-based central queue with orderindependent service rates[END_REF] and [START_REF] Comte | Dynamic load balancing with tokens[END_REF][START_REF] Comte | Resource management in computer clusters: algorithm design and performance analysis[END_REF].

Structure of the paper The remainder of the paper is organized as follows. Section 2 recalls results on OI queues that were derived in [START_REF] Berezner | Quasi-reversible multiclass queues with order independent departure rates[END_REF][START_REF] Krzesinski | Order independent queues[END_REF]. The P&S queue is introduced in Section 3, where the product form of its stationary distribution is also established. After deriving complementary results on open (networks of) P&S queues in Section 4, we turn to the analysis of closed networks of P&S queues in Section 5. We demonstrate the applicability of these models to the modeling of resource-management protocols in Section 6. Section 7 concludes the paper.

Order-independent queues

This section gives an overview of OI queues, introduced in [START_REF] Berezner | Quasi-reversible multiclass queues with order independent departure rates[END_REF] and later studied in [START_REF] Krzesinski | Order independent queues[END_REF]. The results of this section were derived in these two seminal papers and act as a basis for extension in the remainder of the paper.

Definition

We consider a multi-class queue with a finite set I = {1, . . . , I} of customer classes. For each i ∈ I, class-i customers enter the queue according to an independent Poisson process with intensity λ i > 0. Customers are queued in their arrival order, with the oldest customer at the head of the queue, and are identified by their class. For now, we assume that the queue has an infinite capacity and that each customer leaves the queue immediately upon service completion.

State descriptors

We consider two state descriptors of this multi-class queue. The queue state represents the classes of customers in the queue in their arrival order. More specifically, we consider the sequence c = (c 1 , . . . , c n ), where n is the total number of customers in the queue and c p is the class of the p-th oldest customer, for each p ∈ {1, . . . , n}. In particular, c 1 is the class of the oldest customer, at the head of the queue. The empty state, with n = 0, is denoted by ∅. The corresponding state space is the Kleene closure I * of the set I, that is, the set of sequences of finite length made up of elements of I. To each state c ∈ I * , we associate a macrostate |c| = (|c| 1 , . . . , |c| I ) ∈ N I that only retains the number of present customers of each class, and does not keep track of their order in the queue. As a result, for each c ∈ I * and each i ∈ I, the integer |c| i gives the number of class-i customers in state c. For each x, y ∈ N I , we write x ≤ y if x i ≤ y i for each i ∈ I.

Service rates We now explain the way in which service is provided to customers in an OI queue. This is done in such a way that the evolution of the state of the queue over time exhibits a memoryless property (and thus represents a Markov process). The overall service rate in state c is denoted by µ(c), for each c ∈ I * . This function µ, defined on I * , is called the rate function of the queue. Along with the individual rates of service provided to the customers in the queue, it satisfies the following two conditions. First, the overall rate of service µ(c) provided when the queue is in state c depends only on the number of customers of each class that are present and not on their arrival order. In other words, for each c, d ∈ I * , we have µ(c) = µ(d) whenever |c| = |d|. For this reason, we shall also refer to µ(c) as µ(x) when x is the macrostate corresponding to state c. Second, the service rate of each customer is independent of (the number and classes of the) customers that are behind this customer in the queue. In particular, for each c = (c 1 , . . . , c n ) ∈ I * and p ∈ {1, . . . , n}, the service rate of the customer in position p in state c, of class c p , is equal to the increment of the overall service rate induced by the arrival of this customer, denoted by

∆µ(c 1 , . . . , c p ) = µ(c 1 , . . . , c p ) -µ(c 1 , . . . , c p-1 ),
where we use the convention that (c 1 , . . . , c p-1 ) = ∅ when p = 0. This implies in particular that the function µ is non-decreasing, in the sense that

µ(c 1 , . . . , c n , i) ≥ µ(c 1 , . . . , c n ), ∀c = (c 1 , . . . , c n ) ∈ I * , ∀i ∈ I.
The service rate of the first p customers in the queue, given by µ(c 1 , . . . , c p ) = p q=1 ∆µ(c 1 , . . . , c q ), depends neither on the classes of the customers in positions p + 1 to n nor even on the total number n of customers in the queue.

We set µ(∅) = 0 since the queue exhibits a zero departure rate when there are no customers in the queue. We additionally assume that µ(c) > 0 for each c = ∅. In other words, we assume that the oldest customer always receives a positive service rate, to ensure irreducibility of the Markov process describing the evolution of the state over time. Remark 1. The definition of OI queues that we presented above is slightly more restrictive than that of [START_REF] Berezner | Quasi-reversible multiclass queues with order independent departure rates[END_REF][START_REF] Krzesinski | Order independent queues[END_REF]. Indeed, in these two papers, the overall service rate function µ is scaled by a factor that depends on the total number of customers in the queue. We omit this scaling factor for simplicity of notation and assume it to equal one. However, unless stated otherwise, the results in the sequel of this paper can be straightforwardly generalized to account for this factor.

Examples As observed in [START_REF] Berezner | Quasi-reversible multiclass queues with order independent departure rates[END_REF][START_REF] Krzesinski | Order independent queues[END_REF], the framework of OI queues encompasses several classical queueing models, such as the FCFS and infinite-server queues of BCMP networks [START_REF] Baskett | Open, closed, and mixed networks of queues with different classes of customers[END_REF], as well as multiple queues with class-based compatibilities (see [START_REF] Boudec | A BCMP extension to multiserver stations with concurrent classes of customers[END_REF][START_REF] Krzesinski | Product form solutions for multiserver centers with hierarchical concurrency constraints[END_REF] for example). In this paper, we will be especially interested in the following multi-server queues, introduced in [START_REF] Gardner | Queueing with redundant requests: Exact analysis[END_REF] and identified as OI queues in [START_REF] Bonald | Balanced fair resource sharing in computer clusters[END_REF]. Example 1 (Multi-server queue). Consider an infinite-capacity queue with a set I = {1, . . . , I} of customer classes and a set S = {1, . . . , S} of servers. All customers have an exponentially-distributed size with unit mean and, for each i ∈ I, class-i customers enter the queue according to a Poisson process with rate λ i > 0 and can be processed by the servers of the set S i ⊆ S. This defines a bipartite compatibility graph between customer classes and servers, in which there is an edge between a class and a server if this server can process customers of this class. In the example of Figure 1, servers 1 and 2 are dedicated to classes 1 and 2, respectively, while server 3 is compatible with both classes. In this way, we have S 1 = {1, 3} and S 2 = {2, 3}.

Each server applies the FCFS discipline to the customers it can serve, so that each customer is in service on all the servers that can process this customer but not the customers that arrived earlier in the queue. For each s ∈ S, the service rate of server s is denoted by µ s > 0. When a class-i customer is in service on a subset T ⊆ S i of its compatible servers, its service rate is s∈T µ s . The overall service rate, equal to the sum of the service rates of the servers that can process at least one customer in the queue, is given by

µ(c 1 , . . . , c n ) = s∈ n p=1 Sc p µ s , ∀(c 1 , . . . , c n ) ∈ C. (1)
For each p ∈ {1, . . . , n}, the service rate of the customer in position p is given by ∆µ(c 1 , . . . , c p ) = µ(c 1 , . . . , c p ) -µ(c 1 , . . . , c p-1 ) =

s∈Sc p \ p-1 q=1 Sc q µ s . (2)
One can verify that this multi-server queue is an OI queue. In the example of Figure 2, the queue state is c = (1, 1, 2, 1, 2, 2, 1). The oldest customer, of class 1, is in service on servers 1 and 3, at rate ∆µ(1) = µ(1) -µ(∅) = (µ 1 + µ 3 ) -0 = µ 1 + µ 3 . The second oldest customer, of class 1, is not in service on any server, and indeed we have ∆µ(1, 1) = µ(1, 1) -µ(1) = 0. The third oldest customer, of class 2, is in service on server 2, at rate ∆µ

(1, 1, 2) = µ(1, 1, 2) -µ(1, 1) = (µ 1 + µ 2 + µ 3 ) -(µ 1 + µ 3 ) = µ 2 .
The other customers have a zero service rate.

1 2 2 1 2 1 1 µ 1 µ 3 µ 2 c = (1, 1, 2, 1, 2, 2, 1) λ 1 λ 2
Figure 2: A queue state. The color of a server is a visual aid that indicates the class of the customer currently in service on this server.

Stationary analysis

The evolution of the queue state leads to a Markov process with state space I * , and this Markov process is irreducible. Indeed, for any two states c = (c 1 , . . . , c n ) ∈ I * and d = (d 1 , . . . , d m ) ∈ I * , the Markov process can first jump from state c to state ∅ as a result of n transitions corresponding to departures of the customer at the head of the queue, and then from state ∅ to state d as a result of m transitions corresponding to customer arrivals.

Theorem 1 below recalls that this Markov process has a product-form stationary distribution and that the OI queue satisfies the quasi-reversibility property (cf. [START_REF] Kelly | Reversibility and stochastic networks[END_REF]Section 3.2]). This property implies that, when the Markov process associated with the queue state is stationary, the departure instants of the customers of each class form independent and stationary Poisson processes and that, at every instant, the current queue state is independent of the departure instants of customers prior to that instant. Quasi-reversibility also implies that an open network of OI queues connected by a Markovian routing policy has a product-form stationary distribution [START_REF] Kelly | Reversibility and stochastic networks[END_REF]Theorem 3.7] under mild conditions on the routing process (namely, each customer can become part of any given class with a positive probability and eventually leaves the network with probability one). A similar result holds for closed networks of OI queues under some irreducibility assumptions [START_REF] Kelly | Reversibility and stochastic networks[END_REF]Section 3.4]. The interested reader is referred to [17, Sections 3.2 and 3.4] and [START_REF] Serfozo | Introduction to stochastic networks[END_REF]Chapter 8] for a more complete account on quasi-reversibility. The proof below can be found in [START_REF] Berezner | Quasi-reversible multiclass queues with order independent departure rates[END_REF][START_REF] Krzesinski | Order independent queues[END_REF] but we present it here for ease of later reference when we introduce the P&S queue.

Theorem 1. Consider an OI queue with a set I = {1, . . . , I} of customer classes, per-class arrival rates λ 1 , . . . , λ I , and a rate function µ. A stationary measure of the Markov process associated with the state of this OI queue is of the form

π(c 1 , . . . , c n ) = π(∅) n p=1 λ cp µ(c 1 , . . . , c p ) = π(∅)Φ(c) i∈I λ i |c|i , ∀(c 1 , . . . , c n ) ∈ I * , (3)
where Φ is the balance function of the OI queue, defined on I * by

Φ(c 1 , . . . , c n ) = n p=1 1 µ(c 1 , . . . , c p ) , ∀(c 1 , . . . , c n ) ∈ I * , (4)
and π(∅) is an arbitrary positive constant. The queue is stable if and only if

c∈I * Φ(c) i∈I λ i |c|i < +∞, ( 5
)
in which case the queue is quasi-reversible and the stationary distribution of the Markov process associated with its state is given by (3) with

π(∅) = c∈I * Φ(c) i∈I λ i |c|i -1 . (6)
Proof. We will first verify that any measure π of the form (3) satisfies the following partial balance equations in each state c = (c 1 , . . . , c n ) ∈ I * :

Equalize the flow out of state c due to a departure with the flow into state c due to an arrival (if c = ∅):

π(c)µ(c) = π(c 1 , . . . , c n-1 )λ cn . (7)
Equalize, for each i ∈ I, the flow out of state c due to the arrival of a class-i customer with the flow into state c due to the departure of a customer of this class:

π(c)λ i = n+1 p=1 π(c 1 , . . . , c p-1 , i, c p , . . . , c n ) ∆µ(c 1 , . . . , c p-1 , i). (8)
This verification will readily imply that the stationary measures of the Markov process associated with the queue state are of the form (3) and that the queue, when stable, is quasi-reversible. Indeed, the global balance equations of the Markov process associated with the queue state follow from the partial balance equations ( 7) and ( 8) by summation. Moreover, to prove that the queue is quasi-reversible, it suffices to verify that the stationary measures of the Markov process associated with the queue state satisfy the partial balance equations [START_REF] Berezner | Order independent loss queues[END_REF]. This is a consequence of [START_REF] Kelly | Reversibility and stochastic networks[END_REF]Equations (3.8) to (3.11)] and of the fact that the customers of each class enter the queue according to an independent and stationary Poisson process. We now verify that the measures of the form (3) satisfy the partial balance equations ( 7) and [START_REF] Berezner | Order independent loss queues[END_REF]. Equation [START_REF] Berezner | Quasi-reversible multiclass queues with order independent departure rates[END_REF] follows immediately from (3) and ( 4). The case of ( 8) is more intricate. First observe that the measures π of the form (3) satisfy [START_REF] Berezner | Order independent loss queues[END_REF] if and only if the balance function Φ given by (4) satisfies the following equation in each state c = (c 1 , . . . , c n ) ∈ I * :

Φ(c) = n+1 p=1 Φ(c 1 , . . . , c p-1 , i, c p , . . . , c n ) ∆µ(c 1 , . . . , c p-1 , i), ∀i ∈ I. (9)
We show that Φ satisfies this equation by induction over the queue length n. For the base step, with n = 0, it suffices to observe that, for each i ∈ I, the right-hand side of (9) simplifies to Φ(i)µ(i), which is equal to Φ(∅) by ( 4). Now let n ≥ 1 and assume that ( 9) is satisfied for each state c of length n -1. Consider a state c of length n and let i ∈ I. The first n terms in the sum on the right-hand side of ( 9) can be rewritten as follows:

n p=1 Φ(c 1 , . . . , c p-1 , i, c p , . . . , c n ) ∆µ(c 1 , . . . , c p-1 , i) = 1 µ(c 1 , . . . , c n , i) n p=1 Φ(c 1 , . . . , c p-1 , i, c p , . . . , c n-1 ) ∆µ(c 1 , . . . , c p-1 , i), = 1 µ(c 1 , . . . , c n , i) Φ(c 1 , . . . , c n-1 ), = Φ(c 1 , . . . , c n ) µ(c 1 , . . . , c n ) µ(c 1 , . . . , c n , i) , (10)
where the first and last equalities follow from (4) and the order independence of µ, while the second equality is obtained by applying the induction assumption to state (c 1 , . . . , c n-1 ) and class i. By (4), we also have that

Φ(c 1 , . . . , c n , i) ∆µ(c 1 , . . . , c n , i) = Φ(c 1 , . . . , c n ) µ(c 1 , . . . , c n , i) -µ(c 1 , . . . , c n ) µ(c 1 , . . . , c n , i) , (11)
so that summing [START_REF] Boucherie | Queueing networks: A fundamental approach[END_REF] and ( 11) yields [START_REF] Bonald | Balanced fair resource sharing in computer clusters[END_REF]. This concludes the proof by induction. The stability condition ( 5) is equivalent to the statement that c∈I * π(c)/π(∅) is finite for any stationary measure π, which is indeed necessary and sufficient for ergodicity. Equation [START_REF] Baskett | Open, closed, and mixed networks of queues with different classes of customers[END_REF] guarantees that the stationary distribution sums to unity.

Pass-and-swap queues

This section contains our first main contribution. Pass-and-swap (P&S) queues, obtained by supplementing OI queues with an additional mechanism when customers complete service, are defined in Section 3.1. In contrast to signals and negative customers considered for quasi-reversible queues [START_REF] Chao | Networks with customers, signals, and product form solution[END_REF], the P&S mechanism occurs upon a service completion and can move several customers at the same time within the queue. Section 3.2 shows that both the product-form nature of the stationary measure of the Markov process associated with the state and the quasi-reversibility property of the queue are preserved by this mechanism.

Definition

As before, the set of customer classes is denoted by I = {1, . . . , I} and we adhere to the state descriptors: the state c = (c 1 , . . . , c n ) ∈ I * gives the classes of customers as they are ordered in the queue and the macrostate |c| = (|c| 1 , . . . , |c| I ) ∈ N I gives the numbers of customers of each class. Likewise, the customer arrival processes and completion times are as defined in Section 2.1. We however part with the assumption that a customer that completes service leaves the queue directly and that all customers behind move forward one position. With the mechanism that we will now define, each service completion will potentially trigger a chain reaction within the queue. More precisely, a customer that completes service may take another customer's position further down the queue and require a new round of service in this position. The customer ejected from this position may in turn take the position of another customer further down the queue, and so on. The decision of which customer replaces which other customer is driven by the pass-and-swap mechanism described below.

Pass-and-swap mechanism We supplement the OI queue with an undirected graph that will be called the swapping graph of the queue. The vertices of this graph represent the customer classes. For each i, j ∈ I, when there is an edge between classes i and j in the graph, a class-i customer can take the position of a class-j customer upon service completion. In that case, we say that (the customers of) classes i and j are mutually swappable. Observe that the graph is undirected, meaning that the swapping relation is symmetric: if class i can be swapped with class j, then class j can also be swapped with class i. Also observe that the graph may contain a loop, that is, an edge that connects a node to itself, in which case two customers of the corresponding class can also be swapped with one another. For each i ∈ I, we let I i ⊆ I denote the set of neighbors of class i in the graph, that is, the set of classes that are swappable with class i.

Based on this graph, the pass-and-swap mechanism is defined as follows. A customer whose service is complete scans the rest of the queue, passes over subsequent customers that it cannot swap positions with, and replaces the first swappable customer, if any. This ejected customer, in turn, scans the rest of the queue and replaces the first swappable customer afterwards. This is repeated until an ejected customer finds no customers in the remainder of the queue it can swap with. In this case, the customer leaves the queue.

More formally, let c = (c 1 , . . . , c n ) ∈ I * denote a queue state. Assume that the service of the customer in some position p 1 ∈ {1, . . . , n} completes and let i 1 = c p1 denote the class of this customer. If there is at least one position q ∈ {p 1 + 1, . . . , n} such that c q ∈ I i1 , we let p 2 denote the smallest of these positions and i 2 = c p2 the class of the corresponding customer. The class-i 1 customer that was originally in position p 1 replaces the class-i 2 customer in position p 2 , and this class-i 2 customer is ejected. If there is at least one position q ∈ {p 2 + 1, . . . , n} such that c q ∈ I i2 , we let p 3 denote the smallest of these positions and i 3 = c p3 the class of the corresponding customer. The class-i 2 customer that was originally in position p 2 replaces the class-i 3 customer in position p 3 , and this class-i 3 customer is ejected. Going on like this, we define recursively p v+1 = min{q ≥ p v + 1 : c q ∈ I cp v } for each v ∈ {1, . . . , u -1}, where p u ∈ {p, . . . , n} is the position of the first ejected customer that can no longer replace another subsequent customer in the queue, that is, for which there is no q ∈ {p u + 1, . . . , n} such that c q ∈ I cp u . This customer is the one that leaves the queue. The integer u ∈ {1, . . . , n -p + 1} gives the total number of customers that are involved in the transition, and the state reached after this transition is

(c 1 , . . . , c p1-1 , c p1+1 , . . . , c p2-1 , i 1 , c p2+1 , . . . , c p3-1 , i 2 , c p3+1 , . . . , c pu-1 , i u-1 , c pu+1 , . . . , c n ).
Observe that the transition is recorded as a departure of a class-i u customer and not as a departure of a class-i 1 customer in general. In the special case where u = 1, the customer that completes service cannot replace any subsequent customer, so that this customer leaves the queue. An OI queue supplemented with the pass-and-swap mechanism is called a pass-and-swap (P&S) queue. The stochastic process keeping track of the state over time in the P&S queue has the Markov property, just like the OI queue. For both the OI and the P&S queue, however, the stochastic process that describes the macrostate over time does not yield any such Markov property in general. Example 2 (Multi-server queue). We give a toy example that illustrates the P&S mechanism. More concrete applications will be described in Section 6. Consider a multi-server queue with the compatibility graph shown in Figure 3a and the swapping graph shown in Figure 3b. Customers of classes 1 and 2 can be processed only by servers 1 and 2, respectively, while class-3 customers can be processed by both servers. Class-2 customers can be swapped with customers of classes 1 and 3 but customers of classes 1 and 3 cannot be swapped with one another. Assume that the queue is in the state c = (1, 3, 3, 2, 2, 3, 1, 2) depicted in Figure 3c, and that the customer in first position, of class 1, completes service. The corresponding chain reaction is depicted on the same figure by arrows. Class 1 can only be swapped with class 2 and the first subsequent class-2 customer is in the fourth position. Therefore, the class-1 customer that completes service is passed along the queue up until the fourth position and is swapped with the class-2 customer at this position. The ejected customer is of class 2, and class 2 can be swapped with classes 1 and 3. Therefore, the ejected customer is passed along the queue up until the sixth position and is swapped with the class-3 customer at this position. We repeat this with the ejected class-3 customer, which replaces the last class-2 customer, which leaves the queue. The transition is labeled as a departure of a class-2 customer and the new queue state is d = (3, 3, 1, 2, 2, 1, 3). Example 3 (Single-server last-come-first-served queue). The following example shows that the P&S mechanism can also be used to emulate a single-server queue with the last-come-first-served preemptive-resume policy. Consider a P&S queue with a set I = {1, . . . , I} of customer classes. Assume that the service rate is a positive constant µ, independent of the numbers of customers of each class in the queue (provided that the queue is not empty), so that only the customer at the head of the queue has a positive service rate. If the swapping graph is empty, then the customer at the head of the queue leaves immediately upon service completion, and the queue behaves like a multi-class single-server queue with the first-come-first-served policy.

On the contrary, if the swapping graph is complete (with in particular loops at all nodes), then the service completion of the customer at the head of the queue triggers a cascading effect whereby every customer swaps position with its successor in the queue, so that the customer that leaves is the one at the tail of the queue. Therefore, the queue behaves like a multi-class single-server queue with the last-come-first-served preemptive-resume policy. Note that, unfortunately, this example only works because the service time of each customer is exponentially distributed with a mean that is independent of its class; in particular, this example does not explain the insensitivity of the last-come-first-served preemptive-resume policy to the distribution of the service times.

Additional comments

The P&S mechanism is applied instantaneously upon a service completion. Replacements are performed from the front to the back of the queue, so that, when a customer is ejected from some position p ∈ {1, . . . , n}, this customer never replaces a customer at a position q ∈ {1, . . . , p -1}, even if c q ∈ I cp . Also note that customer classes now have a dual role: they determine not only the service rate received by each customer through the rate function µ, but also the chain reaction that happens upon each service completion through the swapping graph. One could also associate two classes with each customer, one that determines its service rate and another that determines its swapping relations. Finally, the original OI queue, in which the customer that completes service is the one that leaves the queue, is obtained by applying the P&S mechanism based on a swapping graph without edges. Therefore, an OI queue is also a P&S queue, so that the results that we will derive for P&S queues in the sequel also apply to OI queues.

The following notation will be useful. We write δ p (c) = (d, i) if the service completion of the customer in position p in state c leads to state d and triggers the departure of a class-i customer, for each n ≥ 1, c = (c 1 , . . . , c n ) ∈ I * , d = (d 1 , . . . , d n-1 ) ∈ I * , p ∈ {1, . . . , n}, and i ∈ I. In Example 2 for instance, we have δ 1 (c) = ((3, 3, 1, 2, 2, 1, 3), 2). With a slight abuse of notation, we also write δ p (c) = i if we only want to specify that the departing customer is of class i.

Stationary analysis

The Markov process associated with the queue state on the state space I * is irreducible. Indeed, given any states c = (c 1 , . . . , c n ) ∈ I * and d = (d 1 , . . . , d m ) ∈ I * , the Markov process can again jump from state c to state ∅ thanks to n transitions corresponding to departures (for instance, triggered by the service completion of the customer at the head of the queue), and then from state ∅ to state d thanks to m transitions corresponding to arrivals.

Theorem 2 below shows that introducing the P&S mechanism does actually not change the stationary distribution of this Markov process compared to the original OI queue. In particular, this stationary distribution is independent of the swapping graph. Intuitively, this can be thought of as a consequence of the symmetric property of the swapping relation. Another implication of Theorem 2 is that the consequences of the quasi-reversibility property stated in Section 2.2 for OI queues also apply to P&S queues. As a result, an open network of P&S queues connected by a random routing process has a product-form stationary distribution. The only peculiarity is that, when a customer completes service in a P&S queue, this customer is not necessarily the one that leaves this queue. The case of closed networks is more complicated and will be considered in Section 5. The sketch of the proof given below is completed in Appendix A.

Theorem 2. The results of Theorem 1 remain valid if we replace "OI queue" with "P&S queue". Sketch of proof. The proof resembles that of Theorem 1, except that the second set of partial balance equations (8) has a different form. More specifically, we will verify that any measure π of the form (3) satisfies the following partial balance equations in each state c = (c 1 , . . . , c n ) ∈ I * : Equalize the flow out of state c due to a departure with the flow into state c due to an arrival (if c = ∅):

π(c)µ(c) = π(c 1 , . . . , c n-1 )λ cn . (12)
Equalize, for each i ∈ I, the flow out of state c due to the arrival of a class-i customer with the flow into state c due to the departure of a customer of this class:

π(c)λ i = d∈I * n+1 p=1 δp(d)=(c,i) π(d) ∆µ(d 1 , . . . , d p ). (13)
Since [START_REF] Comte | Dynamic load balancing with tokens[END_REF] represents the same set of equations as [START_REF] Berezner | Quasi-reversible multiclass queues with order independent departure rates[END_REF], it is already known that (3) satisfies [START_REF] Comte | Dynamic load balancing with tokens[END_REF]. Showing that (3) satisfies ( 13) is equivalent to showing that the balance function Φ in (4) satisfies the following equation

in each state c = (c 1 , . . . , c n ) ∈ I * : Φ(c) = d∈I * n+1 p=1 δp(d)=(c,i) Φ(d) ∆µ(d 1 , . . . , d p ), ∀i ∈ I. ( 14
)
This is shown by induction over the queue length n in Appendix A. The rest of the proof follows along the same lines as Theorem 1.

Remark 2. In this section, we have seen that the introduction of the P&S mechanism to the OI queue induces a different set of partial balance equations, while product-form properties are retained. Even stronger, Theorem 2 shows that replacing ( 8) with ( 13) does not alter the stationary distribution of the queue at all. This begs the question of whether there exist other intra-queue routing mechanisms that also lead to this product-form stationary distribution. A partial answer can be found in the actual proof of Theorem 2, given in Appendix A. A careful analysis of this proof suggests that other routing mechanisms, resulting in a different completion order q 1 , q 2 , . . . , q u as defined in Appendix A, could also lead to the stationary measure given in Theorem 1, as long as this completion order adheres to an equation of the same form as (30).

However, identifying such routing mechanisms does not seem straightforward.

Complementary results on pass-and-swap queues

We now use Theorem 2 to derive further results on the stationary behavior of P&S queues. Section 4.1 gives an alternative stability condition that is simpler to verify than [START_REF] Ayesta | On a unifying product form framework for redundancy models[END_REF]. The result of this section extends that obtained for OI queues in the Ph.D. thesis [START_REF] Comte | Resource management in computer clusters: algorithm design and performance analysis[END_REF] and before that for multi-server queues in [START_REF] Bonald | Balanced fair resource sharing in computer clusters[END_REF]. In Section 4.2, we use the quasi-reversibility property to prove that the average service and departures rates of each class are equal to each other and independent of the swapping graph. Recall that, since an OI queue is also a P&S queue, the results of this section readily apply to OI queues.

Stability condition

Theorem 3 below gives a necessary and sufficient condition for the stability of P&S queues. This condition is simpler than (5) as it only compares the per-class arrival rates λ 1 , . . . , λ I to the rate function µ. A first version of this theorem was stated in the Ph.D. thesis [START_REF] Comte | Resource management in computer clusters: algorithm design and performance analysis[END_REF]Theorem 3.4] for OI queues. The proof that we give in Appendix B is different in that it does not involve Whittle networks [START_REF] Serfozo | Introduction to stochastic networks[END_REF].

To state the stability condition, it is worth recalling that, for each c ∈ I * , the macrostate associated with state c is the vector |c| = (|c| 1 , . . . , |c| I ) ∈ N I that counts the number of customers of each class present in the queue. Also recall that the service rate µ(c) depends on the number of customers of each class that are contained in state c but not on their order. This means that, once the macrostate corresponding to a state is given, the service rate function is not sensitive to the state itself anymore. Therefore, in the sequel, we also refer to µ(c) as µ(|c|) for simplicity of notation.

For each i ∈ I, we let e i denote the I-dimensional vector with one in component i and zero elsewhere. We define the function μ on the power set of I by

μ(A) = lim m→+∞ µ(me A ), ∀A ⊆ I, (15)
where e A = i∈A e i for each A ⊆ I. The monotonicity of µ ensures that μ is well defined, with values in R + ∪ {+∞}, and is itself a non-decreasing set function. If the overall service rate only depends on the set of active classes, as is the case in the multi-server queue of Examples 1 and 2, we have μ(A) = µ(x) for each x ∈ N I such that A = {i ∈ I : x i > 0}, but in general, we may have μ(A) > µ(x) for each such x.

Theorem 3. Consider a P&S queue with a set I = {1, . . . , I} of customer classes, per-class arrival rates λ 1 , . . . , λ I , and a rate function µ. This P&S queue is stable if and only if

i∈A λ i < μ(A), ∀A ⊆ I : A = ∅. ( 16
) Proof. See Appendix B.
This result is the only one in this paper that cannot be straightforwardly extended to P&S queues with an arbitrary scaling factor as considered in [START_REF] Berezner | Quasi-reversible multiclass queues with order independent departure rates[END_REF][START_REF] Krzesinski | Order independent queues[END_REF]. However, it can be extended to P&S queues with a non-decreasing scaling factor by including this scaling rate into the definition of μ.

Departure and service rates

We now consider the relation between the service rates and departure rates of customers in the P&S queue. Consider a stable P&S queue, as defined in Section 3.1, and let π denote the stationary distribution of the Markov process tracking the state over time. For each c = (c 1 , . . . , c n ) ∈ I * and i ∈ I, we also define the overall departure rate of class i in state c to be

φ d i (c) = n p=1 δp(c)=i ∆µ(c 1 , . . . , c p ), (17)
while the overall service rate of class i in this state is defined as

φ s i (c) = n p=1 cp=i ∆µ(c 1 , . . . , c p ). ( 18
)
While it is not necessarily true that φ d i (c) = φ s i (c), the next proposition states that, for each x ∈ N I and i ∈ I, the overall probability flow out of macrostate x due to a departure of a class-i customer is equal to the overall probability flow out of macrostate x due to a service completion of a class-i customer.

Proposition 1. For each x ∈ N I and i ∈ I, we have

c∈I * :|c|=x π(c)φ d i (c) = c∈I * :|c|=x π(c)φ s i (c). ( 19
)
Proof. If x i = 0, the result is immediate since φ d i (c) = φ s i (c) = 0 for any state c for which |c| = x. For the case x i > 0, note that the stationary distribution of the P&S queue satisfies the partial balance equations ( 8) by Theorems 1 and 2 and ( 13) by Theorem 2. Therefore, the right-hand sides of ( 8) and ( 13) are equal. Equating these two sides and summing over all states c = (c 1 , . . . , c n ) for which |c| = x -e i , we obtain

c∈I * : |c|=x-ei d∈I * : |d|=x n+1 p=1 δp(d)=(c,i) π(d) ∆µ(d 1 , . . . , d p ) = c∈I * : |c|=x-ei n+1 p=1 π(c 1 , . . . , c p-1 , i, c p , . . . , c n )∆µ(c 1 , . . . , c p-1 , i).

Rewriting both sides leads to

c∈I * :|c|=x n p=1 δp(c)=i π(c) ∆µ(c 1 , . . . , c p ) = c∈I * :|c|=x n p=1 cp=i π(c 1 , . . . , c n )∆µ(c 1 , . . . , c p ).
Combining this equation with ( 17) and ( 18) finalizes the proof.

Since the overall probability flow out of macrostate x due to a service completion of a class-i customer does not depend on the swapping graph, this equality implies that, for each x ∈ N I and i ∈ I, the overall probability flow out of macrostate x due to a departure of a class-i customer does not depend on the swapping graph. Upon dividing [START_REF] Krzesinski | Order independent queues[END_REF] by c∈I * :|c|=x π(c), we also obtain that the conditional expected departure and service rates of a class given the macrostate are equal to each other. Finally, summing both sides of ( 19) over all i ∈ I shows that the aggregate departure rate of customers in any macrostate x equals the aggregate service rate of customers in x. This can alternatively be seen to hold true by noting that a service completion in a macrostate x also induces a departure from macrostate x, and departures from the system only occur because of service completions. Remark 3. The result of Proposition 1 is intuitively not very surprising. If, in a state c = (c 1 , . . . , c n ), the completion of customer c p will trigger a departure of customer c q , then, in state d = (c n , . . . , c 1 ), the completion of customer c q will trigger a departure of customer c p , as the swapping graph is undirected. Moreover, both states lead to the same macrostate x. The fact that π(c) = π(d) is offset by the nature of the order-independent service rates, as formalized in the proof of Proposition 1.

Closed models

We saw that P&S queues are quasi-reversible, so that stable open networks of P&S queues have a productform stationary distribution under mild conditions on the routing process. In this section, we consider closed networks of P&S queues in more detail and conclude that, also for closed networks, the stationary distribution has a product form. In contrast to open networks, this does not follow directly from quasi-reversibility since, in general, the obtained Markov process does not meet the irreducibility assumptions posed in [START_REF] Kelly | Reversibility and stochastic networks[END_REF]Section 3.4]. In Section 5.1, we first consider a closed P&S queue in which the number of customers of each class is fixed and departing customers are appended back to the end of the queue instead of leaving. These results are extended to a closed tandem network of two P&S queues in Section 5.2. This tandem network turns out to have rich applications, as we will see in Section 6.

A closed pass-and-swap queue

We first consider a closed network that consists of a single P&S queue. In Section 5.1.1, we give an example of such a closed P&S queue to illustrate its dynamics. Section 5.1.2 then gives a more formal description of this model, including necessary notation. This section also studies the structure of the Markov process underlying this closed P&S queue and establishes sufficient conditions for this Markov process to be irreducible. Provided that the Markov process is indeed irreducible, Section 5.1.3 provides the stationary distribution of the closed P&S queue and establishes its product-form nature.

Introductory example

Consider a closed P&S queue with six customer classes (I = {1, 2, . . . , 6}) and the swapping graph shown in Figure 4a. When a class-i customer departs the queue, this customer does not leave the system. Instead, it is appended back to the queue as a class-i customer. For simplicity, we assume that there is a single customer of each class in the queue. More precisely, we assume that the queue starts in state c = (1, 2, 3, 4, 5, 6), as depicted in Figure 4b. A possible sequence of transitions is shown in Figures 4c and4d. Each transition is triggered by the service completion of the customer that is currently at the head of the queue. In particular, in the transition from Figure 4b to Figure 4c, customer 1 completes service, and this customer replaces customer 3, which replaces customer 6 in accordance with the swapping graph in Figure 4a. In the transition from Figure 4c to Figure 4d, customer 2 completes service, and this customer replaces customer 4, which replaces customer 6. In both cases, customer 6 is appended back to the end of the queue, in the last position, so that this customer's position remains unchanged by the transition. It is worth noting that, in the three states shown in Figure 4, customer 1 precedes customers 3 and 4, which precede customer 6. This order will be conserved by the P&S mechanism, as the service completion of customer 1 systematically triggers the movement of either customer 3 or customer 4, that in turn will replace customer 6. Similarly, customer 2 will always precede customers 4 and 5 that, in their turn, will always precede customer 6. In the sequel, we will formalize this phenomenon and characterize the communicating classes of the Markov process associated with the state of a closed P&S queue.

Queueing model

The closed P&S queue inherits virtually all properties and notation from Section 3.1. As mentioned before, the only difference is that, upon a service completion, the customer that would have left if the queue were open is, instead, appended back to the end of the queue as a customer of the same class. There is also no external arrival process, so that the macrostate of the queue is determined by its initial state and does not change over time. We therefore let I = {1, . . . , I} denote the set of classes of the customers in the initial state of the queue. The (fixed) macrostate of the queue is denoted by = ( 1 , . . . , I ) ∈ N I and the total number of customers by n = 1 + . . . + I . Note that i > 0 for each i ∈ I, as we only consider classes of customers present in the queue.

In Section 5.1.1, we found that it was possible for an ordering of customers to be preserved by the P&S mechanism. To help formalize this phenomenon, we introduce the notion of a placement order. We first define a placement graph of the queue as an acyclic orientation of its swapping graph, that is, a directed acyclic graph obtained by assigning an orientation to each edge of the swapping graph. This is only possible if the swapping graph contains no loop, which we assume in the remainder of Sections 5 and 6. A placement order of the queue is then defined as (the strict partial order associated with) the reachability relationship of one of its placement graphs. In other words, a strict partial order ≺ on I is said to be a placement order if there exists a placement graph such that, for each i, j ∈ I with i = j, i ≺ j if and only if there is a directed path from class i to class j in the placement graph. It will be useful later to observe that, for each classes i, j ∈ I that are neighbors in the swapping graph, we have either i ≺ j or j ≺ i.

We say that a state c = (c 1 , . . . , c n ) ∈ I n adheres to the placement order if c q ⊀ c p for each p, q ∈ {1, . . . , n} such that p < q. Since the placement order is only partial, there may be pairs of classes for which neither c p ≺ c q nor c q ≺ c p hold. Adherence is therefore a weaker property than having c p ≺ c q for each p, q ∈ {1, . . . , n} such that p < q. As a special case, adherence allows that c p = c q when p < q. Example 4. We consider the closed P&S queue of Section 5.1.1. The placement graph in Figure 5 is obtained by orienting the edges of the swapping graph of Figure 4a from bottom to top. All states in Figure 4 adhere to the corresponding placement order. For example, the placement graph implies that 1 ≺ j for j ∈ {3, 4, 6} and 2 ≺ j for j ∈ {4, 5, 6}, which in turn implies that the customer at the front of the queue is either customer 1 or customer 2. All states in Figure 4 indeed satisfy this property. Customers 1 and 2 can alternate positions, as neither 1 ≺ 2 nor 1 2. In general, not all possible states of a closed P&S queue adhere to a placement order. In Example 4, if the initial queue state is (3, 1, 2, 3, 4, 5, 6), a class-1 customer is both preceded and succeeded by a class-3 customer, making it impossible to orient the edge between classes 1 and 3 in the swapping graph. Furthermore, each state can only adhere to at most one placement order, so that the sets of states that adhere to different placement orders are disjoint. To prove this, it suffices to observe that, for each state that adheres to a placement order, the relative placement of customers within the state specifies the orientation of all edges of the swapping graph, which in turn uniquely defines a placement order.

In the rest of this section and in Section 5.1.3, we focus on the case where the initial state of the queue does adhere to a placement order. Proposition 2 describes the phenomenon encountered in Section 5.1.1 in full generality, while Proposition 3 provides a stronger result, assuming that all customers receive a positive service rate. The proofs of these two propositions are given in Appendix C. The case of states that do not adhere to a placement order is treated in Appendix D.

Proposition 2. If the initial state of the closed P&S queue adheres to the placement order ≺, then any state reached by applying the P&S mechanism also adheres to this placement order. Proposition 3. Assume that ∆µ(c) > 0 for each c ∈ I * . All states that adhere to the same placement order and correspond to the same macrostate form a single closed communicating class of the Markov process associated with the queue state.

Remark 4. The assumption in Proposition 3, namely that ∆µ(c) > 0 for each c ∈ I * , is a sufficient condition for this result to hold but it is not a necessary condition. It is for example worth noting that this assumption is not satisfied by the multi-server queue of Example 1, yet the closed variant of this queue satisfies the conclusions of these two propositions whenever µ 1 , µ 2 , and µ 3 are positive. In general, the construction of weaker sufficient conditions appears to be challenging since the transition described in step 3 of the algorithm in the proof of Proposition 3 is not guaranteed to occur with a positive probability when there are states c so that ∆µ(c) = 0.

Stationary analysis

We now turn to the stationary distribution of the Markov process underlying the closed P&S queue and establish its product-form nature. Recall that the initial macrostate of the queue equals , which cannot change over time due to the closed nature of the queue. We assume that the initial state adheres to a placement order ≺. Since all subsequent states must also adhere to this placement order due to Proposition 2, we restrict the state space of the Markov process to the state space C that consists of all states c = (c 1 , . . . , c n ) that satisfy |c| = and adhere to the placement order ≺. The rate function µ and balance function Φ of the queue are assumed to be defined on the whole set I * for simplicity, although we could just as well define them on a subset of I * . Theorem 4 below provides the stationary distribution of the closed P&S queue and reveals its product form nature. Theorem 4. Assume that the Markov process associated with the state of the closed P&S queue, with state space C, is irreducible. The stationary distribution of this Markov process is then given by

π(c) = Φ(c) d∈C Φ(d) , ∀c ∈ C, (20)
where the function Φ is given by (4).

By applying [START_REF] Gardner | Product forms for FCFS queueing models with arbitrary server-job compatibilities: an overview[END_REF] to state (c 1 , . . . , c n-1 ) and class i, we obtain that Φ(c 1 , . . . , c n-1 ), as defined in (4), is equal to the right-hand side of [START_REF] Moyal | A product form for the general stochastic matching model[END_REF]. To conclude, it suffices to observe that (4) implies Φ(c)µ(c) = Φ(c 1 , . . . , c n-1 ).

Remark 5. According to Proposition 3, a sufficient condition for the Markov process considered in Theorem 4 to be irreducible is that ∆µ(c) > 0 for each c ∈ I * . If this process is not irreducible, all steps of the proof of Theorem 4 remain valid, so that the distribution defined by ( 20) is still a stationary distribution of the Markov process, but it may not be the only one. Since Φ(c) > 0 for each c ∈ I * by ( 4), this observation shows that the Markov process considered in Theorem 4 always has a positive stationary distribution, which implies that this process has no transient state, that is, all its communicating classes are closed.

Remark 6. A variant of Theorem 4 can also be derived for closed P&S queues with initial states that do not adhere to a placement order. We have deferred derivation of this more general result to Appendix D to simplify the discussion. Theorem 4 will be sufficient for the applications of Section 6.

A closed tandem network of two pass-and-swap queues

Now that the product-form of the stationary distribution of a single closed P&S queue has been established, we turn to the study of a closed tandem of two P&S queues. Again, we first explain the model through an introductory example in Section 5.2.1, after which we formalize the model and describe structural properties in Section 5.2.2. We also derive the stationary distribution in Section 5.2.3.

Introductory example

We consider the closed tandem network of two P&S queues depicted in Figure 6. Both queues have the same set of customer classes and the same swapping graph as the closed queue of Section 5.1. Furthermore, only the customer at the head of each queue, if any, receives a positive service rate. We also assume that there is a single customer of each class in the network. The routing process is as follows: for each i ∈ I, if a class-i customer departs from a queue, this customer is routed to the back of the other queue as a class-i customer.

As shown in Figure 6a, the initial state of the first queue is c = (1, 2, 3, 4, 5, 6) and that of the second queue is d = ∅. Figure 6b shows the state reached after customer 1 (that is, the only customer belonging to class 1) completes service. As in the introductory example of Section 5.1, this customer replaces customer 3, and 4, the rate function is not specified because we will only consider the service completion of the customer at the head of a queue. customer 3 replaces customer 6. The difference is that customer 6 is now routed to the second queue rather than to the first. Figure 6c shows the state reached after several service completions, each time that of the customer at the head of the first queue.

As in Section 5.1.1, the order of customers seems to be preserved by the P&S mechanism. However, the orders of customers in the two queues are reversed. For instance, while customer 6 comes after customers 3 and 4 in the first queue (as in Section 5.1.1), in the second queue customer 6 always precedes these customers. We will show that this symmetry in customer orders holds for any closed tandem network of two P&S queues.

Before we move on to the analysis, let us motivate this model by giving a glimpse of the applications of Section 6. This section is concerned with token-based load-distribution protocols for server systems with assignment constraints, in which each job seizes a token upon arrival and releases its token upon departure. The above-defined closed tandem network models the dynamics of tokens as follows. The first queue contains available tokens, while the second queue contains tokens held by jobs in the system (either waiting to be served or in service). Service completions in the first and second queues correspond to job arrivals and departures, respectively, and the P&S mechanism translates to a protocol to distribute load across servers.

Queueing model

Just like in Section 5.1, the queues in the closed tandem network are ordinary P&S queues as described in Section 3. There are however no external arrivals or departures: the departure process of one queue now forms the arrival process of the other. In particular, both queues share the same set I = {1, . . . , I} of customer classes. The state of the first queue is denoted by c = (c 1 , . . . , c n ) ∈ I * and that of the second queue by d = (d 1 , . . . , d m ) ∈ I * , where n and m are the number of customers present in the first and second queue, respectively. We refer to (c; d) = (c 1 , . . . , c n ; d 1 , . . . , d m ) as the state of the network. We furthermore assume that both queues have the same swapping graph. The rate functions of the two queues may however differ: whereas customers in the first queue complete service according to the rate function µ, the rate function in the second queue is denoted by ν. Because of the closedness of the system, the sum of the macrostates of the two queues, denoted by = |c| + |d|, is constant over time. We refer to this vector = ( 1 , . . . , I ) as the network macrostate and we assume without loss of generality that i > 0 for every i ∈ I. Macrostates |c| and |d|, however, do fluctuate over time. We let Φ (resp. Λ) denote the balance function of the first (resp. second) queue. The functions µ, ν, Φ, and Λ are assumed to be defined on I * for simplicity.

As mentioned above, both queues have the same swapping graph. Similarly to Section 5.1.2, we define a placement order ≺ of the network by directing the edges of this swapping graph so that a directed acyclic graph, called the placement graph of the network, arises; we again write i ≺ j if and only if there exists a directed path from class i to class j in the placement graph. We now say that a network state (c; d) adheres to the placement order ≺ if the following three conditions are satisfied: (i) (c 1 , . . . , c n ) adheres to the placement order ≺ in the sense of Section 5.1.2, (ii) (d m , . . . , d 1 ) adheres to the placement order ≺ in the sense of Section 5.1.2, and (iii) c p d q for each p ∈ {1, . . . , n} and q ∈ {1, . . . , m}.

Reversing the order of state d in property (ii) is consistent with the observation of Section 5.2.1 that the order of customers in the second queue is reversed compared to the first queue. Equivalently, we say that the network state (c; d) adheres to the placement order ≺ if and only if the state (c 1 , . . . , c n , d m , . . . , d 1 ) would adhere to ≺ in the single-queue setting of Section 5.1.2. For example, the three network states shown in Figure 6 adhere to the placement order ≺ defined by the placement graph of Figure 5. Focusing on the state shown in Figure 6c, we have c = (2, 5, 1) and d = (6, 4, 3). The equivalent state in Section 5.1.2 would be (2, 5, 1, 3, 4, 6); note the absence of a semicolon and the reverse order of the customers of the second queue. It is indeed easily verified that this state adheres to the same placement order ≺ in Figure 6. The definition of adherence in the two-queue setting is symmetric with respect to the queues in the sense that state (c; d) adheres to the placement order ≺ if and only if state (d; c) adheres to the reverse placement order defined as follows: for each i, j ∈ I, i j if and only if j ≺ i.

As for the case of a single queue, we focus here on the case where the initial state adheres to a placement order. Propositions 4 and 5 below are the counterparts of Propositions 2 and 3 for closed tandem networks of two queues. The proofs of these two propositions are given in Appendix C and rely on the proof of their single-queue counterparts. Proposition 4. If the initial network state adheres to the placement order ≺, then any state reached by applying the P&S mechanism to either of the two queues also adheres to this placement order. Proposition 5. Assume that either ∆µ(c) > 0 for each c ∈ I * or ∆ν(d) > 0 for each d ∈ I * (or both). All states that adhere to the same placement order and correspond to the same macrostate form a single closed communicating class of the Markov process associated with the network state.

Stationary analysis

We now derive the stationary distribution of the Markov process associated with the network state. As in Section 5.1.3, we focus on the special case where the initial state adheres to the placement order ≺, so that, by Proposition 4, all subsequent states also adhere to this placement order. Therefore, we restrict the state space of the Markov process to the set Σ that consists of all network states (c; d) that adhere to the placement order ≺ and satisfy |c| + |d| = , where denotes the initial network macrostate. Theorem 5 below gives the stationary distribution of the Markov process associated with the network state.

Theorem 5. Assume that the Markov process associated with the state of the closed tandem network, with state space Σ, is irreducible. The stationary distribution of this Markov process is then given by

π(c; d) = 1 G Φ(c)Λ(d), ∀(c; d) ∈ Σ, (23)
where Φ and Λ are the balance functions of the first and second queues, respectively, and the normalization constant G is given by G =

(c;d)∈Σ Φ(c)Λ(d). (24)
Proof. Before writing down the balance equations, we introduce some useful notation. Let X denote the subset of N I that consists of the vectors x = (x 1 , . . . , x I ) such that x ≤ and, for each i, j ∈ I with i ≺ j, x j = 0 whenever x i = 0. This is the set of possible macrostates of the first queue. For each x ∈ X , let C x denote the set of states c = (c 1 , . . . , c n ) ∈ I * that adhere to the placement order and satisfy |c| = x. The set of possible states of the first queue is C = x∈X C x . Similarly, let Y denote the subset of N I that consists of the vectors y = (y 1 , . . . , y I ) such that |y| ≤ and, for each i, j ∈ I with i ≺ j, y i = 0 whenever y j = 0. This is the set of possible macrostates of the second queue. Also, for each y ∈ Y, let D y denote the set of states d = (d 1 , . . . , d m ) such that (d m , . . . , d 1 ) adheres to the placement order and |d| = y. The set of possible states of the second queue is D = y∈Y D y . As a result, the state space Σ can be partitioned as follows:

Σ = x∈X C x × D -x = y∈Y C -y × D y , (25)
where the symbol × stands for the Cartesian product. In particular, if the state of the first queue is equal to c ∈ C, then the set of possible states of the second queue is Y -|c| , and vice versa.

To prove the theorem, it suffices to verify that any measure given by ( 23 Up to a normalization constant, the right-hand side of this equation is also that of the partial balance equation ( 21) applied to state (c 1 , . . . , c n , d m ), since the domains of the outer sums are the same. The proof of Theorem 4 already showed that Φ satisfies this equation. To conclude, it suffices to observe that the left-hand side of (21

) is Φ(c 1 , . . . , c n , d m ) µ(c 1 , . . . , c n , d m ) = Φ(c).
Remark 7. Mutatis mutandis, Remarks 5 and 6 also apply to a closed tandem network of two P&S queues. In particular, an equivalent of Appendix D can be derived in case the initial network state does not adhere to a placement order.

Application to resource management in machine clusters

In the introduction, we already mentioned that P&S queues can be used to model several load-distribution and scheduling protocols, such as the FCFS-ALIS and FCFS redundancy scheduling protocols, in clusters of machines in which jobs have assignment constraints. This cluster model can represent various queueing systems, like the computer clusters or manufacturing systems mentioned in the introduction, in which not every machine is able to fulfill the service requirement of any job. It has played a central role in several studies of product-form queueing models over the past decade; see e.g. [START_REF] Adan | A loss system with skill-based servers under assign to longest idle server policy[END_REF][START_REF] Adan | A skill based parallel service system under FCFS-ALIS -steady state, overloads, and abandonments[END_REF][START_REF] Ayesta | A token-based central queue with orderindependent service rates[END_REF][START_REF] Ayesta | On a unifying product form framework for redundancy models[END_REF][START_REF] Bonald | Balanced fair resource sharing in computer clusters[END_REF][START_REF] Comte | Dynamic load balancing with tokens[END_REF][START_REF] Comte | Resource management in computer clusters: algorithm design and performance analysis[END_REF][START_REF] Gardner | Product forms for FCFS queueing models with arbitrary server-job compatibilities: an overview[END_REF][START_REF] Gardner | Queueing with redundant requests: Exact analysis[END_REF]. We now explain how P&S queues can be applied to analyze the performance of existing and new load-distribution and scheduling protocols in such clusters of machines. As an introductory example, in Section 6.1, we consider a load-distribution protocol whereby the decision of assigning a job to a machine is based on the order in which (slots in the buffers of) machines have become idle. We will see that this load-distribution protocol can be interpreted as a new scheduling protocol, called cancel-on-commit, for a redundancy scheduling system. We then explain how the queueing model that describes the dynamics of this protocol can be cast as a closed tandem network of two P&S queues like that of Section 5.2. In Section 6.2, we introduce a more general framework that encompasses other load-distribution and scheduling protocols, and then we give two prototypical examples of such protocols. In all cases, the dynamics can be described using a closed tandem network of P&S queues like that introduced in Section 5.2, and deriving the stationary distribution of the system state is a direct application of the results of Section 5.2, provided that the associated Markov process satisfies the appropriate irreducibility conditions.

Assign-to-the-longest-idle-slot and cancel-on-commit

We first consider a cluster made of a dispatcher and a set of machines. Each incoming job is a priori compatible with several machines but is eventually assigned to and processed by only one of these machines. Following the same approach as in the recent work [START_REF] Ayesta | On a unifying product form framework for redundancy models[END_REF], we introduce two variants of this cluster, one in which the dispatcher has a central buffer to store the jobs that have not been committed to a machine yet, and another in which these uncommitted jobs are temporarily replicated in the buffers of several machines. In the former case, we introduce an assignment protocol, called first-come-first-served and assign-to-the-longest-idleslot (FCFS-ALIS), that generalizes the first-come-first-served and assign-to-the-longest-idle-server protocol introduced in [START_REF] Adan | A skill based parallel service system under FCFS-ALIS -steady state, overloads, and abandonments[END_REF]. In the latter case, we introduce a new redundancy scheduling protocol, called cancel-oncommit, that generalizes the cancel-on-start protocol.

Assign-to-the-longest-idle-slot

We start with the variant where uncommitted jobs are stored in a central buffer. Consider a two-level buffered cluster consisting of a dispatcher and a set S = {1, . . . , S} of machines. For each s ∈ S, machine s has a buffer of length s ∈ {1, 2, . . .} that contains all jobs assigned (we also say committed) to this machine, either waiting or in service. Each machine processes the jobs in its buffer in FCFS order and, for each s ∈ S, the service time of a job on machine s is exponentially distributed with rate µ s . Incoming jobs enter the system via the dispatcher, and the dispatcher is in charge of assigning these jobs to (the buffer of) a machine. The dispatcher also has its own buffer where incoming jobs can be stored in case they cannot be immediately assigned to a machine due to full buffers. In this way, each job present in the system is either in the buffer of a machine, in which case we say that it has been assigned or committed to this machine, or in the buffer of the dispatcher, waiting for an assignment.

Each incoming job has a type that determines the set of machines to which this job can be assigned. The set of job types is denoted by K = {1, . . . , K} and, for each k ∈ K, type-k jobs arrive according to a Poisson process with rate ν k and can be assigned to any machine within the set S k ⊆ S. Conversely, for each s ∈ S, we let K s ⊆ K denote the set of job types that can be assigned to machine s (that is, such that s ∈ S k ). This defines a bipartite assignment graph between job types and machines, in which there is an edge between a type and a machine if the jobs of this type can be assigned to this machine; in this case, we say that these jobs are compatible with the machine. In the examples of this section, job types will be identified by letters rather than numbers to avoid confusion. In the assignment graph of Figure 7 for instance, type-A jobs are compatible with machines 1 and 3 and type-B jobs with machines 2 and 3, so that S A = {1, 3}, S B = {2, 3}, K 1 = {A}, K 2 = {B}, and K 3 = {A, B}. An incoming type-k job is immediately assigned to the buffer of a machine in S k if at least one of these buffers has idle (that is, empty) slots, otherwise the job is left unassigned in the dispatcher's buffer. We assume that, for each k ∈ K, the dispatcher's buffer can contain at most k ∈ {0, 1, 2, . . .} unassigned type-k jobs, so that an incoming type-k job is rejected (and considered permanently lost) if it arrives while there are already k unassigned type-k jobs. In other words, the dispatcher's buffer consists of k slots for type-k jobs, for each k ∈ K, and these slots cannot be occupied by jobs of other types. These values k can be used to differentiate service between job types.

When the job in service on machine s completes service, the oldest unassigned job of a type in K s , if any, is immediately removed from the dispatcher's buffer and added to the buffer of machine s, following which machine s immediately starts processing the oldest job in its buffer. Conversely, when a type-k job arrives, the dispatcher applies the following procedure:

(i) if one or more machines in the set S k have space in their buffer, the dispatcher selects the buffer slot, among those corresponding to these machines, that has been idle the longest, and assigns the job to the corresponding machine;

(ii) otherwise, if there are currently fewer than k unassigned type-k jobs, the dispatcher puts the incoming job in its own buffer until this job can be assigned to the buffer of a machine in S k ;

(iii) otherwise, the job is rejected.

The assignment rule described in step (i) will be called assign-to-the-longest-idle-slot (ALIS), in reference to the assign-to-the-longest-idle-server (also ALIS) assignment rule [START_REF] Adan | A loss system with skill-based servers under assign to longest idle server policy[END_REF][START_REF] Adan | A skill based parallel service system under FCFS-ALIS -steady state, overloads, and abandonments[END_REF], which corresponds to the special case where s = 1 for each s ∈ S1 . Note that there cannot be an unassigned job of a type in K s while there is space in the buffer of machine s, as in this case this job would have been assigned to the buffer of this machine earlier. We assume that all assignment operations occur immediately upon a job arrival or a service completion. Overall, we obtain a protocol called first-come-first-served and assign-to-the-longest-idle-slot (FCFS-ALIS), in which machines process jobs in their buffer in FCFS order, and incoming jobs are assigned to machines according to the ALIS assignment rule.

Our ALIS assignment rule can be rephrased as follows in terms of tokens. This alternative description will, among others, be useful for the analysis of Section 6.1.3. Assume that each machine sends a token to the dispatcher whenever a job completes service, and that the buffer keeps an ordered list of these tokens, with the oldest tokens at the head. Then, when a new job arrives, the dispatcher assigns this job to the compatible machine whose token appears earliest in this list, and deletes the corresponding token. Everything goes as if each job seized a token of a machine when it starts occupying a slot in its buffer and released this token upon service completion. Each token in the dispatcher's list corresponds to an idle slot in the buffer of the corresponding machine. The intuition behind this assignment rule is that, if a slot in a buffer has been idle for a long time, it is likely that the corresponding machine is relatively less loaded than others, so that we should assign the incoming job to this machine if possible.

Remark 8. The assign-to-the-longest-idle-server (ALIS) protocol introduced in [START_REF] Adan | A loss system with skill-based servers under assign to longest idle server policy[END_REF] corresponds to the degenerate case where s = 1 for each s ∈ S and k = 0 for each k ∈ K, so that an incoming job is rejected if all its compatible machines are already busy. It was shown in [START_REF] Adan | A loss system with skill-based servers under assign to longest idle server policy[END_REF] that, in this case, performance is insensitive to the job size distribution beyond its mean. A protocol that generalizes this ALIS protocol to a scenario where s ∈ {1, 2, . . .} for each s ∈ S and preserves its insensitivity property was introduced in [START_REF] Comte | Dynamic load balancing with tokens[END_REF]; this protocol is also a special case of the protocol that we have just defined. The first-come-first-served and assign-to-the-longest-idle-server (FCFS-ALIS) protocol introduced in [START_REF] Adan | A skill based parallel service system under FCFS-ALIS -steady state, overloads, and abandonments[END_REF] corresponds to the degenerate case where s = 1 for each s ∈ S and k = +∞ for each k ∈ K. In practice, taking larger values for s for s ∈ S can be beneficial if there is a communication delay between the dispatcher and the machines, such that a job cannot enter service immediately after it is assigned to a machine. Furthermore, taking unequal values for k for k ∈ K can be useful to differentiate service between job types. In the remainder of this section, we shall assume that k ∈ {1, 2, . . .} for each k ∈ K and s ∈ {1, 2, . . .} for each s ∈ S. Although the protocol defined above can be easily extended to the case k = +∞, generalizing the queueing analysis of Section 6.1.3 is less straightforward and will be left for future work.

Cancel-on-commit

It was observed in [START_REF] Ayesta | On a unifying product form framework for redundancy models[END_REF] that the server-based FCFS-ALIS protocol, which is a special case of the slot-based FCFS-ALIS protocol introduced in Section 6.1.1 as per Remark 8, leads to the same dynamics as a redundancy scheduling protocol, called cancel-on-start [START_REF] Gardner | Queueing with redundant requests: Exact analysis[END_REF][START_REF] Bonald | Balanced fair resource sharing in computer clusters[END_REF], whereby replicas of a job may be routed to multiple machines, and redundant replicas are canceled whenever a replica enters service at a machine. Using a similar approach, we now show that the slot-based FCFS-ALIS protocol can be reinterpreted as a redundancy scheduling protocol, called cancel-on-commit, that generalizes the cancel-on-start protocol. The basic idea is to let go of the dispatcher's central buffer for uncommitted jobs and, instead, replicate these jobs in the buffers of all their compatible machines.

Consider the following reinterpretation of the cluster model of Section 6.1.1. The cluster still consists of a dispatcher and a set S = {1, . . . , S} of machines, and incoming jobs have a type in the set K = {1, . . . , K} that determines the set of machines to which they can be assigned. We again let S k denote the set of machines that are compatible with type-k jobs, for each k ∈ K, and K s the set of job types that are compatible with machine s, for each s ∈ S. The main difference with Section 6.1 is that the dispatcher no longer has a central buffer to store unassigned jobs. Instead, for each s ∈ S, machine s has a two-level buffer. The first level of this buffer consists of s slots occupied by jobs that have been assigned or committed to this machine. The second level of this buffer will contain unassigned job replicas, as explained in the next paragraph. From now on, the first (resp. second) level of the buffer of machine s will be called its first-level (resp. second-level) buffer for brevity. Each machine processes the jobs in its first-level buffer in FCFS order.

When a type-k job arrives, the dispatcher immediately sends a replica of this job to each machine within the set S k . What happens next depends on the state of these machines, and we distinguish three cases:

(i) at least one machine in S k has available space in its first-level buffer, (ii) none of the machines in S k has available space in its first-level buffer, but the second-level buffers of these machines each contain less than k uncommitted type-k jobs, or (iii) the first-level buffers of the machines in S k are all full, and their second-level buffers already contain k uncommitted type-k jobs.

In the first case, we let s denote the machine in S k with the slot in its first-level buffer that has been idle the longest out of all idle slots in the first-level buffers of the machines in S k . The replica sent to machine s takes this first-level slot, and we say that the job commits to machine s. All other replicas of the job are immediately canceled. The committed replica then awaits its service by machine s, rendered in FCFS fashion, and leaves upon service completion. In case (ii), each replica of the job takes a slot in the second-level buffer of a machine in S k and waits until it is either canceled or committed to this machine. Whenever a job completes service at a machine, a first-level buffer slot becomes available. This buffer slot is immediately taken by the longest waiting replica in the machine's second-level buffer, if any. The corresponding job is committed to the machine, and all other replicas of this job are canceled. Finally, in case (iii), the incoming job is rejected and considered permanently lost. One can verify that this cancel-on-commit protocol leads to the same dynamics as the FCFS-ALIS protocol described in Section 6.1.1. The key difference, which does not impact the dynamics, is that uncommitted jobs wait in the buffers of their compatible machines instead of waiting in the dispatcher's centralized buffer. We will see in Section 6.1.3 that these two systems can be cast as a closed tandem of two P&S queues, so that Theorem 5 also provides the stationary distribution of the job population in a redundancy scheduling system with the cancel-on-commit protocol.

Interpretation as a closed tandem network of pass-and-swap queues

The objective of this section is to cast the above-mentioned cluster model as a closed tandem network of two P&S queues. To this end, we first need to give (yet) another perspective on the dynamics of the system.

Token-based central-queue perspective

The dynamics of the machine cluster can also be described by considering tokens, as if each job present in the system held a token that identifies the slot occupied by this job. More specifically, the set of token classes is K S, where denotes the disjoint union operator 2 . There are s class-s tokens, for each s ∈ S, and k class-k tokens, for each k ∈ K. The former tokens are those we already referred to in Section 6.1.1. More particularly, focusing on the cluster model of Section 6.1.1, each class-s token corresponds to a specific slot in the buffer of machine s, in the sense that a job holds this token when it occupies the corresponding slot. Similarly, each class-k token corresponds to a specific slot that can be occupied by type-k jobs in the dispatcher's buffer. Focusing on the cluster model of Section 6.1.2, each class-s token corresponds to a specific slot in the first-level buffer of machine s, while each class-k token corresponds to a specific slot that can be occupied by type-k jobs in the second-level buffers of the machines in S k . In general, we can think of a class-s token as a token that "belongs" to machine s, and of a class-k token as a token that "belongs" to type-k jobs. Each token is held by a job if and only if this job is occupying the corresponding slot, otherwise the token is available. When a type-k job enters the system, this job seizes an available token of a class s ∈ S k , if any, otherwise it seizes an available class-k token, if any. When a job completes service at machine s ∈ S, its class-s token is passed on to an unassigned job of a type k ∈ K s , if any, in which case this unassigned job releases the class-k token that it was holding; otherwise, the class-s token is released.

The dynamics of the cluster can be entirely described by the movements of these tokens, and long-term performance metrics, like the mean sojourn time of jobs, can be derived from the long-term expected number of tokens held by jobs present in the system. These tokens will play the part of customers in the closed tandem network of two P&S queues that we will now introduce. The first queue will contain tokens held by jobs present in the system, either assigned to a machine or waiting for an assignment, and these tokens will be ordered according to the arrival order of jobs in the system. In particular, contrary to Sections 6.1.1 and 6.1.2, we will adopt a central-queue perspective in which all (tokens held by) jobs present in the system are gathered in a single queue. This representation has become standard in product-form queueing models representing machine clusters [START_REF] Ayesta | A token-based central queue with orderindependent service rates[END_REF][START_REF] Ayesta | On a unifying product form framework for redundancy models[END_REF][START_REF] Bonald | Balanced fair resource sharing in computer clusters[END_REF][START_REF] Gardner | Product forms for FCFS queueing models with arbitrary server-job compatibilities: an overview[END_REF][START_REF] Gardner | Queueing with redundant requests: Exact analysis[END_REF]. The second queue of the closed tandem network will contain available tokens, and their order will partly reflect their release order. We will see that the dynamics induced by the FCFS-ALIS and cancel-on-commit protocols are captured by this model, provided that the P&S mechanism is applied with a suitable swapping graph. We first give an overview of the closed tandem network and then we will detail the dynamics of each queue separately.

Closed tandem network of two P&S queues

We consider a closed tandem network of two P&S queues like the one described in Section 5.2. Customers represent tokens and, in the remainder, we will always refer to them as tokens. The set of token classes is I = K S, and this set has cardinality I = K + S. The first queue contains the tokens held by jobs present in the system and the second queue contains the available tokens. A token that leaves the first queue immediately enters the second queue as a token of the same class, and conversely. The overall number of class-i tokens in the network is i , for each i ∈ I.

Both P&S queues have the same swapping graph, so that we obtain a closed tandem network of two P&S queues like that described in Section 5.2. The placement order is as follows: s ≺ k for each s ∈ S and k ∈ K s (or equivalently, for each k ∈ K and s ∈ S k ). The corresponding placement graph is obtained from the assignment graph introduced in Section 6.1.1 by orienting edges from the (token classes that correspond to) machines towards the (token classes that correspond to) job types. For example, the placement graph associated with the assignment graph of Figure 7 is shown in Figure 8a. The swapping graph of the network is simply the underlying undirected graph of the placement graph. This placement order guarantees that, if a class-k token is in the first queue, then, for each s ∈ S k , all class-s tokens are also in the first queue and precede this class-k token. This corresponds to the fact that, in the cluster, a type-k job can only be unassigned if the buffers of all machines in S k are full. We will come back to this interpretation later when we specify the dynamics of each queue in detail. An example of a network state that adheres to this placement order is given by a state where all tokens are lined up in the second queue, with first those of the classes in K in an arbitrary order, and then those of the classes in S, also in an arbitrary order. We assume that the network starts in such a state, which corresponds to an empty system in which all tokens are available.

First queue A token is in the first queue when it is held by a job present in the system, whether this job is assigned to the buffer of a machine or unassigned. This queue is a multi-server queue, like that of Example 2, and each server represents a machine in the cluster. More specifically, the set of servers is S and, for each s ∈ S, the service rate of server s is equal to the service rate µ s of machine s. Using the same index set S for the set of servers in the first queue and for the token classes associated with machines may seem to be ambiguous at first, but we will always specify whether we are referring to a server s ∈ S or to a token class s ∈ S. For each s ∈ S, a class-s token is compatible with server s and with this server only. Following The classes and servers associated with job types are identified by letters, and those associated with machines are identified by numbers (in accordance with Figure 7). The class colors are visual aids that help distinguish between the classes associated with job types (in green) and those associated with machines (in orange).

The same class and server indexing and color code will be adopted in Figures 9 and10.

the same notation as in Example 1, we let S s = {s}. Additionally, for each k ∈ K, the set of servers that can process class-k tokens is S k , which corresponds, in the cluster, to the set of machines to which type-k jobs can be assigned. the end, for each s ∈ S, server s can process the tokens that belong to machine s plus the tokens that belong to the job types in K s . For example, the compatibility graph of the first queue in the tandem network associated with the assignment graph of Figure 7 is shown in Figure 8b. Each server processes its compatible tokens in FCFS order. Note that, for each k ∈ K, the set S k now plays two roles in the tandem network: it represents the set of servers that can process class-k tokens in the first queue as well as the set of token classes that can be swapped with class-k tokens.

Recall that, according to the placement order, if a class-k token is in the first queue, then, for each s ∈ S k , all class-s tokens are also in the first queue, at positions that precede the position of the class-k token. Given the compatibility graph, this implies that a class-k token will actually never be in service in this queue. Therefore, the only way that a class-k token leaves the first queue is if a token of a class s ∈ S k completes service and ejects this class-k token. In the cluster, this means that a job completes service on machine s and that the token released by this job is seized by a type-k job that was unassigned so far (so that this type-k job releases its own class-k token).

We let c = (c 1 , . . . , c n ) ∈ I * denote the state of the first queue. As observed before, the placement order guarantees that, if there is a token of a class k ∈ K at a position p ∈ {1, . . . , n} in the first queue, then, for each s ∈ S k , each class-s token is also in the first queue, at a position q ∈ {1, . . . , p -1} that precedes that of the class-k token. Therefore, the state space of the state of the first queue is a strict subset C of the set of sequences c ∈ I * such that |c| ≤ , where = ( 1 , . . . , I ) is the vector that gives the maximum number of tokens of each class. The overall and per-token service rates are still given by ( 1) and ( 2), with the sets S k for k ∈ K and S s for s ∈ S as defined above. Because of the placement order, (2) simplifies to ∆µ(c 1 , . . . , c p ) = 0 for each p ∈ {1, . . . , n} such that c p ∈ K. Furthermore, the compatibility graph guarantees that, for each p ∈ {1, . . . , n} such that s = c p ∈ S, we have ∆µ(c 1 , . . . , c p ) = µ s if |(c 1 , . . . , c p-1 )| s = 0 and ∆µ(c 1 , . . . , c p ) = 0 otherwise. Now assume that a token in some position p ∈ {1, . . . , n} completes service and let s = c p ∈ S denote this token's class. Because of the P&S mechanism, only one of these two types of transitions can occur:

(i) If the first queue contains a token of a class in K s (necessarily in position at least p + 1 because of the placement order), the class-s token replaces the first of these tokens, say of class k ∈ K s , and the ejected class-k token joins the second queue. In the cluster, this means that a token from machine s is released by a departing job and is immediately seized by an unassigned type-k job; this type-k job releases its class-k token, which is appended to the queue of available tokens.

(ii) If there is no token with a class in K s in the first queue, the class-s token leaves this queue and joins the second queue. In the cluster, this means that a token from machine s is released by a departing job and is immediately appended to the queue of available tokens because there is no unassigned job of a type in K s .

In both cases, a token leaves the first queue and is added to the second, meaning that a token is released in the cluster. Examples of transitions are shown in Figure 9 for the cluster of Figure 7. In the state of Figure 9a, all tokens of classes in S are held by jobs present in the system, and there is also an unassigned type-A job. From Figure 9a to Figure 9b, the oldest class-2 token completes service in the first queue and joins the second queue. In the cluster, this means that a job completes service on machine 2 and its token is added to the queue of available tokens because there is no unassigned job of a compatible type. This is a transition of type (ii). From Figure 9b to Figure 9c, the oldest class-3 token completes service in the first queue; this token replaces the class-A token, which joins the second queue. In the cluster, this means that a job completes service on machine 3 and that its token is seized by an unassigned type-A job. This is a transition of type (i). The transition from Figure 9c to Figure 9d, triggered by a service completion in the second queue, will be commented on later.

A 3 2 1 3 1 2 µ 1 µ 3 µ 2 ν A ν B B A B (a) Initial state.
A 3 2 1 3 1 Second queue We now provide a symmetric description for the second queue, which contains available tokens. This queue is again a multi-server queue like that of Example 2, but the servers correspond to job types and not to machines. More specifically, the set of servers is K and, for each k ∈ K, the service rate of server k is equal to ν k , the arrival rate of type-k jobs in the cluster. Again, even though we use the same set K to index the set of servers in the second queue and the set of token classes associated with job types, we will always specify whether we are referring to a server k ∈ K or a token class k ∈ K. For each k ∈ K, the set of servers that can process class-k tokens is K k = {k}. Also, for each s ∈ S, the set of servers that can process class-s tokens is K s , corresponding to the set of job types that can seize a token from machine s in the cluster. In the end, for each k ∈ K, server k can process the tokens that belong to type-k jobs plus the tokens that belong to the machines in S k . For example, the compatibility graph of the second queue in the tandem network associated with the assignment graph of Figure 7 is shown in Figure 8c. Each server processes its compatible tokens in FCFS order. Due to the placement order, if a class-s token is in the second queue, then, for each k ∈ K s , all class-k tokens are also in the second queue, at positions that precede the position of the class-s token. Given the compatibility graph, this implies that a class-s token will never be in service in this queue. The only way a class-s token leaves this queue is if a token of a class k ∈ K s completes service and ejects this class-s token. In the cluster, this means that a type-k job enters and seizes a token from machine s.

µ 1 µ 3 µ 2 ν A ν B B A B 2
We let d = (d 1 , . . . , d m ) ∈ I * denote the state of the second queue. As observed before, the placement order guarantees that, if there is a token of a class s ∈ S at some position p ∈ {1, . . . , m} in the second queue, then, for each k ∈ K s , each class-k token is also in the second queue, at a position q ∈ {1, . . . , p -1} that precedes that of this class-s token. Therefore, the state space of the state of the second queue is a strict subset D of the set of sequences d ∈ I * such that |d| ≤ . The overall service rate in this queue is equal to the sum of the arrival rates of the job types that can seize at least one available token, given by

ν(d) = k∈ m p=1 K dp ν k . (28)
For each p ∈ {1, . . . , m}, the token in position p can be seized or moved by the incoming jobs that are compatible with this token but not with the older available tokens, and these jobs arrive at rate

∆ν(d 1 , . . . , d p ) = k∈K dp \ p-1 q=1 K dq ν k . (29)
The functions ν and ∆ν play the same role for the second queue as the functions µ and ∆µ, given by ( 1 (i) If the second queue contains a token of a class in S k (necessarily in position at least p + 1 because of the placement order), the class-k token replaces the first of these tokens, say of class s ∈ S k , and the ejected class-s token joins the first queue. In the cluster, this means that an incoming type-k job seizes a token from machine s because this was the oldest available token of a compatible machine.

(ii) If there is no token of a class in S k in the second queue, the class-k token leaves this queue and is added to the first queue. In the cluster, this means that a type-k job enters and does not find any available token from a machine in S k , so that this job seizes a class-k token and will hold this token until it is assigned to the buffer of a machine in S k .

In both cases, a token leaves the second queue and joins the first, meaning that a new job arrives and seizes a token in the cluster. An example of a type-(i) transition is shown in Figure 9 for the cluster of Figure 7. Indeed, from Figure 9c to Figure 9d, the oldest class-B token completes service in the second queue; this token replaces the class-2 token, which joins the first queue. In the cluster, this means that a type-B job enters and seizes a token of machine 2.

Remark 9. The second queue is degenerate in the sense that, accounting for the placement and compatibility graph, class-k tokens are the only tokens that can be processed by server k. Therefore, if we let A = {k ∈ K : |d| k > 0}, then, for each k ∈ A, the service rate of the oldest class-k token is ν k , irrespective of the order of the tokens in state d (provided that this state adheres to the placement order). This implies that the relative order of the tokens of the classes in K in state d modifies neither their service rates nor the departure rate of the tokens of the classes in S. On the contrary, in general, the relative order of the tokens of the classes in S modifies their departure rate. A similar remark could be made for the first queue by exchanging the roles of the sets K and S.

Generalization to other resource-management protocols

The important thing to remember from Section 6.1 is that we can describe the dynamics of tokens in a machine cluster using a closed tandem network of two P&S queues, so that the first queue contains tokens held by jobs present in the cluster and the other queue contains available tokens. In Section 6.2.1, we propose a more general framework based on the same idea. This framework extends the example of Section 6.1 in two ways: it allows not only for more general compatibility constraints between job types and machines, but also for multiple levels of preferences between tokens. Sections 6.2.2 and 6.2.3 give a prototypical example for each extension.

Queueing model

Consider a closed tandem network of two P&S queues like that described in Section 5.2. Let I = {1, . . . , I} denote the set of token classes and ≺ the placement order of this network. Recall that, for each i, j ∈ I such that i ≺ j, class-i tokens precede (resp. succeed) class-j tokens in the first (resp. second) queue. The swapping graph of the queues is simply the underlying undirected graph of the placement graph. For each i ∈ I, let i denote the number of class-i tokens in the network. We assume that both P&S queues are multi-server queues, like that described in Example 2. Their compatibility graphs will be described in the next paragraphs. The applications that we have in mind again involve tokens in a cluster, and in these applications the first queue of the tandem network will contain tokens held by jobs present in the system and the second queue will contain available tokens. Let us first describe the compatibility constraints in the first queue, as we did in Example 1. Let S = {1, . . . , S} denote the set of servers in this first queue and, for each s ∈ S, µ s the service rate of server s. For each class i ∈ I that is minimal with respect to the placement order ≺ (that is, there is no class j ∈ I with i j), we let S i ⊆ S denote the set of servers that can process class-i tokens in the first queue. This defines a bipartite graph between the set of minimal classes and the set of servers. The set of servers that can process non-minimal classes is defined by an ascending recursion over the placement order. More specifically, for each class i ∈ I that is not minimal with respect to the placement order, the set of servers that can process class-i tokens is S i = j∈I:j≺i S j . Going back to the example of Figure 8, we have that the set of classes is {1, 2, 3, A, B} and the set of minimal classes is {1, 2, 3}; the sets of servers associated with these classes in the first queue are S 1 = {1}, S 2 = {2}, and S 3 = {3}, while the sets of servers associated with the classes that are not minimal are S A = S 1 ∪ S 3 = {1, 3} and S B = S 2 ∪ S 3 = {2, 3}. The state of the first queue is denoted by c = (c 1 , . . . , c n ) and the overall and individual service rates in this queue are given by ( 1) and (2), respectively.

Similarly, we let K = {1, . . . , K} denote the set of servers in the second queue and, for each k ∈ K, ν k the service rate of server k. For each class i ∈ I that is maximal with respect to the placement order ≺ (that is, there is no class j ∈ I with i ≺ j), we let K i ⊆ K denote the set of servers that can process class-i tokens. This defines a bipartite graph between the set of maximal classes and the set of servers. The set of servers that can process non-maximal classes is defined by a descending recursion over the placement order. More specifically, for each class i ∈ I that is not maximal, the set of servers that can process class-i tokens is K i = j∈I:i≺j K j . By again considering the example of Figure 8, we have that the set of maximal classes is {A, B}; the sets of servers associated with these classes in the second queue are K A = {A} and K B = {B}, while the sets of servers associated with the classes that are not maximal are

K 1 = K A = {A}, K 2 = K B = {B}, and K 3 = K A ∪K B = {A, B}.
The state of the second queue is denoted by d = (d 1 , . . . , d m ) and the overall and individual service rates in this queue are given by ( 28) and (29), respectively.

In this new framework, the placement order describes not only priorities between classes but also compatibilities between classes and servers. Using this observation, we will now see that the structure of the closed tandem network can be described more compactly by a mixed graph (that is, a graph with both directed and undirected edges). The mixed graph associated with the model of Figure 8 is shown in Figure 10. The subgraph induced in this mixed graph by the set of classes describes the placement order. The subgraph induced by the set of minimal classes and the set of machines, as shown at the bottom of Figure 10, describes the compatibilities between the minimal classes and the servers of the first queue. The set of servers that can serve a non-minimal class is the union of the sets of servers that can serve the ancestors of this class. Similarly, the subgraph induced by the sets of maximal classes and the set of job types, as shown at the top of Figure 10, describes the compatibilities between the maximal classes and the servers of the second queue. The set of servers that can serve a non-maximal class is the union of the sets of servers that can serve the descendants of this class. Figures 12 and14 show more elaborate examples of mixed graphs that will be studied in Sections 6.2.2 and 6.2.3. As in Section 6.1, some tokens may never be in service in a queue. In fact, in the first queue, the only tokens that can be in service are those of the classes that are minimal with respect to the placement order. A token of a class i ∈ I that is not minimal can only leave this queue upon the service completion of a token of a minimal class j ∈ I such that j ≺ i. Similarly, only tokens of classes that are maximal with respect to the placement order can be in service in the second queue. A token of a class i ∈ I that is not maximal can only leave this queue upon the service completion of a token of a maximal class j ∈ I such that i ≺ j.

A B 1
Applying the results of Section 5.2.3 allows us to directly derive a closed-form expression for the stationary distribution of the network state. We adopt the notation of that section. In particular, the state space of the Markov process associated with the network state (c; d) is denoted by Σ and characterized by [START_REF] Van Dijk | On practical product form characterizations[END_REF]. Assuming that this Markov process is irreducible, it follows from Theorem 5 that its stationary distribution is given by

π(c; d) = 1 G n p=1 1 µ(c 1 , . . . , c p ) m p=1 1 ν(d 1 , . . . , d p ) , ∀(c; d) ∈ Σ,
where the constant G follows from normalization. We now consider two examples that illustrate the descriptive power of this new framework. Section 6.2.2 gives an extension of the introductory example of Section 6.1 to a cluster where jobs can be distributed over several machines. Section 6.2.3 looks at a token-based hierarchical load-distribution protocol. These two examples can be considered independently.

Distributed processing

As in Section 6.1, we consider a cluster that consists of a dispatcher and a set S = {1, . . . , S} of machines. The set of job types is denoted by K = {1, . . . , K} and, for each k ∈ K, type-k jobs arrive according to an independent Poisson process with rate ν k and have independent and exponentially distributed sizes with unit mean. An incoming job may be assigned to the buffer(s) of one (or more) machine(s), left unassigned for now, or rejected, depending on the type of this job and on the system state.

The difference with Section 6.1 is that an incoming job is no longer assigned to a single machine; instead, it is assigned to all machines in a group. More specifically, if a job is assigned to a group of machines, this means that this job is added to the buffer of every machine in this group, and that these machines will subsequently be able to process this job in parallel. A job is said to be unassigned (or uncommitted) if it has not been assigned to a group yet. We let T = {1, . . . , T } denote the set of group indices and, for each t ∈ T , S t ⊆ S the set of machines that belong to group t and K t ⊆ K the set of job types that can be assigned to group t. With a slight abuse of notation, we also let T s ⊆ T denote the set of groups that include machine s, for each s ∈ S, and T k ⊆ T the set of groups to which type-k jobs can be assigned, for each k ∈ K. This defines a tripartite assignment graph between job types, groups, and machines, as shown in Figure 11. The introductory example of Section 6.1 corresponds to the special case where there is a one-to-one correspondence between groups and machines, that is, T = S and S t = {t} for each t ∈ T . Each machine processes the jobs in its buffer in FCFS order, while ignoring other jobs. In particular, a job may be in service on multiple machines if it is at the head of their buffers. For each t ∈ T , if a job assigned to group t is in service on a subset S ⊆ S t of the machines of this group, the departure rate of this job is s∈S µ s .

We generalize the ALIS assignment rule introduced in Section 6.1.1 as follows. For each t ∈ T , the assignments of jobs to group t are regulated via t tokens, so that each job seizes one of these tokens when it is assigned to group t and releases this token upon service completion. The dispatcher keeps a list of available tokens, sorted in their release order, so that the longest available token is at the head of this list. An incoming type-k job can be assigned to group t if and only if a token of this group is available. As before, at most k type-k jobs can be left unassigned if no token of a compatible group is available upon their arrival. Now, when a type-k job arrives in the system, one of the following events occurs:

(i) if one or more tokens of the groups in T k are available, the job seizes the one of these tokens that has been available the longest and is assigned to the corresponding group (so that the job is added to the buffers of all machines in the group);

(ii) otherwise, if there are currently fewer than k unassigned type-k jobs, the incoming job is left unassigned until it can be assigned to one of its compatible groups;

(iii) otherwise, the job is rejected.

When a job assigned to group t completes service, this job leaves the system immediately. Its token is seized by the oldest unassigned job of a type in K t , if any, otherwise it is added to the dispatcher's list of available tokens. Furthermore, the machines that were processing this job immediately start processing the next job in their buffer, if any. This protocol can be seen as a generalization of that introduced in [START_REF] Comte | Dynamic load balancing with tokens[END_REF] to a scenario where incoming jobs are left unassigned (instead of being rejected) in the absence of available compatible tokens. This is also a generalization of the FCFS-ALIS protocol, in which each machine processes the jobs in its buffer in FCFS order, and each job is assigned to groups of machines using the above generalization of the ALIS assignment rule. Following the same approach as in Section 6.1.2, we can reinterpret this generalization of the FCFS-ALIS protocol as a generalized redundancy scheduling protocol that combines the cancel-on-commit protocol introduced in Section 6.1.2 and the cancel-on-complete protocol. Indeed, in the above cluster, everything works as if an incoming type-k job were at first replicated over all machines of the set t∈T k S t and eventually committed to a subset of these machines, those belong to a given group t ∈ T k . In practice, this means that a replica of an incoming type-k job is sent to every machine within the set t∈T k S t , and, once the job is committed to a group t ∈ T k , the replicas sent to the machines that are not in the set S t are canceled. Subsequently, the remaining replicas on the machines in S t are canceled whenever one of them completes service. In particular, several replicas may be in service at the same time.

The dynamics of this system can be described by the queueing model of Section 6.2.1 as follows. We again describe the dynamics of the cluster by looking at tokens, so that all jobs present in the system (and not only those assigned to a group) held one of these tokens. The set of token classes is I = K T and there are i class-i tokens, for each i ∈ I. The placement order is defined by t ≺ k for each t ∈ T and k ∈ K t (or equivalently, t ≺ k for each k ∈ K and t ∈ T k ). The minimal classes are those associated with machine groups and the maximal classes are those associated with job types. For each t ∈ T , the set of servers that can process class-t tokens in the first queue is S t , corresponding to the set of machines that belong to group t. For each k ∈ K, the set of servers that can process class-k tokens in the second queue is {k}. The mixed graph associated with the example of Figure 11 is shown in Figure 12.

Hierarchical load distribution

Let H denote a positive integer. We consider a cluster that consists of a dispatcher and 2 H-1 machines, and we denote by S = {1, . . . , 2 H-1 } the set of machines. Jobs arrive according to a Poisson process with a positive rate ν. Each incoming job is compatible with all machines but will eventually be assigned to and processed by a single machine. Every machine has a buffer of length 1, so that the only job assigned to this machine is also in service on this machine. For each s ∈ S, the service time of a job on machine s is exponentially distributed with a positive rate µ s . The job arrivals within the system are regulated via this token is in turn released and can be seized by another job), if any, otherwise it is added to the list of available tokens. Priorities between tokens can be represented by a perfect binary tree of height H -1 such that, for each i ∈ {1, . . . , 2 H-1 -1}, the children of node i are nodes 2i and 2i + 1. Figure 13 shows an example with H = 3. Leaf nodes correspond to tokens held by jobs in service on a machine. For each h ∈ {1, . . . , H -1}, the nodes at depth h in the tree correspond to tokens 2 h-1 to 2 h -1. A job holding one of these tokens is H -h steps away from entering service on a machine. Indeed, if a job holds a token i ∈ {1, . . . , 2 H-1 -1} and a token that belongs to the subtree rooted at node i is released, this job will seize either token 2i or token 2i + 1, thus getting one step closer to entering service on a machine. Figure 13: A perfect binary tree of height H -1 = 2.

The corresponding queueing model, based on the framework of Section 6.2.1, is defined as follows. The set of token classes is I = {1, . . . , 2 H -1}. For each i ∈ I, there is a single class-i token which corresponds, in the cluster, to token i. The placement order is defined as follows: for each i ∈ {1, . . . , 2 H-1 -1}, i 2i and i 2i + 1 (so that the placement graph is obtained by reversing edges in the perfect binary tree defined in the previous paragraph). In particular, if the queue of available tokens is not empty, the token at the head of this queue is necessarily token 1. The set of servers in the first queue is S = {1, . . . , 2 H-1 }. The set of minimal token classes is {2 H-1 , 2 H-1 + 1, . . . , 2 H -1} and, for each s ∈ {1, . . . , 2 H-1 }, class 2 H-1 + s -1 is compatible with server s. In the second queue, there is a single server of rate ν. The only maximal class is class 1 and this class is compatible with this server. The mixed graph associated with the perfect binary tree of Figure 13 is shown in Figure 14.

This hierarchical load-distribution strategy could be generalized by considering a perfect a-ary tree, with a ≥ 2, or a directed rooted tree, so that each node represents a class of tokens and the tokens associated with leaf nodes give access to machines. By combining this idea with that of Section 6.2.2, we could also consider a directed acyclic graph and associate a job type with one or more nodes without ancestor and a machine or a group of machines with each node without descendant. As for previous cluster models, it is also possible to propose an alternative interpretation of this model using redundancy scheduling.

Conclusion

In this paper, we introduced pass-and-swap (P&S) queues, an extension of order-independent (OI) queues in which, upon a service completion, customers move along the queue and swap positions with other customers, depending on compatibilities defined by a so-called swapping graph. We showed that a stable P&S queue is quasi-reversible and that, surprisingly, its product-form stationary distribution is independent of its swapping graph. We then studied networks of P&S queues. Although deriving the stationary distribution of open networks is a straightforward application of quasi-reversibility, the case of closed networks is more intricate because the Markov process describing the network state over time is not necessarily irreducible. For closed networks with one or two queues and a deterministic routing process, we observed that the P&S mechanism allows for the enforcement of priorities between classes, in the sense that a customer cannot leave a queue before all customers of the classes with higher priority leave it. Finally, we showed that such closed networks describe the dynamics of the loss variants of several token-based load-distribution protocols, such FCFS-ALIS and multiple redundancy-scheduling protocols. This work suggests that we still do not have a complete picture of all queueing dynamics that lead to a product-form stationary distribution, which leaves open an important avenue for further study. Another open question is formed by the irreducibility of the Markov process underlying closed networks. While we established irreducibility of this Markov process under the condition that, at any point in time, each customer has a positive service rate, the characterization of irreducibility properties of the Markov process underlying general closed networks, and their impact on the stationary distribution (along with its productform nature), remains an open question. A different direction of further research entails the applications of P&S queues. In particular, in Section 6, we regarded applications based on multi-server queues as defined in Example 1. Although applications with arbitrary customer-server compatibilities, such as load-balancing and resource-management protocols in computer systems, form the motivation for this work, we believe that P&S queues can be successfully applied to other systems involving priorities. This would require the use of more general P&S queues than just multi-server queues. which implies

c∈I * :|c|=x Φ(c) i∈I λ i |c|i ≥ c∈I * :|c|=x i∈A λ i j∈A λ j xi = x 1 + . . . + x I x 1 , . . . , x I i∈A λ i j∈A λ j xi . (34)
It follows that

c∈I * Φ(c) i∈I λ i |c|i = x∈N I c∈I * :|c|=x Φ(c) i∈I λ i |c|i , ≥ x∈N I : {i∈I:xi>0}⊆A c∈I * :|c|=x Φ(c) i∈I λ i |c|i , ≥ x∈N I : {i∈I:xi>0}⊆A x 1 + . . . + x I x 1 , . . . , x I i∈A λ i j∈A λ j xi , = ∞ n=0 i∈A λ i j∈A λ j n .
In the first inequality, we restricted the outer sum so that we can apply (34). In the final equality, we used the multinomial theorem, stating that, for each positive integers n and N and reals ρ 1 , ρ 2 , . . . , ρ N , we have

(ρ 1 + . . . + ρ N ) n = x1+...+x N =n n x 1 , . . . , x N N i=1 ρ xi i .
Since i∈A λi j∈A λj = 1, the final expression amounts to infinity, so that c∈I * Φ(c) i∈I λ i |c|i = ∞. This ensures that (5) is not satisfied, so that the Markov process on I * cannot be ergodic.

Sufficient condition Assuming that ( 16) is satisfied, we prove stability in two steps. We first introduce a second P&S queue with the same set I of classes and arrival rates λ 1 , . . . , λ I as the original P&S queue, but with a rate function μ such that μ(x) ≤ µ(x) for each x ∈ N I . We will refer to this second P&S queue as the degenerate P&S queue, as the service rate received by the customers of each class only depends on the number of customers of this class. Then we will show that the degenerate P&S queue is stable. Since the degenerate P&S queue has more pessimistic service rates than the original P&S queue, this also implies that the original P&S queue is stable, as we will see below.

We first introduce several quantities that will be useful to define the degenerate P&S queue. Since μ satisfies [START_REF] Jackson | Networks of waiting lines[END_REF], there exists an m ∈ N such that

i∈A λ i < µ(me A ), ∀A ⊆ I : A = ∅.
We can also find λ = ( λ1 , . . . , λI ) ∈ R I + such that λ i < λi for each i ∈ I, and (µ(x)), min

A⊆I:A =∅ µ(me A ) - i∈A λi . (35)
The definitions of µ and λ guarantee that δ > 0. In the degenerate P&S queue, δ will be the service rate of the customer classes that have fewer than m present customers. As we will see later, choosing this value of δ ensures that the service rate of the degenerate queue is always smaller or equal to that of the original queue.

The degenerate P&S queue is defined as follows. Just like the original P&S queue, the set of customer classes is I = {1, . . . , I} and the per-class arrival rates are λ 1 , . . . , λ I . But the rate function μ of this new queue is defined on N I by μ(x) = i∈I μi (x i ), with μi (

x i ) =      0 if x i = 0, min(δ, λi ) if x i = 1, 2, . . . , m -1, λi if x i = m, m + 1, . . .
In this way, for each i ∈ I, the oldest class-i customer is served at rate min(δ, λi ) and the m-th oldest class-i customer is served at rate max( λi -δ, 0). The service rate of other class-i customers is zero. It follows that, for each x ∈ N I \ {0}, we have μ(x) ≤ µ(x). Indeed,

if x i < m for each i ∈ I, then μ(x) ≤ i∈I:xi>0 δ ≤ i∈I:xi>0 1 I µ(x) ≤ µ(x),
where the first inequality follows from the definition of μ and the second holds by (35); otherwise, with A = {i ∈ I :

x i ≥ m}, we have A = ∅ and x ≥ me A , so that μ(x) ≤ i∈A λi + i∈I\A:xi>0 δ ≤ i∈A λi + i∈I\A:xi>0 µ(me A ) -j∈A λj I ≤ µ(me A ) ≤ µ(x),
where the first inequality follows from the definition of μ, the second holds by (35), and the fourth follows from the monotonicity of µ.

We let Φ denote the balance function of the degenerate P&S queue, as defined in (4). Theorems 1 and 2 now guarantee that the original P&S queue is stable whenever the degenerate P&S queue is. More particularly, by (4), we have for each (c 1 , . . . , c n ) ∈ I * :

Φ(c 1 , . . . , c n ) = n p=1 1 µ(c 1 , . . . , c p ) ≤ n p=1 1 μ(c 1 , . . . , c p ) = Φ(c 1 , . . . , c n ), which implies that c∈I * Φ(c) i∈I λ i |c|i ≤ c∈I * Φ(c) i∈I λ i |c|i .
Therefore, according to (5), the original P&S queue is stable whenever the degenerate P&S queue is. It therefore only remains to show that the degenerate P&S queue is stable. To prove this, we first write: Therefore, according to (5), the original P&S queue is stable whenever the degenerate P&S queue is. It therefore only remains to show that the degenerate P&S queue is stable. To prove this, we first write:

c∈I * Φ(c) i∈I λ i |c|i = x∈{0,
A +z Φ(c) i∈I λ i (me A +z)i < +∞.
The first equality is obtained by substitution. The second equality follows from the fact that, using (4) and the definition of μ, we can prove by induction over n = x 1 + . . . + x I that, for each x ∈ N I , we have

c∈I * :|c|=x Φ(c) = i∈I 1 min(δ, λi ) min(xi,m) 1 λi max(xi-m,0)
.

The third equality is obtained by rearranging terms. The inequality follows from the fact that λ i < λi for each i ∈ I, so that the product between large parentheses is finite; the rest of the expression is a sum of a finite number of terms, each of which is finite.

C Proofs of the propositions in Section 5

In this section, we give the proofs of Propositions 2, 3, 4, and 5 stated in Section 5.

Proposition 2. If the initial state of the closed P&S queue adheres to the placement order ≺, then any state reached by applying the P&S mechanism also adheres to this placement order.

Proof. Let c = (c 1 , . . . , c n ) denote the initial state of the queue and assume that c adheres to the placement order ≺. Let p ∈ {1, . . . , n} such that ∆µ(c 1 , . . . , c p ) > 0 and consider the transition induced by the service completion of the customer in position p. In the course of this transition, one or more customers are moved from the head towards the tail of the queue, the last one being moved to the last position. We now argue that the state reached after this transition still adheres to ≺, after which the proposition follows immediately, since application of the P&S mechanism only consists of a number of such transitions. We first show that the customer that completes service, of class c p , does not pass over any customer of a class i such that c p ≺ i. If there is no integer p ∈ {p + 1, . . . , n} such that c p ≺ c p , the conclusion is immediate. Now assume that there is such an integer and let q denote the smallest integer in {p + 1, . . . , n} such that c p ≺ c q . We will show that: (i) classes c p and c q are neighbors in the swapping graph, and (ii) there is no r ∈ {p + 1, . . . , q -1} such that classes c p and c r are neighbors in the swapping graph.

By definition of the P&S mechanism, this will imply that the customer that completes service at position p replaces the customer at position q in state c, so that, after the transition, the prefix of length q -1 of the new state is (c 1 , . . . , c p-1 , c p+1 , . . . , c q-1 , c p ). By definition of q, this prefix still adheres to the placement order, and since the rest of the state does not change, the complete state will as well. The same reasoning can be repeated for each customer that is moved by applying the P&S mechanism. We first prove property (i) by contradiction. Assume that this property is not satisfied. By definition of the placement order, this implies that there is a class i ∈ I such that c p ≺ i ≺ c q . Since state c adheres to the placement order, this implies that all class-i customers are between positions p and q in state c. In particular, there is an r ∈ {p + 1, . . . , q -1} such that c r = i and, therefore, c p ≺ c r , which contradicts the minimality of q. Therefore, property (i) is satisfied. We now prove property (ii), again by contradiction. If this property were not satisfied, there would be an r ∈ {p + 1, . . . , q -1} such that classes c p and c r are neighbors in the swapping graph. By definition of the placement order, this implies that either c p ≺ c r or c r ≺ c p . Since p < r and state c adheres to the placement order, the only possibility is that c p ≺ c r , which again contradicts the minimality of q. Therefore, property (ii) is satisfied. Proposition 3. Assume that ∆µ(c) > 0 for each c ∈ I * . All states that adhere to the same placement order and correspond to the same macrostate form a single closed communicating class of the Markov process associated with the queue state.

Proof. Given Proposition 2, it suffices to show that, for all states c = (c 1 , . . . , c n ) and d = (d 1 , . . . , d n ) that adhere to the same placement order ≺ and satisfy |c| = |d| = , state d can be reached from state c with a positive probability.

If c = d, the conclusion is immediate. Now assume that c = d. We will construct a path of states c 0 , c 1 , . . . , c K-1 , c K , with c 0 = c and c K = d, that the queue traverses with a positive probability, provided that it starts in state c. We argue that such a path c 0 , c 1 , . . . , c K is attained by the following algorithm:

Step 1: Set k = 0 and c 0 = c.

Step 2: Determine the smallest integer p ∈ {1, . . . , n} such that c k p = d p .

Step 3: Let c k+1 denote the state reached when, in state c k , the customer in position p completes service and the P&S mechanism is applied.

Step 4: Set k = k + 1. If c k = d, then K = k and the algorithm terminates. Otherwise, go to step 2.

The idea behind this algorithm is as follows.

Step 2 identifies the first position in state c k at which the class of the customer does not coincide with that of the customer at the same position in state d. This position is denoted by p. Since (c k 1 , . . . c k p-1 ) = (d 1 , . . . , d p-1 ), the customers in positions 1 to p -1 need not have their position altered. Now let r denote the smallest integer in {p + 1, . . . , n} such that c k r = d p . We will show in the next paragraph that, due to the service completion step, the customer in position r in state c k is one step closer to (or even attains) position p in state c k+1 compared to state c k . This suffices to prove that the algorithm terminates. Step 4 makes sure that the two states are equal to each other, otherwise it initiates a new P&S transition.

We now prove that, if r denotes the smallest integer in {p + 1, . . . , n} such that c k r = d p , then c k+1 r-1 = c k r . This is equivalent to proving that the customer in position r in state c k is not ejected in the course of the transition described in step 3. To prove this, it is sufficient to show that, for each q ∈ {p, . . . , r -1}, classes c k q and c k r cannot be swapped with one another, that is, are not neighbors in the swapping graph. Let q ∈ {p, . . . , r -1}. The adherence of state d to the placement order implies that d q ≺ d p for each q ∈ {p + 1, . . . , n}. As (d 1 , . . . , d p-1 ) = (c k 1 , . . . , c k p-1 ) and d p = c k r , this implies that c k q ⊀ c k r . It also follows from Proposition 2 that state c k adheres to the placement order, so that c k r ⊀ c k q . Therefore, we have c k q ⊀ c k r and c k r ⊀ c k q , which, by definition of a placement order, implies that classes c k q and c k r are not neighbors in the swapping graph. Proposition 4. If the initial network state adheres to the placement order ≺, then any state reached by applying the P&S mechanism to either of the two queues also adheres to this placement order. Proof. By symmetry, it suffices to prove that, if a network state adheres to the placement order ≺, then any network state reached by a service completion in the first queue also adheres to this placement order. Consider a state (c; d) that adheres to the placement order and let c = (c 1 , . . . , c n ) and d = (d 1 , . . . , d m ). Let c = (c 1 , . . . , c n-1 ) denote the state of the first queue right after a service completion in this queue and i the class of the customer that departs this queue. The state of the network right after the transition is (c ; d ) with d = (d 1 , . . . , d m , i). Applying Proposition 2 to the first queue yields that state (c 1 , . . . , c n-1 , i) adheres to the placement order, from which we can derive that properties (i) and (iii) are satisfied by the new network state. Finally, the fact that state (c; d) satisfies properties (ii) and (iii) implies that state d satisfies property (ii). First let (c ; ∅) denote the state reached from state (c; d) by having, m times in a row, the customer at the head of the second queue complete service. Proposition 4 guarantees that state (c ; ∅) adheres to the placement order so that, by property (i), state c adheres to the placement order. Since we assumed that state (c ; d ) adheres to the placement order, we also have that state (c 1 , . . . , c n , d m , . . . , d 1 ) adheres to the placement order. Therefore, it follows from Proposition 3 that, if the first queue evolved in isolation, as in Section 5.1, it would be possible to reach state (c 1 , . . . , c n , d m , . . . , d 1 ) from state c with positive probability. We can adapt the algorithm in this proposition to prove that, in the tandem network, state (c 1 , . . . , c n , d m , . . . , d 1 ; ∅) can also be reached from state (c ; ∅) with a positive probability: it suffices to add a transition, after step 3, that consists of the service completion of the (only) customer in the second queue (so that this customer joins the back of the first queue). Once state (c 1 , . . . , c n , d m , . . . , d 1 ; ∅) is reached, it suffices to have the customer at the back of the first queue complete service m times in a row. Since a service completion at the final position of a queue does not trigger any P&S movement, the network state (c ; d ) is reached, which concludes the proof.

D Closed pass-and-swap queues with non-adhering initial states

As mentioned in Remark 6, a product-form stationary distribution can also be found for closed P&S queues in which the initial state does not adhere to a placement order. To do so, we first associate, with each closed P&S queue, another closed P&S queue. We call this other queue the associated isomorphic queue. This isomorphic queue has the same dynamics as the original queue but its set of customer classes is different. The initial state of this isomorphic queue does adhere to a placement order by construction, so that Propositions 2 and 3 and Theorem 4 can be applied. This in its turn leads to a stationary distribution for the original closed P&S queue in the general case.

D.1 The isomorphic queue

We first define, for any closed P&S queue, its associated isomorphic queue. If the initial state of the original queue contains a single customer of each class, as in the example of Section 5.1.1, its associated isomorphic queue is the queue itself. We now describe how the isomorphic queue is constructed if the initial state of the original queue contains two or more customers of the same class.

Let c = (c 1 , . . . , c n ) denote the initial state of the queue and consider a class i ∈ I and two positions p, q ∈ {1, . . . , n} such that c p = c q = i and p < q. We introduce an extra class i (so that I is replaced with I ∪ {i }) that has the same characteristics as class i. More specifically, we impose that ∆µ(d 1 , . . . , d m , i) = ∆µ(d 1 , . . . , d m , i ) for each d = (d 1 , . . . , d m ) ∈ I * . In the swapping graph, for each k ∈ I \ {i, i }, we add an edge between classes i and k if and only if there is an edge between classes i and k. placement order to which the state adheres, and moreover show that it is unique. Recall that a placement graph is an acyclic orientation of the swapping graph, and consists of as many vertices as there are customers in the isomorphic queue. Therefore, to construct the placement graph, the edges of the swapping graph need to be given an orientation. Recall that all customer classes appear exactly once in a state of an isomorphic queue. Therefore, we have that, for any two customer classes i and j that are connected by an edge in the swapping graph, the placement order ≺ of the placement graph to be constructed should satisfy i ≺ j or j ≺ i, depending on whether or not the class-i customer is nearer to the front of the queue than the class-j customer. Orienting each edge accordingly yields a directed graph. Due to the transitivity of the order of customers in the state, this directed graph must be acyclic, and therefore it is a placement graph to which the state adheres. Note that, if any edge's orientation corresponding to this placement order were flipped, the corresponding pair of positions in the state would violate the new orientation. This proves the uniqueness, finalizing the proof.

D.2 Stationary distribution

Now that the isomorphic queue has been introduced, we can derive the stationary distribution for a closed P&S queue of which the initial state is not necessarily adhering. We can do this because the initial state of the isomorphic queue does necessarily adhere to a placement order, say ≺. Let ¯ be the macrostate of the isomorphic queue corresponding to the initial macrostate of the closed P&S queue. We denote by C the set of states c in the isomorphic queue that adhere to ≺ and satisfy |c| = ¯ . Also let C denote the set of states of the original closed P&S queue to which the states in C correspond. Finally, for each c ∈ C, let Cc ⊂ C denote the set of states c ∈ C in the isomorphic queue that correspond to state c in the original queue. Note that Cc may consist of multiple elements and that, considering all c ∈ C, the sets Cc form a partition of C. For example, a state (1, 2, 2, 3) of a closed P&S queue may have corresponding states (1, 2, 2 , 3) and (1, 2 , 2, 3) in the isomorphic queue, both adhering to the same placement order. Importantly, since all states in C correspond to the same macrostate , the sets Cc for all c ∈ C have the same cardinality. These definitions allow us to derive the stationary distribution of the Markov process associated with the state of the original P&S queue. Theorem 6. The results of Theorem 4 remain valid if C refers to the set of states of the original P&S queue to which the isomorphic states in C correspond.

Proof. By Lemma 2, the initial state of the isomorphic queue must adhere to a placement order that we denote by ≺. Therefore, applying Theorem 4 to the isomorphic queue shows that the stationary distribution of the Markov process associated with its state is given by By construction of the isomorphic queue, the dynamics of the original P&S queue and its isomorphic queue are the same. As such, the stationary probability of the original queue residing in state c is equal to the stationary probability of the isomorphic queue residing in any state of Cc , leading to: Remark 10. By Remark 5, the isomorphic queue cannot have transient states. Since an isomorphic queue with identical dynamics can be constructed for any closed P&S queue, this implies that the Markov process associated with the state of any closed P&S queue, regardless of any adherence of its initial state, cannot have transient states either. As a result, Theorem 6 now implies a partition of the complete state space I * in closed communicating classes, each of which corresponds to a set C defined by a combination of a macrostate ¯ and a particular placement order ≺ in the isomorphic queue.

  A queue state and the transition that occurs upon service completion of the first class-1 customer.

Figure 3 :

 3 Figure 3: Toy example of a P&S queue.

  State reached after the service completion of customer 1.

6 4 3 5 2 1 (

 1 d) State reached after the service completion of customer 2.

Figure 4 :

 4 Figure4: A closed P&S queue. The rate function need not be specified, as throughout this example we only consider the service completion of the customer at the head of the queue.

Figure 5 :

 5 Figure 5: The placement graph corresponding to Figure 4.

Proof.

  It suffices to show that the function Φ satisfies the balance equations of the Markov process, after which the result follows by normalization. Let c = (c 1 , . . . , c n ) ∈ C and i = c n . Since a departing customer immediately re-enters the queue as a customer of the same class, the balance equation for any state c ∈ C reads π(c) µ(c) = d∈C n p=1 δp(d)=((c1,...,cn-1),i) π(d) ∆µ(d 1 , . . . , d p ), (21) where we write δ p (d) = ((c 1 , . . . , c n-1 ), i) if, in the open queue, the service completion of the customer in position p in state d would lead to state (c 1 , . . . , c n-1 ) with a departure of a class-i customer. It follows from Proposition 2 that the set C contains all states d ∈ I * such that δ p (d) = ((c 1 , . . . , c n-1 ), i) for some p ∈ {1, . . . , n}. Therefore, it suffices to prove that the balance function Φ satisfies Φ(c) µ(c) = d∈I * n p=1 δp(d)=((c1,...,cn-1),i) Φ(d) ∆µ(d 1 , . . . , d p ).

6 5 4 3 2 1 (

 1 a) Initial state.

3 5 4 1 2 6 (

 6 b) State reached after the service completion of customer 1.

  State reached after service completions of several customers at the head of the first queue.

Figure 6 :

 6 Figure6: A closed tandem network of two P&S queues. As in Figure4, the rate function is not specified because we will only consider the service completion of the customer at the head of a queue.

  ) satisfies the following partial balance equations in each state (c; d) ∈ Σ, with c = (c 1 , . . . , c n ), d = (d 1 , . . . , d m ), x = |c|, and y = |d|: Equalize the flow out of state (c; d) due to a service completion at the first queue with the flow into that state due to an arrival at this queue, that is, to a service completion at the second queue (if c = ∅): π(c; d) µ(c) = d ∈Dy+e cn m+1 p=1 δp(d )=(d,cn) π(c 1 , . . . , c n-1 ; d ) ∆ν(d 1 , . . . , d p ). (26) Equalize the flow out of state (c; d) due to a service completion at the second queue with the flow into that state due to an arrival at this queue, that is, to a service completion at the first queue (if d = ∅): π(c; d) ν(d) = c ∈Cx+e dm n+1 p=1 δp(c )=(c,dm) π(c ; d 1 , . . . , d m-1 ) ∆µ(c 1 , . . . , c p ), (27) We focus on (27) because (26) follows by symmetry. Assuming that d = ∅, the main argument consists of observing that, since Λ(d) ν(d) = Λ(d 1 , . . . , d m-1 ), a stationary measure given by (23) satisfies (27) if and only if the balance function Φ defined by (4) satisfies Φ(c) = c ∈Cx+e dm n+1 p=1 δp(c )=(c,dm) Φ(c ) ∆µ(c 1 , . . . , c p ).

Figure 7 :

 7 Figure7: A bipartite assignment graph between job types and machines. To avoid any confusion in the rest of this section, job types are identified by letters rather than numbers in the examples.

  Compatibility graph of the first multi-server queue. Each server corresponds to a machine in the cluster.

  Compatibility graph of the second multi-server queue. Each server corresponds to a job type in the cluster.

Figure 8 :

 8 Figure8: Closed tandem network of two P&S queues associated with the assignment graph of Figure7. The classes and servers associated with job types are identified by letters, and those associated with machines are identified by numbers (in accordance with Figure7). The class colors are visual aids that help distinguish between the classes associated with job types (in green) and those associated with machines (in orange). The same class and server indexing and color code will be adopted in Figures9 and 10.

( b )

 b State reached after the service completion of the oldest class-2 token in the first queue.

2 A

 2 (c) State reached after the service completion of the oldest class-3 token in the first queue.

  State reached after the service completion of the oldest class-B token in the second queue.

Figure 9 :

 9 Figure 9: Closed tandem network of two P&S queues associated with the cluster of Figure 7, assuming that k = 2 for each k ∈ K and s = 2 for each s ∈ S.

) and ( 2 )

 2 , for the first queue. Again because of the placement order, (29) simplifies to ∆ν(d 1 , . . . , d p ) = 0 for each p ∈ {1, . . . , m} such that d p ∈ S. The compatibility graph also guarantees that, for each p ∈ {1, . . . , m} such that k = d p ∈ K, we have ∆ν(d 1 , . . . , d p ) = ν k if |(d 1 , . . . , d p-1 )| k = 0 and ∆ν(d 1 , . . . , d p ) = 0 otherwise. Now assume that a token in some position p ∈ {1, . . . , m} completes service. If k = c p ∈ K denotes this token's class, then, because of the P&S mechanism, only one of these two transitions can occur:

Figure 10 :

 10 Figure 10: Mixed graph associated with the example of Section 6.1.

Figure 11 :

 11 Figure 11: A tripartite assignment graph between job types, groups, and machines. We have S 1 = {1, 3}, S 2 = {2, 3}, K 1 = {A}, and K 2 = {A, B}.

Figure 12 :

 12 Figure 12: Mixed graph associated with the cluster of Figure 11.

4 Figure 14 :

 414 Figure 14: Mixed graph associated with the perfect binary tree of Figure 13.

Finally

  i∈A λi < µ(me A ), ∀A ⊆ I : A = ∅. For instance, we can choose λi = λ i + 1 2 min A⊆I:i∈A µ(me A ) -j∈A λ j |A| , ∀i ∈ I.

Proposition 5 .

 5 Assume that either ∆µ(c) > 0 for each c ∈ I * or ∆ν(d) > 0 for each d ∈ I * (or both). All states that adhere to the same placement order and correspond to the same macrostate form a single closed communicating class of the Markov process associated with the network state. Proof. Without loss of generality, we assume that ∆µ(c) > 0 for each c ∈ I * . The case where ∆ν(d) > 0 for each d ∈ I * is solved by exchanging the roles of the two queues. Given the result of Proposition 4, it suffices to show that, for all states (c; d) and (c ; d ) that adhere to the same placement order and correspond to the same macrostate, state (c ; d ) can be reached from state (c; d) with a positive probability. Consider two states (c; d) and (c ; d ) that adhere to the same placement order and satisfy |c| + |d| = |c | + |d |. The numbers of customers in states c, d, c , and d are denoted by n, m, n , and m , respectively. We now build a series of transitions that leads from state (c; d) to state (c ; d ) with a positive probability.

,

  ∀c ∈ C, where Φ(c) = Φ(c) for each c ∈ C and c ∈ Cc .

Equation ( 20 )

 20 follows by recalling that Φ(c) = Φ(c) for each c ∈ Cc and that all sets Cc have the same cardinality.

  The first sum on the right-hand side is finite because it has a finite number of terms. The second sum is also finite because, for each non-empty set A ⊆ I, we have

		Φ(c)	λ i	xi =								Φ(c)	λ i	(me A +y+z)i ,
	x∈N I : xi≥m,∀i∈A,	c∈I * : |c|=x	i∈I		y∈N I : yi=0,∀i / ∈A	zi=0,∀i∈A, z∈N I :	|c|=me A +y+z c∈I * :	i∈I
	xi<m,∀i / ∈A						zi<m,∀i / ∈A
				=	y∈N I : yi=0,∀i / ∈A	zi=0,∀i∈A, z∈N I :	|c|=me A +z c∈I * :	Φ(c)	i∈A	1 λi	yi	i∈I	λ i	(me A +y+z)i ,
							zi<m,∀i / ∈A
				=	i∈A	+∞ yi=0	λ i λi	yi	z∈N I :	c∈I
										zi=0,∀i∈A,
										zi<m,∀i / ∈A
										λ i	xi +	Φ(c)	λ i	xi .
									i∈I	A⊆I: A =∅	xi≥m,∀i∈A, x∈N I :	|c|=x c∈I * :	i∈I
												xi<m,∀i / ∈A

1,...,m-1} I c∈I * : |c|=x Φ(c) * : |c|=me

In the remainder, when we use the acronym ALIS (resp. FCFS-ALIS), we refer to our generalization of the ALIS (resp. FCFS-ALIS) protocol, in which the "S" refers to "slot". If we need to be more specific, we will replace "ALIS" with either "server-based ALIS" or "slot-based ALIS".

In practice, to make sure that the sets K and S remain disjoint, job types and machines can be renumbered if necessary. No confusion will arise from this slight abuse of notation, as we will always be using the letter k for a token class in K, associated with a job type, and the letters s and t for a token class in S, associated with a machine. In the examples, the index of a token class will be a letter if this token class is associated with a job type and a number if this token class is associated with a machine.

H -1 tokens numbered from 1 to 2 H -1. A job that has not been assigned to a machine yet holds a token numbered from 1 to 2 H-1 -1, while, for each s ∈ {1, . . . , 2 H-1 }, the job in service on machine s holds token 2 H-1 + s -1. Initially, when the system is empty of jobs, all tokens are arranged in ascending order in a list kept by the dispatcher, with token 1 at the head of the list and token 2 H -1 at the end. If a new job arrives and there is at least one available token, this job seizes the token obtained by applying the P&S mechanism in the queue of available tokens, starting from the token at the head of the queue, with the following swapping rule: for each i ∈ {1, . . . , 2 H-1 -1}, token i can be swapped with tokens 2i and 2i + 1. An incoming job is rejected if no token is available. Conversely, a service completion triggers the following chain reaction: if token i is released by a job, this token is seized by the job that holds token i/2 (so that

Acknowledgement We are thankful to Thomas Bonald and Fabien Mathieu for their useful comments and for coining the name "pass-and-swap queues". We thank Sem Borst for some helpful discussions and for valuable remarks on an earlier draft of this paper. The authors also wish to thank an anonymous associate editor for several astute remarks about the contents and exposition of the paper, and for suggesting the cancelon-commit redundancy protocol (including its name). The research of Jan-Pieter Dorsman is supported by the Netherlands Organisation for Scientific Research (NWO) through Gravitation-grant NETWORKS-024.002.003.

Appendix A Proof of Theorem 2

Consider a P&S queue as defined in Section 3.1, with a set I = {1, . . . , I} of customer classes, per-class arrival rates λ 1 , . . . , λ I , and a rate function µ. Also, for each i ∈ I, let I i ⊆ I denote the set of customer classes that can be swapped with class i. As announced in the sketch of proof that followed Theorem 2, our objective is to prove that the balance function Φ defined by ( 4) satisfies [START_REF] Gardner | Product forms for FCFS queueing models with arbitrary server-job compatibilities: an overview[END_REF].

Rewriting [START_REF] Gardner | Product forms for FCFS queueing models with arbitrary server-job compatibilities: an overview[END_REF] We first need to specify, for each c = (c 1 , . . . , c n ) ∈ I * and i ∈ I, all transitions that lead to state c by the departure of a class-i customer. To this end, we will identify all states d ∈ I * and positions p ∈ {1, . . . , n + 1} such that δ p (d) = (c, i). The following notation will be convenient. For each c = (c 1 , . . . , c n ) ∈ I * and d = (d 1 , . . . , d m ) ∈ I * , we let c, d = (c 1 , . . . , c n , d 1 , . . . , d m ) denote the state obtained by concatenation. If d contains a single class-i customer, that is d = (i), then we simply write c, i for c, (i) and i, c for (i), c. For each sequence c = (c 1 , . . . , c n ) ∈ I * and positions p, q ∈ {1, . . . , n} with p ≤ q, we let c p...q = (c p , . . . , c q ). Finally, we adopt the convention that c p...q = ∅ if p > q.

Now that all required notation is introduced, we proceed with the identification. Let c = (c 1 , . . . , c n ) ∈ I * and i ∈ I. Furthermore, we set q 0 = n + 1 and i 0 = i. Moving from tail to head in state c (that is, from position n to position 1), we determine the positions and classes of the customers that may be involved in a transition that leads to state c by the departure of a class-i customer. We now distinguish between multiple cases, based on the total number v of customers that move during the transition: Case v = 1: A single customer was involved in the transition, namely the customer of class i 0 = i that left. By definition of the P&S mechanism, this customer is the one that completed service and it could not replace any subsequent customer in the queue. Therefore, if state c contains any class that can be swapped with class i, then the departing customer of class i was necessarily in a position p ∈ {q 1 + 1, . . . , n + 1} before the transition, where q 1 is the largest integer q ∈ {1, . . . , n} such that c q ∈ I i0 . If state c does not contain any such customer, we let q 1 = 0. In both cases, before the departure, the queue could be any state of the form d = c 1...p-1 , i 0 , c p...n , where p ∈ {q 1 + 1, . . . , n + 1}.

Case v = 2: If two customers were involved in the transition, this means that the departing customer of class i was ejected by a second customer whose service was completed. The P&S mechanism and the symmetric property of the swapping relation impose that this second customer is the one we have just identified, in position q 1 , and that q 1 ≥ 1. We let i 1 = c q1 ∈ I i0 denote the class of this second customer. By the same argument as before, this second customer could be in any position p ∈ {q 2 + 1, . . . , q 1 } before the transition, where q 2 is the largest integer q ∈ {1, . . . , q 1 -1} such that c q ∈ I i1 , if any, and q 2 = 0 otherwise. In both cases, before the departure, the queue could be in any state of the form d = c 1...p-1 , i 1 , c p...q1-1 , i 0 , c q1+1...n , where p ∈ {q 2 + 1, . . . , q 1 }.

Case v = 3: The departing customer was ejected by a second customer, which was ejected by a third customer whose service was completed. Pursuing the previous reasoning, we can show that the second involved customer is that of class i 1 = c q1 , in position q 1 , and the third involved customer is that of class i 2 = c q2 , in position q 2 , assuming that 1 ≤ q 2 < q 1 . Before the transition, this third customer could be in any position p ∈ {q 3 + 1, . . . , q 2 }, where q 3 is the largest integer q ∈ {1, . . . , q 2 -1} such that c q ∈ I i2 , if any, and q 3 = 0 otherwise. Before the departure, the queue could be in any state

, where p ∈ {q 3 + 1, . . . , q 2 }.

Continuing on, we build a decreasing sequence n + 1 = q 0 > q 1 > q 2 > . . . > q u-1 > q u = 0 of positions in state c using the recursion q v = max{q ≤ q v-1 -1 : c q ∈ I iv-1 } for each v ∈ {1, . . . , u -1}. The recursion stops when the set {q ≤ q v-1 -1 : c q ∈ I iv-1 } is empty, in which case we let u = v and q u = 0. This integer u gives the maximum number of customers that can be involved in the transition (including the departing class-i customer). We also define a sequence i 0 = i, i 1 = c q1 , i 2 = c q2 , . . . , i u-1 = c qu-1 of classes. In the end, the states d that lead to state c by a departure of a class-i customer are those of the form

with v ∈ {0, . . . , u -1} and p ∈ {q v+1 + 1, q v+1 + 2, . . . , q v }, where p gives the position of the customer, of class i v , whose service was actually completed. This implies that ( 14) can be rewritten as follows:

That the balance function Φ defined by ( 4) satisfies ( 30) is shown in the following lemma, which concludes the proof of Theorem 2.

Lemma 1. The function Φ defined by (4) satisfies (30) for each integers n ≥ 0 and u ∈ {1, . . . , n + 1}, state c = (c 1 , . . . , c n ) ∈ I * , class i ∈ I, and decreasing integer sequence q 0 , q 1 , . . . , q u with q 0 = n + 1 and q u = 0, where

Proof of the lemma. Our proof is by induction on the maximum number u ≥ 1 of customers involved in the transition. More specifically, we show that the following statement holds for each positive integer u:

Equation ( 30) is satisfied for each integer n ≥ u -1, state c = (c 1 , . . . , c n ) ∈ I * , class i ∈ I, and decreasing integer sequence q 0 , q 1 , . . . , q u with q 0 = n + 1 and q u = 0.

Before we proceed to the proof by induction, recall that Φ satisfies the following equation, which is a rewritten version of Equation ( 9) shown in the proof of Theorem 1:

Base step. With u = 1, (30) is equivalent to (31) with i = i 0 . As we have just mentioned, it was already shown that Φ satisfies this equation.

Induction step. Now let u ≥ 2 and assume that the statement is valid for each u ∈ {1, 2, . . . , u -1}. Consider an integer n ≥ u -1, a state c = (c 1 , . . . , c n ) ∈ I * , a class i ∈ I, and a decreasing integer sequence q 0 , q 1 , . . . , q u with q 0 = n + 1 and q u = 0. Also let i 0 = i, i 1 = c q1 , i 2 = c q2 , . . . , i u-1 = c qu-1 . We first apply (31) to state c and class i = i 0 and split the sum into two parts to obtain

Using the definition (4) of Φ and the fact that µ is order independent, we rewrite the first sum differently:

But applying (31) to state c 1...q1-1 and class i 0 yields Φ(c 1...q1-1 ) = q1 p=1 Φ(c 1...p-1 , i 0 , c p...q1-1 ) ∆µ(c 1...p-1 , i 0 ), so that (32) can be rewritten as

Now we apply the induction assumption to the positive integer u = u -1, with the integer n = q 1 -1, the state c = c 1...q1-1 , the class i 1 , the decreasing sequence q 0 = q 1 = n + 1, q 1 = q 2 , . . . , q u-2 = q u-1 , q u = q u-1 = q u = 0, and the indices i

We can verify that n ≥ u -1 because the sequence q 1 , q 2 , . . . , q u is decreasing with q u = 0, so that q 1 ≥ q 2 + 1 ≥ q 3 + 2 ≥ . . . ≥ q u + (u -1) = u -1. For this setting, (30) implies that

Note that the first sum ranges from 1 to u -1, and not from 0 to u -1 = u -2, as a result of rewriting. Doing the substitution in (33) yields

We again apply (4) and the fact that µ is order independent to move the product back into the first sum, so that we obtain

We conclude by observing that the second sum corresponds to the missing term v = 0 in the first sum.

B Proof of Theorem 3

We first prove that ( 16) is a necessary condition for stability by arguing that the Markov process describing the state of the queue over time cannot be ergodic in the absence of this condition. Then, we prove that this condition is sufficient, by comparing the P&S queue to a degenerate queue with pessimistic service rates.

Necessary condition Assume that there is a non-empty set A ⊆ I such that μ(A) ≤ i∈A λ i . Since µ is non-decreasing, this means that µ(x) ≤ i∈A λ i for each x ∈ N I such that {i ∈ I : x i > 0} ⊆ A. Combining this inequality with (4) yields that, for any such x, and for each c ∈ I * such that |c| = x, we have

Moving towards a setting where all customers have different classes, we alter the initial state c by changing the class of the customer in position q from i to i . While c p and c q are not equal anymore, the definition of class i guarantees that the dynamics of the queue remain the same. This procedure can be repeated with newly selected class i and positions p and q as long as there are at least two customers with the same class in state c. The queue obtained once all customers have different classes is called the isomorphic queue. If c is the initial state of the isomorphic queue obtained by repeating this procedure, we say that state c in the isomorphic queue corresponds to state c in the original queue.

Example 5. We now illustrate the construction of an isomorphic queue by means of the closed P&S queue depicted in Figure 15. This queue has six customers belonging to three classes. There are two class-1 customers, three class-2 customers, and one class-3 customer. The initial state of the queue, shown in Figure 15b, is (c 1 , c 2 , c 3 , c 4 , c 5 , c 6 ) = (1, 2, 1, 2, 2, 3). This state does not adhere to any placement order because customers of classes 1 and 2 are interleaved. To construct the isomorphic queue, we progressively eliminate pairs of equal customer classes. For example, since c While the isomorphic queue has by construction the same dynamics as the original P&S queue, it has the following useful property. Lemma 2. Every state of an isomorphic queue adheres to a unique placement order. Proof. To prove this lemma, we show how to construct a placement graph for any state, which defines the