Abstract 1 Introduction 2 Formal Model and Results 3 A Direct Analysis of the 𝝈-MultiQueue 4 Application to the 𝒄-MultiQueue 5 Future Work References

A Simple yet Exact Analysis of the MultiQueue

Stefan Walzer ORCID Karlsruhe Institute of Technology, Germany Marvin Williams ORCID Karlsruhe Institute of Technology, Germany
Abstract

The MultiQueue is a relaxed concurrent priority queue consisting of n internal priority queues, where an insertion uses a random queue and a deletion considers two random queues and deletes the minimum from the one with the smaller minimum. The rank error of the deletion is the number of smaller elements in the MultiQueue.

Alistarh et al. [2] have demonstrated in a sophisticated potential argument that the expected rank error remains bounded by 𝒪(n) over long sequences of deletions.

In this paper we present a simpler analysis by identifying the stable distribution of an underlying Markov chain and with it the long-term distribution of the rank error exactly. Simple calculations then reveal the expected long-term rank error to be 56n1+16n. Our arguments generalize to deletion schemes where the probability to delete from a given queue depends only on the rank of the queue. Specifically, this includes deleting from the best of c randomly selected queues for any c>1.

Keywords and phrases:
MultiQueue, concurrent data structure, stochastic process, Markov chain
Copyright and License:
[Uncaptioned image] © Stefan Walzer and Marvin Williams; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Mathematics of computing Stochastic processes
; Theory of computation Data structures design and analysis
Related Version:
Full Version: https://arxiv.org/abs/2410.08714 [20]
Funding:
margin: [Uncaptioned image] This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation program (grant agreement No. 882 500).
Editors:
Anne Benoit, Haim Kaplan, Sebastian Wild, and Grzegorz Herman

1 Introduction

Priority queues maintain a set of elements from a totally ordered domain, with an insert operation adding an element and a deleteMin operation extracting the smallest element. They are a fundamental building block for a wide range of applications such as task scheduling, graph algorithms, and discrete event simulation. The parallel nature of modern computing hardware motivates the design of concurrent priority queues that allow multiple processing elements to insert and delete elements concurrently. Strict111in the sense of linearizability concurrent priority queues (e.g., [19, 11, 7, 17]) suffer from poor scalability due to inherent contention on the smallest element [4, 8]. To alleviate this contention, in relaxed priority queues deletions should still preferentially extract small elements but need not always extract the minimum. In other words, the correctness requirement is turned into a quality measure: We speak of a rank error of r1 if the extracted element has rank r among all elements currently in the priority queue. In many scenarios, relaxed priority queues outperform strict priority queues, as the higher scalability outweighs the additional work caused by the relaxation. They are an active field of research and a vast range of designs has been proposed  [10, 16, 22, 3, 18, 21, 15, 23].

The MultiQueue.

The MultiQueue, initially proposed by Rihani et al. [16] and improved upon by Williams et al. [21], emerged as the state-of-the art relaxed priority queue. Due to its high scalability and robust quality, the MultiQueue inspired a number of follow-up works [15, 23]. Its design uses the power-of-two-choices paradigm and is delightfully simple: We use n (sequential) priority queues for some fixed n. Each insertion adds its element to a queue chosen uniformly at random and each deletion picks two queues uniformly at random and deletes from the one with the smaller minimum.

Figure 1: The MultiQueue with n=6 queues and some elements already inserted. The shown insertion picks queue 2 to insert the element 34 (green). The shown deletion picks queues 3 and 6 with minima 8 (red) and 12 (orange), and deletes the 8 since it is smaller. The deletion exhibits a rank error of 3 due to the 3 smaller elements highlighted in blue.

Figure 1 illustrates the MultiQueue with n=6 queues. We can generalize this design to pick any number c>1 of queues for deletions where even non-integer choices of c make sense: We would then pick c+1 queues with probability cc and c queues otherwise. In practice, the individual queues are protected by mutual exclusion locks, and n is proportional to the number of processing elements to find unlocked queues in (expected) constant time.

Existing theory on the MultiQueue.

Our theoretical understanding of the MultiQueue is still incomplete. One obstacle is that the order of operations matters: Intuitively, deletions can cause the distribution of elements to drift apart and increase the expected rank error, while insertions of small elements can mask accumulated differences. This suggests that the worst-case setting is when following the insertion of sufficiently many elements, only deletions occur. Like Alistarh et al. [2], we exclusively consider this setting. At first glance, this process seems closely related to the classical balls-into-bins process, where balls are placed one after the other into the least loaded of two randomly chosen bins. Famously, the difference between the highest load and the average load for n bins is in 𝒪(loglogn) with high probability for any number of balls. Numerous variants of the balls-into-bins process have been proposed and studied [5, 12, 6, 14]. However, reducing the process to a balls-into-bins process imposes multiple difficulties. The state of the MultiQueue is not fully described by the number of elements in each queue but also involves information about the ranks of the elements. Moreover, deleting an element from a queue can affect the ranks of elements in other queues. Despite these challenges, Alistarh et al. [2] managed to transfer the potential argument from the balls-into-bins analysis by Peres et al. [14] to a MultiQueue analysis via an intermediate “exponential process” that avoids correlations between the elements in the queues. They prove that the expected rank error is in 𝒪(n) and the expected worst-case rank error is in 𝒪(nlogn) for any number of deletions and any c(1,2], while the rank errors diverge with the number of deletions for c=1. In follow-up work, this technique is generalized to other relaxed concurrent data structures [1] and a process where each processing element has its own priority queue and “steals” elements from other processing elements with some probability [15].

Contribution.

In this paper, we present an analysis of the MultiQueue that, compared to the potential argument by Alistarh et al. [2], is simultaneously simpler and more precise. We characterise the exact long-term distribution of the rank error for any c>1 and any n. From this distribution we can derive, for instance, that the expected rank error for c=2 is 56n1+16n. In addition to covering any c>1, our analysis generalizes to all deletion schemes where the probability for a queue to be selected solely depends on the rank of the queue (when ordering the queues according to their smallest element).

We achieve this by modelling the deletion process as a Markov chain and observing that its stationary distribution can be described using a sequence of n1 independent geometrically distributed random variables. In the full version of this paper [20] we also apply our techniques to the elegant exponential process by Alistarh et al. [2], which we believe to be of independent interest.

Outline.

First, in Section 2, we introduce the formal model of a generalized MultiQueue and the setting in which we analyze it. We then state our main results, including Theorem 1 that characterizes the long-term distribution of the ranks of the top-elements in the MultiQueue. In Section 3, we present our analysis of the generalized MultiQueue, leading to the proof of Theorem 1. We apply Theorem 1 to compute the expected rank error for any c>1 and any n in Section 4. Finally, in Section 5, we discuss implications and limitations of our results and outline possible future work.

2 Formal Model and Results

Analogous to Alistarh et al. [2], we analyze the MultiQueue in a simplified setting where only deletions occur.

The 𝝈-MultiQueue.

A σ-MultiQueue consists of n priority queues and a choice distribution σ on [n] that captures a generalised deletion strategy (as explained below). The n queues are initially populated by randomly partitioning an infinite set {x<x<x<} of elements. 222Note that every queue receives an infinite number of elements with probability 1. The queues, identified with the sets of elements they contain, are denoted by Q,,Q, indexed such that minQ<minQ<<minQ. The minima are also called top-elements. We then perform a sequence of deletions. Each time, we select an index i[n] according to σ and delete the top-element of Qi. 333We write [n] as a shorthand for {1,,n}. Then, we relabel the queues such that their top-elements appear in ascending order again. Let (Q(s),,Q(s)) be the sequence of queues after s deletions and ri(s) the rank of the top-element minQi(s) among Q(s)Q(s), for any s and i[n].

Intuitively, σ should be biased towards smaller values of i, i.e., towards selecting queues with smaller top-elements, to ensure that the rank error does not diverge over time. Using the notation σi:=Priσ[i=i] and σi:=Priσ[ii], the formal requirement for σ turns out as:

i[n1]:σi>in ()

If σ does not satisfy (), the MultiQueue deletes too frequently from “bad” queues (i.e., with large top-elements) and the gap between “good” and “bad” queues increases over time. We prove a corresponding formal claim in the full version of this paper [20].

Surprisingly independent random variables.

One might think that the ranks r(s)<<r(s) are correlated in complex ways. While they are correlated, they effectively arise as the prefix sum of n1 independent random variables. More precisely, our main theorem draws attention to the differences between the ranks of consecutive top-elements.

Theorem 1 (Proof in Section 3).

Let (r(s),,r(s)) denote the ranks of the top-elements of a σ-MultiQueue with σ satisfying () after s deletions. Then (r(s),,r(s)) converges in distribution to a sequence (r,,r) of random variables where

ri=1+j=1i1δj for i[n] with δiGeom(1inσi) for i[n1],

where Geom(p) denotes the geometric distribution of the number of Bernoulli trials with success probability p until (and including) the first success.

From the distribution of the ranks of the top-elements given by Theorem 1 it is straightforward to derive the rank error distribution.

Corollary 2 (Proof in Section 3).

Let R(s) denote the rank error exhibited by the deletion in step s in the σ-MultiQueue with σ satisfying (). Then R(s) converges in distribution to the random variable R where

R=ri1 with iσ and ri as in Theorem 1.

The expected rank error is (in the long run)

𝔼[R]=i=1n1σi(1σi)σiin.

Application to the 𝒄-MultiQueue.

For c>1 we define the c-MultiQueue to be the σ-MultiQueue where σ is the distribution that corresponds to picking the best out of c randomly selected queues as described in Section 1. For instance, the probability to select one of the first i queues with c=2 is σi=1(1in)². Note that () is satisfied (see Lemma 8). We can then derive several useful quantities from Theorem 1, including the expected rank error.

Theorem 3.

Consider the expectation 𝔼[R] of the rank error R=ri1 of the c-MultiQueue in the long run (i.e., after convergence).

  1. (i)

    For c=2 we have 𝔼[R]=56n1+16n=56nΘ(1).

  2. (ii)

    For c=1+ε with ε(0,1), we have 𝔼[R]=(1εε6)n1ε+ε6n=(1εε6)n𝒪(1/ε).

  3. (iii)

    For any c>1 we have n01fc(x)𝑑xcc1𝔼[R]n01fc(x)𝑑x,
    where fc:(0,1) is defined as follows using ε:=cc[0,1)

    fc(x)=xc1(1ε+εx)1xc(1ε+εx)1xc1(1ε+εx).
  4. (iv)

    Cruder but simpler bounds for any c2 are: nccc1𝔼[R]nc1.

Figure 2: For large n, the c-MultiQueue has an expected rank error of 𝔼[R]=n·¹fc(x)𝑑x+o(n) where fc(x) is defined in Theorem 3. The solid line shows c¹fc(x)𝑑x and hence the constant in front of the leading term. The dashed line c1c1 is an asymptote for both c1 and c.

Figure 2 plots the expected asymptotic rank error per queue depending on c, and an approximation 1c1. We also give concentration bounds for the rank error in Theorem 9.

The Exponential-Jump Process.

As an intermediate step in their analysis, Alistarh et al. [2] introduce the “exponential process”, where new top-elements are not given by the current state but generated by adding an exponential random variable to the current top-element. We reformulate this process as the equivalent exponential-jump process (EJP) as follows. The EJP involves n tokens on the real number line and a distribution σ on [n]. In every step, we sample iσ and XExp(1). We then identify the ith token from the left and move it a distance of X to the right. More formally, the state of the process is given by the sequence t<<t of positions of the tokens and the state transition can be described as

(t,,t)sort(t,,ti+X,,t) where iσ and XExp(1).

We provide an exact analysis, which we believe to be of independent interest, and explain the connection between the EJP and the MultiQueue in the full version of this paper [20]. With the same methods as before, we analyse the differences (d,,dn1) with di=ti+1ti.

Theorem 4.

Let n and let σ be a distribution on [n] that satisfies (). The EJP admits a stationary distribution π for the differences (d,,dn1) with

π=×i=1n1Exp(n·σii).

In other words, the distances between neighbouring tokens are, in the long-run, mutually independent and exponentially distributed with parameters as given.

3 A Direct Analysis of the 𝝈-MultiQueue

When analysing random processes, it is often a good idea to reveal information only when needed, keeping the rest hidden behind a veil of probability. In our case, the idea is to conceal the queue an element is in until the element becomes a top-element.

We discuss this idea using the example in Figure 3 where n=4 queues are initially populated with the set .

Figure 3: Increasingly abstract ways for modeling the state of a MultiQueue system with 4 queues. (a) contains all information. (b) assumes that the queues in which the elements reside has only been partially revealed. (c) abstracts away from concrete elements. (d) represents the information in (c) using numbers.

In (a) we see an explicit representation of a possible state, where queues are labeled in increasing order of their top-elements. We can tell, for instance, that when removing the top-element 7 of queue 2 then the new top-element would be 9. In (b) we keep track of the current and past top-elements of all queues but do not reveal ahead of time which queue each element of is assigned to. As far as we know, the elements 16,17,18, are assigned to each of the four queues with equal probability. It is unavoidable that we obtain partial information, however: If an element is smaller than the top-element of some queue, it cannot possibly be contained in that queue. The elements 8, 9 and 10 are in queue 1 and 2 with probability 1/2 each, and the elements 12 and 14 are in queues 1, 2 and 3 with probability 1/3 each. Element 5 is surely contained in queue 1, but we can treat this as a degenerate probability distribution rather than as a special case. Note what happens when element 7 is deleted: First, 8 has a chance of 1/2 of being the new top-element of queue 2. If it turns out that 8 is not the new top-element, then 9 gets the same chance, then 10. If all three elements are rejected, then element 12 is considered, getting a chance of 1/3 (because it could still be in three queues) and so on.

Since we are only interested in the ranks of top-elements over time, we can forget the removed elements and the concrete element values and arrive at representation (c), showing n balls ” representing top-elements and dots ” representing other elements. Equivalently, in (d) we list the sequence of dot-counts in between the balls, omitting the infinite number of dots to the right of the last ball.

We now represent the σ-MultiQueue as a Markov chain with states in n1 as in (d), borrowing language from (b) and (c) when useful. Since the state space is countably infinite, the role of the transition matrix is filled by an infinite family P of transition probabilities where P(dstart,dend) denotes the probability to transition from state dstartn1 to state dendn1. These probabilities are implicitly described below. We write d for a state (d,,dn1)n1 and ei=0i110ni1{0,1}n1 denotes the ith unit vector for i[n1]. We avoid special cases related to the last ball by defining d= and en=0.

A state dstart transitions to another state dend via a sequence of transitional states (d,i)n1×[n] in which one ball i[n] (numbered from left to right) is marked as the active ball.

  1. 1.

    Given state dstart, we sample iσ and obtain the transitional state (dstart,i).
    Interpretation: In terms of (c) we activate ball i and in terms of (b) we delete the top-element from queue Qi and look for a new one.

  2. 2.

    As long as we are in a transitional state (d,i), there are two cases:

    1. 2.1

      If di>0, then with probability (i1)/i we continue with transitional state (dei+ei1,i) and with probability 1/i the transition ends with state dend=dei.
      Interpretation: In terms of (c) the active ball decides to skip past the dot to the right of it, or consumes the dot and stops. In terms of (b), we reveal whether the next top-element candidate for Qi is contained in Qi; if it is, the candidate becomes the new top-element and we stop, otherwise we continue the search.

    2. 2.2

      If di=0, then we continue with transitional state (d,i+1).
      Interpretation: In terms of (c) the active ball overtakes another ball, thereby becoming ball i+1. In terms of (b), we update the ordering of the queues since the new top-element of Qi is now known to be larger than the top-element of queue Qi+1.

For clarity, we illustrate the possible transitions for a concrete state dstartn1 and resulting transition probabilities in Figure 4. We remark that the following analysis does not refer to the transition probabilities directly, but uses their implicit characterisation.

Figure 4: Possible states and transitional states reachable from dstart=(3,0,2) in a single state transition. The probabilities 116,316,516,716 on the outgoing edges of (3,0,2) assume the special case of the 2-MultiQueue. Taking the example dend=(3,1,0), the probability to transition from dstart to dend arises from the two corresponding paths as P(dstart,dend)=316·23·13+516·1·23·13.

We now state the main result of this section, which characterizes a stationary distribution of P. With this lemma, we can finally prove Theorem 1 and Corollary 2.

Theorem 5.

Let n and let σ be a distribution on [n] that satisfies (). The transition probabilities P admits the stationary distribution π given by

π=×i=1n1Geom(1in·σi),

where Geom(p) denotes the geometric distribution of the number of failed Bernoulli trials with success probability p before the first success, and × denotes the direct product of distributions.

In particular, the n1 components of dπ are independent random variables. We further make the following useful observation.

Observation 6.

For any dn1 and any i[n] we have π(d+ei)=π(d)·inσi.

Proof of Observation 6.

If i=n then ei=0 and σi=1 so the claim is trivial. Now assume i<n. For any dn1 we have

π(d)=i=1n1(1pi)dipi where pi=1in·σi.

Hence, π(d+ei)=π(d)·(1pi) and the claim follows. The following auxiliary lemma captures the main insight required in the proof of Theorem 5.

Lemma 7.

Let ν(d,i)0 be the probability that a transitional state (d,i)n1×[n] occurs when transitioning from state dstartπ according to P with σ satisfying (). Then,

ν(d,i)=π(d)·σi.

Proof of Lemma 7.

We prove ν(d,i)=π(d)·σi by induction. In the induction step we may assume that ν(d,i)=π(d)·σi holds whenever i<i or when i=i and d1++di1<d1++di1. In general, there are three ways in which a transitional state (d,i) might be reached:

  1. (i)

    The transition started with d=dstart and ball i was activated.

  2. (ii)

    Ball i has skipped a dot and we thus reached (d,i) from (dei1+ei,i).

  3. (iii)

    Ball i has just overtaken another ball and we thus reached (d,i) from (d,i1).

For i=1, consider a transitional state (d,1) where the first ball is active. Here, only (i) is possible since the first ball never skips a dot (transition ends with probability 1 in rule 2.1) and there is no ball to its left. The probability for (d,1) to occur is thus

ν(d,1)=π(d)σ1=π(d)σ1(recall that σi:=Priσ[i=i] and σi:=Priσ[ii]).

For i>1, there are two cases depending on whether di1>0, i.e., whether there is a dot in between ball i1 and ball i. If di1>0, then only (i) and (ii) are possible, so

ν(d,i) =π(d)σi+ν(dei1+ei,i)(11i)
=π(d)σi+π(dei1+ei)σi(11i) (Induction)
=π(d)σi+π(d)nσi1i1inσiσi(11i) (6)
=π(d)(σi+σi1)=π(d)σi.

If di1=0, then only (i) and (iii) are possible, so

ν(d,i) =π(d)σi+ν(d,i1)=ind.π(d)σi+π(d)σi1=π(d)σi.

With Lemma 7 in place, we can now prove Theorem 5.

Proof of Theorem 5.

Given a state dstartπ, we transition to a new state dend according to the transition probabilities P. To end in dend, we first need to reach the transitional state (dend+ei,i) for some i[n] and then decide to end the transition there. Note that we need (dend+ei,i) rather than (dend,i), since ending the transition (rule 2.1) reduces di by one. The probability to end in dend is therefore

Pr[dend=d] =Obs. 6i=1nν(d+ei,i)1i=Lem. 7i=1nπ(d+ei)σi1i
=Obs. 6i=1nπ(d)inσiσi1i=π(d)i=1n1n=π(d).

It follows that dend is again distributed according to π and π is a stationary distribution. Finally, we prove Theorem 1 and Corollary 2.

Proof of Theorem 1.

Let d(s)=(d(s),,dn1(s)) with di(s)=ri+1(s)ri(s)1. Then, (d(s))s is a Markov chain with transition probabilities P. Since we can reach (0,,0) from any state and vice versa, the Markov chain is irreducible. The Markov chain is aperiodic since (0,,0) can transition into itself (if ball n is activated and immediately stops). This implies that the stationary distribution π that we found is unique and that d(s) converges in distribution to dπ (see [13, Theorem 1.8.3]). Let δ(s)=(δ(s),,δn1(s)) with δi(s)=di(s)+1. Clearly, (δ(s))s converges in the same way, except that the geometric random variables are shifted. By definition, we have ri(s)=1+j=1i1δj(s) so the claimed distributional limit (r,,r) of (r(s),,r(s)) follows.

Proof of Corollary 2.

Theorem 1 states the ranks of the top-elements converge in distribution to (r1,,rn). The distribution for R follows from the fact that we select the queue to delete from according to σ and deleting an element with rank r yields a rank error of r1. Using the fact that 𝔼XGeom1(p)[X]=1/p, we have for the expected rank error

𝔼[R] =𝔼[ri1]=i=1nσij=1i1𝔼[δj]=j=1n1𝔼[δj]i=j+1nσi=j=1n1𝔼[δj](1σj)
=j=1n1nσjnσjj(1σj)=j=1n1σj(1σj)σjjn.

4 Application to the 𝒄-MultiQueue

In this section we apply our results on the general σ-MultiQueue to the c-MultiQueue with c>1. After checking in Lemma 8 that the corresponding σ satisfies (), we proceed to compute expected rank errors (Theorem 3) and derive a concentration bound (Theorem 9). This involves straightforward (though mildly tedious) calculations.

Lemma 8.

In the c-MultiQueue with c=c+ε>1 we have

σi=1(1in)c(1εin) for all i[n], and σ satisfies ().

Proof.

Recall that we sample c queues with probability 1ε and c+1 queues otherwise. We fail to select one of the first i queues only if none of them were sampled. Hence for i<n:

σi =1(1ε)(1in)cε(1in)c+1=1(1in)c(1ε+ε(1in))
=1(1in)c(1εin)>1(1in)=in.

The inequality uses that we have c2, or ε>0, or both.

We now prove Theorem 3, restated here for easier reference. See 3

Proof of Theorem 3.

We have just checked in Lemma 8 that σ satisfies () and computed σi=1(1in)c(1εin). We can therefore specialise the formula for the expected rank error from Corollary 2 by plugging in σ and simplifying, which yields

𝔼[R] =i=1n1(1σi)σiσiin=i=1n1(1in)c(1εin)1(1in)c(1εin)1(1in)c(1εin)in
=i=1n1(1in)c1(1εin)1(1in)c(1εin)1(1in)c1(1εin) (cancel 1in)
=i=1n1(in)c1(1ε+εin)1(in)c(1ε+εin)1(in)c1(1ε+εin) (substitute ini.)
=i=1n1fc(in). (using the definition of fc(x) given above.)

We are now ready to prove claim (i). Using that f(x)=x·1x²1x=x·(1+x)=x+x², we have

𝔼[R] =i=1n1f(in)=i=1n1(in+(in)²)=1ni=1n1i+1n²i=1n1i²
=n12+(n1)(2n1)6n=56n1+16n.

Similarly, we can prove (ii). First, we simplify fc(x) for c=1+ε with ε(0,1):

f1+ε(x) =(1ε+εx)·1x(1ε+εx)εεx=(1ε+εx)·(1x)(1+εx)ε(1x)
=(1ε+εx)·1+εxε=1εε+(2ε)x+εx².

We then get (omitting a simple calculation):

𝔼[R] =i=1n1f1+ε(in)=i=1n1(1εε+(2ε)in+ε(in)²)
=1εε(n1)+(2ε)n(n1)2n+ε(n1)n(2n1)6n²==(1εε6)n1ε+ε6n.

We now turn our attention to general c>1 again. Our goal is to approximate the sum by an integral. To bound the approximation error effectively, we will first show that fc is monotonic. For this let us examine the fractional term gc(x) occurring in fc(x):

gc(x) :=1xc(1ε+εx)1xc1(1ε+εx)=1+(xc1xc)(1ε+εx)1xc1(1ε+εx)
=1+xc1(1x)(1ε+εx)1xc1+εxc1(1x)=1+xc1(1x)(1ε+εx)(1x)i=0c2xi+εxc1(1x)
=1+1ε+εxi=1c1xi+ε. (1)

From (1) we can see that gc(x) does not have a singularity at x=1 and by setting gc(1)=fc(1)=1+1c1=cc1 both functions are continuous on [0,1]. We also see from (1) that gc(x) is increasing in x and decreasing in c (recall that c determines ε=cc). Because the other factor xc1(1ε+εx) of fc(x) is also increasing in x and decreasing in c, we conclude that fc(x) as a whole is increasing in x and decreasing in c. This makes the upper and lower sums bounding the integral of fc particularly simple:

i=1n1fc(in)=i=0n1fc(in)n01fc(x)𝑑xi=1nfc(in)=fc(1)+i=1n1fc(in)=cc1+i=1n1fc(in).

By rearranging we obtain (iii). We now turn to the cruder bound (iv). We begin with c{1}. In this case we have fc(x)=xc1·gc(x) where 1gc(x)cc1 for all x[0,1]. This gives:

1c=¹xc1𝑑x¹fc(x)𝑑x¹xc1cc1𝑑x=cc1¹xc1𝑑x=1c1.

Combining this with (iii) gives nccc1𝔼[R]nc1 when c{1}. When c we can use that fc(x) is decreasing in c and round conservatively to obtain the claimed result.

Theorem 9.

In the 2-MultiQueue444A similar analysis for c=1+ε is also possible., the highest rank error observed over a polynomial number of deletions is in 𝒪(nlogn) with high probability.

Proof.

We will use a tail bound by Janson [9, Theorem 2.1] on the sum of geometrically distributed random variables from. It reads

Pr[Xkμ]epμ(k1logk) for any k1,

where X is a sum of geometrically distributed random variables (with possibly differing success probabilities), p is the smallest success probability and μ=𝔼[X].

We apply this bound to X=r1, which has the required form by Theorem 1. It is easy to check that p=δn1=1n+1=Θ(1n) and

μ=𝔼[X]=i=1n11(1in)21(1in)2in=i=1n12in1in=n1+ni=1n11i=Θ(nlogn).

Since the rank error R clearly satisfies Rr1=X we have for k large enough

Pr[R>k·nlogn]Pr[X>k·nlogn]=eΘ(1nnlog(n)k)=nΘ(k).

By a union bound, the probability that we observe a rank error exceeding k·nlogn at some point during nc deletions is at most nc·nΘ(k). For large enough k, this probability is still small.

To give some intuition for how quickly the 2-MultiQueue converges to its stable state and for how close the observed ranks of top-elements are to their expectation we provide experimental data in Figure 5.

Figure 5: The convergence of the 2-MultiQueue with n=210 to its stable state. After s deletions, let ri(s) be the rank of queue i. The plot shows the observed ranks iri(s) for some values of s, as well as the expected ranks i𝔼[ri(0)] and i𝔼[ri()] in the initial state and the converged state.

5 Future Work

While we have fully analyzed the long-term behavior of the MultiQueue in the deletion-only setting, there are still open questions in the general setting. Specifically, our methods are not directly applicable when insertions of arbitrary elements can happen after deletions. We conjecture that the deletion-only setting represents the worst-case in the sense that the expected rank error cannot be made worse even by adversarial insertions. On the flip side, we conjecture that the expected rank error is never better than before the first deletion. Our reasoning is as follows: Inserting sufficiently large elements does not affect deletions and is equivalent to inserting before deleting. When inserting many small elements, the state drifts towards the state where no deletions happened. In summary, we expect the state of the MultiQueue always to be “between” the insertion-only and the deletion-only setting, and that our analysis yields accurate predictions after sufficiently many deletions regardless of previous operations.

Our analysis applies directly to applications that do insert new elements after the first deletion, such as heap sort and simple batch job scheduling. A much broader range of applications, including Dijkstra’s algorithm and discrete-event simulations, process elements in monotonous fashion, meaning that the elements deleted from the priority queue are monotonically increasing. When using a MultiQueue, newly inserted elements are unlikely to become top-elements, and we expect the state of the MultiQueue to stay “close” to the deletion-only setting.

Williams et al. [21] proposed the delay as an additional quality metric and stickiness as a way to increase throughput. The delay of an element e measures how many elements worse than e are deleted while e resides in the queue. Stickiness lets threads reuse the same queue for multiple consecutive operations. We believe that the delay can be analyzed directly with our approach and that the Markov chain can be adapted to handle stickiness as well.

In practice, it is relevant how fast the system stabilizes and converges to the postulated distributions of ranks or what rank errors are to be expected until then. Thus, analyzing the convergence speed is a natural next step.

Alistarh et al. [1] analyze the MultiQueue in concurrent settings where comparisons can become stale, meaning that after deciding which queue to delete from but before actually deleting from it, its top-element might change. We find it interesting whether our analysis can be adapted to this scenario as well.

References

  • [1] Dan Alistarh, Trevor Brown, Justin Kopinsky, Jerry Z. Li, and Giorgi Nadiradze. Distributionally Linearizable Data Structures. In SPAA, 2018. doi:10.1145/3210377.3210411.
  • [2] Dan Alistarh, Justin Kopinsky, Jerry Li, and Giorgi Nadiradze. The Power of Choice in Priority Scheduling. In PODC, 2017. doi:10.1145/3087801.3087810.
  • [3] Dan Alistarh, Justin Kopinsky, Jerry Li, and Nir Shavit. The SprayList: A scalable relaxed priority queue. In PPoPP, 2015. doi:10.1145/2688500.2688523.
  • [4] Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged M. Michael, and Martin Vechev. Laws of order: Expensive synchronization in concurrent algorithms cannot be eliminated. In POPL, 2011. doi:10.1145/1926385.1926442.
  • [5] Yossi Azar, Andrei Z. Broder, Anna R. Karlin, and Eli Upfal. Balanced Allocations. SICOMP, 29(1), 1999. doi:10.1137/S0097539795288490.
  • [6] Petra Berenbrink, Artur Czumaj, Angelika Steger, and Berthold Vöcking. Balanced Allocations: The Heavily Loaded Case. SICOMP, 35(6), 2006. doi:10.1137/S009753970444435X.
  • [7] Irina Calciu, Hammurabi Mendes, and Maurice Herlihy. The Adaptive Priority Queue with Elimination and Combining. In DC, 2014. doi:10.1007/978-3-662-45174-8_28.
  • [8] Faith Ellen, Danny Hendler, and Nir Shavit. On the Inherent Sequentiality of Concurrent Objects. SICOMP, 41(3), 2012. doi:10.1137/08072646X.
  • [9] Svante Janson. Tail bounds for sums of geometric and exponential variables. S&P L, 135, 2018. doi:10.1016/j.spl.2017.11.017.
  • [10] Richard M. Karp and Yanjun Zhang. Randomized parallel algorithms for backtrack search and branch-and-bound computation. JACM, 40(3), 1993. doi:10.1145/174130.174145.
  • [11] Jonatan Lindén and Bengt Jonsson. A Skiplist-Based Concurrent Priority Queue with Minimal Memory Contention. In OPODIS, 2013. doi:10.1007/978-3-319-03850-6_15.
  • [12] Michael Mitzenmacher, Andréa W. Richa, and Ramesh Sitaraman. The Power of Two Random Choices: A Survey of Techniques and Results, 2001. URL: http://www.eecs.harvard.edu/˜michaelm/postscripts/handbook2001.pdf.
  • [13] J. R. Norris. Markov Chains. Cambridge Series in Statistical and Probabilistic Mathematics. Cambridge university press, 1997. doi:10.1017/CBO9780511810633.
  • [14] Yuval Peres, Kunal Talwar, and Udi Wieder. Graphical balanced allocations and the (1 + β)-choice process. RS & A, 47(4), 2015. doi:10.1002/rsa.20558.
  • [15] Anastasiia Postnikova, Nikita Koval, Giorgi Nadiradze, and Dan Alistarh. Multi-queues can be state-of-the-art priority schedulers. In PPoPP, 2022. doi:10.1145/3503221.3508432.
  • [16] Hamza Rihani, Peter Sanders, and Roman Dementiev. MultiQueues: Simple Relaxed Concurrent Priority Queues. In SPAA, 2015. doi:10.1145/2755573.2755616.
  • [17] Adones Rukundo and Philippas Tsigas. TSLQueue: An Efficient Lock-Free Design for Priority Queues. In Euro-Par, 2021. doi:10.1007/978-3-030-85665-6_24.
  • [18] Konstantinos Sagonas and Kjell Winblad. The Contention Avoiding Concurrent Priority Queue. In LCPC, 2017. doi:10.1007/978-3-319-52709-3_23.
  • [19] N. Shavit and I. Lotan. Skiplist-based concurrent priority queues. In IPDPS, 2000. doi:10.1109/IPDPS.2000.845994.
  • [20] Stefan Walzer and Marvin Williams. A Simple yet Exact Analysis of the MultiQueue, 2025. doi:10.48550/arXiv.2410.08714.
  • [21] Marvin Williams, Peter Sanders, and Roman Dementiev. Engineering MultiQueues: Fast Relaxed Concurrent Priority Queues. In ESA, 2021. doi:10.4230/LIPIcs.ESA.2021.81.
  • [22] Martin Wimmer, Jakob Gruber, Jesper Larsson Träff, and Philippas Tsigas. The lock-free k-LSM relaxed priority queue. In PPoPP, 2015. doi:10.1145/2688500.2688547.
  • [23] Guozheng Zhang, Gilead Posluns, and Mark C. Jeffrey. Multi Bucket Queues: Efficient Concurrent Priority Scheduling. In SPAA, 2024. doi:10.1145/3626183.3659962.