Theory of computation Distributed algorithms \ccsdescTheory of computation Distributed computing models \ccsdescNetworks Network reliability \ccsdescNetworks Ring networks \CopyrightFabian Frei, Ran Gelles, Ahmed Ghazy, Alexandre Nolin CISPA Helmholtz Center for Information Security, [email protected]://orcid.org/0000-0002-1368-3205 Bar-Ilan University, [email protected]://orcid.org/0000-0003-3615-3239Partially supported by a grant from the United States-Israel Binational Science Foundation (BSF), Jerusalem, Israel, Grant No. 2020277. He would also like to thank the CISPA Helmholtz Center for Information Security for hosting him while part of this research was done. CISPA Helmholtz Center for Information Security, [email protected]://orcid.org/0009-0009-7414-5871 CISPA Helmholtz Center for Information Security, [email protected]://orcid.org/0000-0002-3952-0586
Content-Oblivious Leader Election on Rings
Abstract
In content-oblivious computation, nodes wish to compute a given task over an asynchronous network that suffers from an extremely harsh type of noise, which corrupts the content of all messages across all channels. In a recent work, Censor-Hillel, Cohen, Gelles, and Sela (Distributed Computing, 2023) showed how to perform arbitrary computations in a content-oblivious way in 2-edge connected networks but only if the network has a distinguished node (called root) to initiate the computation.
Our goal is to remove this assumption, which was conjectured to be necessary. Achieving this goal essentially reduces to performing a content-oblivious leader election since an elected leader can then serve as the root required to perform arbitrary content-oblivious computations. We focus on ring networks, which are the simplest 2-edge connected graphs. On oriented rings, we obtain a leader election algorithm with message complexity , where is the maximal assigned ID. As it turns out, this dependency on is inherent: we show a lower bound of messages for content-oblivious leader election algorithms. We also extend our results to non-oriented rings, where nodes cannot tell which channel leads to which neighbor. In this case, however, the algorithm does not terminate but only reaches quiescence.
keywords:
Fully Defective Networks, Noise Resilience, Leader Election, Ring Networks, Quiescent Computations1 Introduction
The field of distributed computing is rich with models hel** us understand different types of architectures and computational hardness by making different kinds of assumptions about how computations are carried out. A recent work by Censor-Hillel, Cohen, Gelles, and Sela [8] introduced a particularly weak computational model coined fully defective networks. This model considers an asynchronous network in which messages may be fully corrupted and thus not carry any information beyond their sheer existence. Algorithms designed for this model cannot rely in any way on possible contents of messages, and thus are named content-oblivious. Instead of relying on the content of messages or on their time of arrival (since arbitrary delays may occur in asynchronous networks), such algorithms depend solely on the order in which messages arrive from different neighbors.
The aforementioned work by Censor-Hillel et al. [8] showed that any computation possible in the asynchronous setting with reliable content-carrying messages can be simulated in the fully defective setting under two assumptions: that the network is 2-edge connected and that there is a distinguished leader (which they call the root node) in the network. While the same paper showed 2-edge connectivity to be essential for any kind of nontrivial computation in fully defective networks, the question of the necessity of a pre-existing leader was not settled. Censor-Hillel et al. conjectured that general computations in fully defective networks do indeed require the existence of such a pre-elected leader.
In this paper, we disprove this conjecture, at least for the most fundamental type of 2-edge connected topologies, namely, rings. We design a content-oblivious algorithm that successfully performs a leader election in oriented rings.
Theorem 1.1.
There is a quiescently terminating content-oblivious algorithm of message complexity that elects a leader in oriented rings of nodes with unique IDs.
Here, denotes the maximal ID assigned to a node in the network, and quiescent termination refers to the valuable property of our algorithm that nodes do not receive messages after termination. We discuss quiescent computations and the issue of composability in more detail in Section 1.1.
We further extend our result to the case where the ring is non-oriented, albeit under a weaker definition of computation. Instead of termination, we only require stabilization, which means that every node eventually settles on a decision (to be or not to be a leader, in our case) that is never revised again. However, the nodes might not know whether they have achieved their stable output already and remain ready to receive and potentially send messages forever. This potential is not actualized for a quiescently stabilizing algorithm, where all messaging activity ceases after finite time. Our algorithm not only elects a leader in such a manner but also orients the ring.
Theorem 1.2.
There is a quiescently stabilizing content-oblivious algorithm of message complexity that elects a leader and orients a non-oriented ring of nodes with unique IDs.
Both of our leader election algorithms, for oriented and non-oriented rings, have message complexity . The term is not very common in message complexities of algorithms.111Some algorithms depend on the IDs assigned to nodes. However, it is common for the complexity analysis to assume that all IDs are of length bits, making the dependence on the IDs implicit. Somewhat surprisingly, our analysis shows that this term is inherent to content-oblivious algorithms. We prove the following lower bound.
Theorem 1.3.
Any deterministic terminating content-oblivious algorithm for leader election in rings with unique IDs sends at least messages.
Note that this lower bound implies that the number of messages in a ring of size is unbounded— we can always increase the message complexity by assigning larger IDs, even when is a small constant.
1.1 Quiescence and Composability
As mentioned above, we concatenate our content-oblivious leader election algorithm (Theorem 1.1) with the root-dependent universal content-oblivious algorithm [8, Thm. 1] to obtain the following powerful corollary.
Corollary 1.4.
Assuming unique IDs, any asynchronous algorithm on rings can be simulated in a fully defective oriented ring.
However, some subtleties arise when concatenating algorithms in the content-oblivious setting. With reliable message content, each message could be tagged, indicating the algorithm it belongs to. However, when concatenating content-oblivious algorithms, messages sent by the first algorithm may be mistaken for ones sent by the second algorithm, and vice versa.
To make this composition work, we require two properties: (1) termination, i.e., nodes should have a distinct point in time where they end the first algorithm and switch to the second one, and (2) message-algorithm attribution, i.e., while a node executes an algorithm, it only ever receives messages generated by nodes while they were executing the same algorithm.
Our algorithm for oriented rings (Theorem 1.1) achieves correct message-algorithm attribution (when composed with the scheme of [8]) by combining two mechanisms. First, it features a quiescent termination. In particular, any node terminates eventually, and at that time no messages are in delivery towards that node anymore, nor will any message be sent to that node after its termination. Secondly, the nodes terminate in order, so that the leader is the last to terminate. This makes our algorithm easy to compose with the algorithm of [8], by replacing the act of termination with the act of switching to the second algorithm. The leader, which is the last to terminate the first algorithm, is the node that initiates the computation of the scheme in [8] (i.e., it acts as the root), and at the time it sends its first message, we are guaranteed that all other nodes have already switched to that algorithm.
As a matter of fact, quiescent termination could be relaxed when composing general algorithms: If we have a bound on the number of messages of the first algorithm that might reach a node after it transitions to the second algorithm, we could still concatenate any algorithm in an altered form where nodes send copies of each message, and process arriving messages in groups of messages as well. However, this clearly leads to an undesired -fold increase in the message complexity of the composed algorithm.
On the other hand, our algorithm for non-oriented rings (Theorem 1.2) does not terminate and cannot be composed with other algorithms. As mentioned above, we only require the algorithm to reach quiescence in this case.
1.2 Related Work
Leader election is a fundamental task that has been studied by the distributed computing community since the 1970s. Simple leader election algorithms for asynchronous rings were proposed by Le Lann [26] and by Chang and Roberts [10]. These algorithms employ messages to ensure that all nodes yield to the node with the maximal ID, which becomes the leader. Later work [24, 14, 27] improved this down to messages. This complexity is tight in asynchronous rings [7, 21]. In synchronous rings, leader election can be performed by communicating only messages [21, 17].
For the case of anonymous rings, i.e., with identical nodes without IDs, Angluin [2] proved that symmetry cannot be broken, and thus no leader election algorithm exists. Attiya, Snir, and Warmuth [5] examined anonymous asynchronous rings further and characterized computable tasks. In particular, they showed that many tasks, including ring orientation, require communicating messages. Attiya and Snir [4] gave tight bounds on the complexities of randomized algorithms. Relaxed notions of ring orientation were given by Attiya, Snir, and Warmuth [5], where the orientation is either consistent with all nodes or alternating between any two neighbors, and by Syrotiuk and Pachel [29], where nodes determine whether a majority agrees on the same orientation or not. Orienting a ring and leader election when is known to the nodes is presented by Flocchini et al. [19].
The question of termination in anonymous rings was explored by Itai and Rodeh [25], who discovered that a network cannot compute its size by a terminating algorithm. As a consequence, a leader election algorithm that terminates is impossible, too, since it is trivial to learn once a leader is given. On the other hand, if the nodes know or even an upper bound on , a randomized leader election algorithm that terminates exists [25]. Afek and Matias [1] give various leader election algorithms that trade off knowledge, termination, and number of sent messages.
Censor-Hillel, Gelles, and Haeupler [9] designed a content-oblivious BFS algorithm as a pre-processing step for their distributed interactive coding scheme [22]. Building on that idea, Censor-Hillel et al. [8] introduced the concept of content-oblivious computation and proved that general computations are only possible over 2-edge connected networks. They designed a compiler that converts any asynchronous algorithm into a content-oblivious one, assuming a pre-existing leader. They also gave explicit algorithms for content-oblivious DFS, ear decomposition, and (generalized) Hamiltonian cycle construction.
Computation with fully corrupted messages has been comparatively more studied in the synchronous setting, where the presence or absence of a message in a given round can still be used to send one bit of information [28]. A notable example is the Bee** model, introduced by Cornejo and Kuhn [11], in which each message sent by a node is received by all its neighbors, and nodes can only distinguish between receiving no message and receiving at least one message. Among other problems, leader election has been studied in this setting in a sequence of works [23, 20, 15, 12]. Similar to the fully defective setting, compilers were devised for transforming algorithms with stronger communication primitives into algorithms for the Bee** model [16, 3, 13].
1.3 Organization
Section 2 formally introduces the content-oblivious setting and some other notions and notations. In Section 3 we give our leader election algorithm in oriented rings, deferring some proofs to Appendix A. Section 4 discusses non-oriented rings. Our lower bound on the number of messages sent by a content-oblivious leader election algorithm is presented in Section 5. In Appendix B we discuss anonymous rings and design a randomized quiescently stabilizing algorithm with a high probability of success for both electing a leader and orienting a non-oriented ring. Section 6 concludes our work with a brief summary and suggests a few follow-up questions.
2 Preliminaries
Notations.
For an integer , we denote the set by . All logarithms are binary. For a variable and a node , we let denote the value the variable holds at the node . By the term with high probability we mean a probability of at least .
The content-oblivious computation model.
Consider a distributed network with nodes. We usually assume that each node is assigned a unique ID (unless otherwise stated), usually denoted by . We denote the largest ID assigned to a node in the network by , that is, , and by the node possessing this ID. Apart from the IDs, the nodes are identical. Algorithms are uniform by default, i.e., the nodes neither know the size of the network nor any bound on it; for non-uniform algorithms, the nodes may be equipped with such knowledge.
In this paper, we consider rings, i.e., connected graphs where all nodes have degree 2. Neighboring nodes communicate by sending messages to each other. We assume that all messages are subject to corruption: the content of any message is completely erased by noise, resulting in an empty message of length 0, which we call a pulse. Computations that ignore any potential content of a message and thus work only with pulses are called content-oblivious.
Further, the network is asynchronous: the time it takes a pulse to travel through a channel and arrive at its end is unpredictable; the delays are unbounded but always finite. Pulses cannot be dropped or injected by the channel. In such an asynchronous network, the nodes possess neither a common clock nor any notion of time, and they are assumed to be event-driven. This means that a node may act once right in the beginning of the computation and from then on only upon receiving a pulse. As a function of its own ID, the previously received pulses, and possibly its own source of randomness, it can then change its state and, for each connected channel, send any number of pulses. Most of our algorithms are deterministic, except for the ones in Appendix B, where we consider a special case where nodes do not have IDs and use randomness in order to generate them. We say that an algorithm terminates (sometimes also referred to as process termination, explicit termination, or termination detection in the literature) if for each node there is a time at which it has decided on an output and entered a terminating state. Once in a terminating state, a node ignores all incoming pulses and does not send any new ones. We say that an algorithm has quiescent termination if at the time the last node terminates it is guaranteed that no pulses are still in transit. An algorithm’s message complexity is the total number of messages (pulses) it sends during a worst-case computation until all nodes have terminated or until the network has reached quiescence.
Ring’s orientation.
In a ring, each node communicates with its two neighbors via and . Consider a pulse re-sent from by every node receiving it. If such a pulse passes through all edges (i.e., is never reflected by a node with misaligned ports), we call the ring oriented and the pulse clockwise (). of each node is then called its port, leading to its neighbor. Counterclockwise () is defined analogously via . Note that pulses are sent from ports but arrive at ports, and vice versa.
However, rings may not be oriented to begin with. In a non-oriented ring, there is no guarantee that and of a node are aligned with a clockwise or counterclockwise walk on the ring. See Fig. 1 for a demonstration. Algorithms for non-oriented rings must work correctly for all assignments of the nodes’ ports. In this case the / direction is local per node, and we will use the notion of and to avoid confusion.
3 Leader Election in an Oriented Ring
In this section, we consider the problem of electing a leader in an oriented ring of size unknown to the nodes. Recall that in the leader election task, nodes are required to terminate with an output: or , where a single node outputs , while all other nodes must output . We design an algorithm to elect a leader that features quiescent termination and prove the following. See 1.1
For the algorithms in this section, we will use the following methods for sending and receiving pulses. The method send sends one pulse over the channel. The method recv checks whether pulses are waiting in the incoming queue. If no pulse is in the queue, the method returns 0. Otherwise, it consumes a single pulse from the queue and returns 1. The methods send and recv are the analogous versions. Moreover, for each node , we introduce counters and for the total number of received and sent pulses, respectively. Likewise, we introduce and for pulses. We assume each of the four methods above updates those counters with every received or sent pulse. More precisely, every node has variables and initially set to . Every time recv processes a pulse from the queue of incoming pulses or send sends a pulse, the counters increase according to and , respectively.
3.1 Warm-up: Leader Election Without Termination
To demonstrate some of the main ideas of our algorithm, let us begin with a simple quiescently stabilizing algorithm that uses only clockwise pulses and elects a leader in an oriented ring. We emphasize that this algorithm is non-terminating. In this algorithm (see Algorithm 1), each node starts by sending one pulse and then relays every received pulse in the same direction, except for the single time when the number of received pulses reaches its own ID. In this event, the node does not relay this one pulse and assigns itself the state of , at least temporarily. However, any pulses received after this are relayed again, and revert the node to being a .
The main intuition behind this algorithm is that each node will eventually have sent and received exactly pulses: pulses are being generated at the initialization, and these pulses keep circulating in the ring, increasing the counter of received pulses until some node has received as many pulses as its ID. At this point, the node removes one pulse, and we are left with pulses in circulation. Except for the node with , every node will receive more pulses than its ID, ensuring it eventually becomes a follower. This continues until all nodes, except the one with , have removed a single pulse from the circulation and declared themselves followers. The last remaining pulse keeps circulating until all nodes have received exactly pulses. As soon as the last node receives its -th pulse, it sets itself as a leader and removes the last remaining pulse. Since the network no longer contains any pulse, which we call quiescence, the states of the event-driven nodes remain unchanged as well. Note, however, that nodes do not terminate since they do not know whether the ring has achieved this quiescent state or not, i.e., whether some pulses are still in transit.
Even though Algorithm 1 does not terminate, analyzing it will help us design our terminating leader election algorithm (Algorithm 2) later on. We begin by proving some key invariants of Algorithm 1, which are also used to show its correctness.
Lemma 3.1.
For every node running Algorithm 1, the following invariants hold at the end of each iteration of the main loop:
-
1.
If , then , i.e., has sent exactly one pulse more than it has received.
-
2.
If , then , i.e., has sent exactly as many pulses as it has received.
Proof 3.2.
Fix an arbitrary node . For a variable and , we write to denote the value of for this node at the end of the -th iteration. We also use to denote the initial value of before the first iteration. We prove the statement by induction over . Before the first iteration, exactly one initial pulse is sent, and . Due to , (2) is vacuously true, and (1) holds too since , proving the induction basis.
Assume now that the invariants hold true at the beginning of some iteration or, equivalently, at the end of iteration . We proceed to show that they hold at the end of iteration again. If no pulse is received during iteration , then the variables in question remain unchanged, and the invariants still hold after the iteration. If a pulse is received, however, there are three cases:
-
1.
If , then , and we need to prove the first invariant for iteration . Since the condition on 4 is not met, a pulse is sent, and we get , where the second equality follows from the first invariant for iteration . Thus, the invariants still hold.
-
2.
If , then . Thus, in iteration , by the condition on 4, no pulses are sent, so , where the second equality is due to the first invariant for iteration . Thus, we have and , and the invariants hold.
-
3.
If , we have . The condition on 4 is not met in iteration , and a pulse is relayed. We thus have , with the second equality again due to the second invariant for iteration .
Lemma 3.3.
Let be the node with . If at some point, then holds for every node at this point. That is, is the last node to satisfy .
Proof 3.4.
Consider the iteration where holds. Assume towards contradiction that the statement does not hold, and let be the closest predecessor222i.e., along the path of the network. of for which . By Item 1, . Denoting the intermediate nodes by , by Item 2, we have for all .
As the number of pulses sent by a node upper bounds the number of pulses its neighbor has received, we have the following inequality.
Since and , the above inequality implies , which is a contradiction due to the uniqueness of the largest ID and . Therefore, is the last node meeting the condition with .
We now show that quiescence has been reached when holds for all nodes.
Lemma 3.5.
If holds at every node , then the network is in quiescence.
Proof 3.6.
By Item 2, we get that holds for all ; hence, the total number of sent pulses is equal to the total number of received pulses. In particular, no pulses are in transit (sent but not received).
In fact, the converse is also true; that is, a necessary condition for quiescence is that holds at every node and becomes a relay.
Lemma 3.7.
If the network is in quiescence, then holds at every node .
Proof 3.8.
If there is quiescence, then .
Corollary 3.9.
There is quiescence at some point of time if and only if each node has at that point of time.
Proof 3.10.
The corollary follows directly from Lemmas 3.5 and 3.7.
Another equivalent statement to the ones in Corollary 3.9 is that every node has sent and received exactly pulses.
Lemma 3.11.
In any execution of Algorithm 1, at any point of time, the following statements are equivalent:
-
1.
The network is in quiescence,
-
2.
, and
-
3.
.
Proof 3.12.
The first two statements are equivalent by Corollary 3.9.
Now, assuming holds for every , then so does . Conversely, assume . By Lemma 3.3, the node with the largest ID is the last to satisfy that inequality. After the iteration where this occurs for the first time, we have
By the first equivalence, there is quiescence, and no more pulses are sent or received. Any pulses that have been sent by a node have been received by its neighbor , that is, over all edges , it holds that
Also, by Item 2, every node has As the network forms a ring, combining those equations yields that holds for every .
Given the above properties, we are ready to prove that certain interesting events occur in every execution of Algorithm 1.
First, we show that the inequality is eventually satisfied by every . Due to the equivalences given by Lemma 3.11, this leads to a setting where quiescence is achieved, and every node has sent and received exactly pulses.
Lemma 3.13.
In any execution of Algorithm 1, for every node , there is some iteration, where holds.
Proof 3.14.
Let us track the evolution through time of , the set of nodes that have not met the condition yet; that is, at every point of time, for all , .
Initially, contains all nodes, each of which are removed upon meeting the condition. Since a removed node never enters again, is monotonically decreasing.
Consider the point of time where reaches a minimum, so remains fixed. If , then there is nothing to prove, so assume . At that time, maintain values for every .
By Item 1, for all , we have that always holds. Also, from that point on, for every , we have by Item 2.
The number of pulses in transit333Including pulses that are in some node’s queue, but were not processed yet. at any given time is the difference between the total number of sent and received pulses across all nodes. Therefore, since , there are still pulses in the network. Since the nodes outside act as relays, they maintain the number of pulses in transit and, in particular, never remove a pulse from the network. Eventually, some node must receive a pulse, which decreases the difference by one. If , then is removed from , and decreases beyond its minimum, a contradiction. Otherwise, forwards a pulse and the number of pulses in transit remains , so we can re-apply this argument. At some point, reaches for some . Thus, holds for , and is removed from , again, a contradiction.
A result of Lemma 3.13, is that, eventually, all nodes send and receive exactly pulses, and no further activity occurs on the network.
Corollary 3.15.
In any execution of Algorithm 1, at some point, every node has sent and received exactly pulses, and the network reached quiescence.
Proof 3.16.
By Lemma 3.13, there is an iteration, after which holds for all nodes . The statement then follows directly from Lemma 3.11.
We also have the following trivial upper bound as a direct corollary.
Corollary 3.17.
In any execution of Algorithm 1, for every node , at every point of time .
Proof 3.18.
Immediate from Corollary 3.15 and the monotonicity of , which is initially .
3.2 Leader Election With Quiescent Termination
Although Algorithm 1 is a quiescently stabilizing algorithm for leader election, more ideas are needed in order to achieve this with quiescent termination. The main idea is to utilize the channel to notify all nodes when the leader is elected. The immediate approach would be to leverage the event , which signifies the successful election once it happens at the node with maximal ID. However, this is impossible, since the same event also occurs for every other node before the election process has finished.
To be able to detect termination, we require an event that occurs uniquely for the leader, and never for other nodes. If we managed to run Algorithm 1 over the channel after a full execution of the same algorithm over the channel, then, by symmetry, all nodes would eventually receive many pulses. In this scenario, the event would, in fact, be unique to the node with the largest ID. Indeed, an initial full execution of Algorithm 1 over the channel guarantees that all other nodes have prior to exchanging pulses, so the above event occurs uniquely at the leader and could be used as the trigger for termination.
The main remaining difficulty is that we cannot start the algorithm after the one is done since neither the leader nor any other node can infer that the algorithm has stabilized purely from the number of pulses received. We overcome this obstacle by running both algorithms in parallel, ensuring that the one lags behind the one. By subtly prioritizing the execution of the algorithm over that of the one, we enforce that once occurs for some node, we already have . Then, the only node satisfying is the elected leader. It is the uniqueness of all IDs, crucially including , that enables this approach.
The complete algorithm with quiescent termination is given in Algorithm 2. It is composed of two instances of Algorithm 1: one over the channel (3 to 8) and one over the channel (10 to 16). The instance starts, as before, upon initialization, while the instance starts at node once it reaches the event in the instance. This guarantees that the instance lags behind the one. Finally, 18 to 21 identify the event that uniquely occurs at the leader. At that point of time, all the nodes have and set to , and the leader is the last node for which this event occurs. This triggers the termination process: the leader sends a single pulse. Any node receiving this extra pulse sees, for the first time, , forwards the pulse and terminates (22). The extra pulse is forwarded until it returns to the leader, causing it to terminate without forwarding the pulse. The analysis of Algorithm 2 is deferred to Appendix A due to the space constraints.
4 Leader Election in Non-Oriented Rings
A natural follow-up question to the above leader election algorithm in oriented rings is whether the same holds for non-oriented rings. In this setting, nodes do not possess a predefined channel and channel anymore. Instead, they have two ports, and , connecting them to their two neighbors in an arbitrary order.
The straightforward approach would be to first orient the ring with a quiescently terminating algorithm and then use our leader election algorithm from Section 3. Since a ring orientation is easily computable once a leader has been elected with quiescent termination, orientation and leader election are essentially equivalent tasks from the perspective of quiescently terminating algorithms.
In this section, we instead present a quiescently stabilizing algorithm for non-oriented rings, which both elects a leader and orients the ring. Recall that the difference from quiescent termination is that the nodes do not need to terminate explicitly; it suffices for all pulse activity to cease with the correctly computed output still present. Recall our main theorem for this part.
See 1.2
We emphasize again that this algorithm does not terminate in the usual sense. Instead, its success is defined as reaching quiescence while guaranteeing that at that time only a single node has set its internal state to , while all other nodes have set their state to . Additionally, we require that nodes achieve a consistent ring orientation as follows: each node has to label exactly one of its two ports as the port leading to the neighbor such that starting at some node and repeatedly moving to node connected to port lets us pass through all edges in the ring.
For ease of exposure, we first present an algorithm of slightly worse complexity but whose analysis is almost fully captured by results from earlier sections. We then improve its complexity by proving an additional property about Algorithm 1, our main building block for our algorithm for non-oriented rings (Algorithm 3). Namely, we show that executing Algorithm 1 on a ring with non-unique IDs essentially achieves the same guarantees as when used on a ring with unique IDs (Lemma 4.3). This observation allows us to halve the complexity of Algorithm 3, as we shall see, and also has implications for solving the same tasks on anonymous rings with access to randomness. As this extension to anonymous rings is a minor effort and follows from standard techniques, we defer it to Appendix B.
Algorithm overview.
At a high level, Algorithm 3 consists of two parallels executions of Algorithm 1, each one using each channel in the ring in a single direction. For an intuition of how that is possible, consider a setting where the network has a single pulse in transit. Suppose that all nodes execute the same algorithm that sends a pulse on whenever one is received on , and vice versa. Forwarding the pulse in this manner has it travel the entire ring, since every time a pulse is received by a given node from one of its neighbors, it is sent to its other neighbor. If adding another pulse going in the other direction to the network, the two pulses independently travel around the ring in opposite directions. The nodes can thus effectively run two algorithms in parallel without them interfering with one another, as long as one only works with clockwise pulses and the other with counterclockwise pulses. As Algorithm 1 only uses pulses going in one direction, it satisfies this requirement. The major caveat is that the nodes cannot be certain which of the two algorithms they execute is working with clockwise pulses and which is working with counterclockwise pulses.
Our algorithm has essentially two parts: one in which the node reacts to pulses and possibly forwards them (Lines 5 to 7), and one in which it computes its output depending on the number of pulses it received from each port (Lines 8 to 16). From the point of view of analyzing how many pulses are eventually sent in the network, only the first part is relevant. It is the part that simulates two executions of Algorithm 1. For the nodes to settle on a consistent orientation of the ring in the second part, we break symmetry between the two options by having strictly more pulses sent in one orientation of the ring than in the other.
We distinguish the two parallel executions of Algorithm 1 by having each node pick two distinct virtual IDs for itself, and (2). affects how behaves regarding pulses received from its , and symmetrically for and . While nodes do not know which of their two virtual IDs is used in the clockwise or counterclockwise execution of Algorithm 1, they use a distinct ID in both executions. Eventually, in each direction, the number of pulses received by each node stabilizes to the largest ID in that direction. The choice of IDs ensures that the two parallel executions have distinct largest IDs, so eventually all nodes see strictly more pulses being sent in one direction than the other. This allows nodes to agree on a common orientation of the ring, and elect as leader the node who was the source of the largest ID.
The nodes use the following methods for sending and receiving pulses. Let .
-
1.
send: sends a pulse through ,
-
2.
recv: check whether a pulse is waiting in the incoming queue of . If not, return 0. Otherwise, consume a single pulse from the queue and return 1.
Proposition 4.1.
Algorithm 3 elects a leader and consistently orients the ring in pulses. It achieves quiescence but does not terminate.
Proof 4.2.
Consider , the node of largest ID. We define as clockwise the direction of a pulse sent from ’s and forwarded by all other nodes (i.e., sent from after arriving at ). We call the ports sending such a pulse clockwise, and those receiving it counterclockwise. We show the our algorithm elects as a leader and all nodes declare the correct port as clockwise.
We show that the network eventually achieves quiescence and all nodes receive the same number of clockwise and counterclockwise pulses. Let us argue this for clockwise pulses; the property for counterclockwise pulses will follow by symmetry. For every node whose connects it to its clockwise neighbor, let us rename send to send and recv to recv in its code. Let us also define for such nodes. For the other nodes, which are connected to their clockwise neighbors through , rename send to send and recv to recv in their code, and let . We emphasize that this renaming is done purely for our analysis and is not an operation performed by the nodes, which are oblivious to what the clockwise direction is. Consider an execution of Algorithm 3. Whenever the scheduler delivers a clockwise pulse, this pulse is read by a recv method, and if forwarded (which depends on ), it is re-sent by a send method, according to our renaming. Other methods are never activated by clockwise pulses and never emit a clockwise pulse. As such, Algorithm 3 executes the exact same code on clockwise pulses as Algorithm 1 and thus has the same guarantees as Algorithm 1 regarding clockwise pulses. By Corollary 3.15, this means that we achieve quiescence for clockwise pulses, with all nodes eventually having sent and received exactly the same number of clockwise pulses. The same holds symmetrically for pulses counterclockwise pulses per node, where is defined similarly to .
Since picks as identifiers and for the two directions, we have and . Hence, all nodes have sent and received clockwise pulses and counterclockwise pulses. This yields a bound of pulses, ensuring a consistent orientation according to the test on 13.
Improving the message complexity.
We now show how to improve the complexity of Algorithm 3 to . Since nodes send pulses according to their IDs, 2 effectively doubles the number of pulses sent by the algorithm. To avoid this doubling, one can generate the two IDs in a different manner; for instance, , and . However, this leads to assigning the same ID to multiple nodes. We argue that Algorithm 3 works correctly even when IDs are not unique as long as the largest clockwise and counterclockwise IDs are different. To that goal, we need to re-analyze Algorithm 1 in such case, which we do in the next two technical lemmas.
Lemma 4.3.
Corollary 3.15 still holds if nodes run Algorithm 1 with non-unique IDs. This includes the case in which multiple nodes have .
Note that Lemma 4.3 is about Algorithm 1, the implicit main subroutine of Algorithm 3, not Algorithm 3 itself. Most elements of the proof of Corollary 3.15 make no reference to the node of largest . Most importantly, the invariants of Lemma 3.1 (that while , and once ) are consequences of how each node reacts to the pulses it receives, and changing the distribution of s does not change that. Lemma 3.3, however, makes an explicit reference to a node of largest , which requires us to change the argument somewhat. Lemma 4.4, which we shall now prove, generalizes Lemma 3.3 to the setting with non-unique s.
Lemma 4.4.
Consider the set of nodes of largest , . In Algorithm 1, if for all at some point, then holds for every node at this point. That is, one of the nodes in is the last node to satisfy .
Proof 4.5.
Let be the number of nodes that hold . Denote these nodes , ordered clockwise from an arbitrary one of them. Let us identify for ease of notation. For each , let be the number of consecutive nodes with preceding in the ring. For each , let be the node counterclockwise hops from in the ring. See Figure 2 for an illustration.
We show that if holds at , then it also holds at all , . Since every node has a node of largest in its clockwise direction later in the ring, this implies that when holds at all , it also holds at every node .
Consider s.t. . Suppose , as otherwise the result is trivial. Let . For each , we show that implies . As the base case holds, we get our result by induction.
Let and suppose . Since , we have that . Since , by Lemma 3.1, it needs to hold that . Therefore, .
Proof 4.6 (Proof of Lemma 4.3).
Let us review the proof of Corollary 3.15, and see which elements of it could be affected by multiple nodes having the same . Let be the set of nodes of largest .
As already stated, the invariants of Lemma 3.1 still hold, and arguments relying on Lemma 3.3 must be amended to rely on Lemma 4.4 instead. Lemmas 3.7, 3.5 and 3.9, about how the network is in quiescence if and only if each node has received (and, by Lemma 3.1, also sent) at least pulses, are immediate consequences of Lemma 3.1, and hence still hold.
We now get to Lemmas 3.11 and 3.13, which are two lemmas from which Corollary 3.15 follows most directly. Lemma 3.11 shows equivalences between three properties: quiescence, that at each , and that at each . Again, the arguments still hold if s are not unique: the connection between quiescence and all nodes satisfying was shown in Corollary 3.9; while some node has received less than pulses, the network is not in quiescence; for all nodes in to have received pulses, other nodes in the network need to have sent this many pulses, which implies they have also received pulses.
Lemma 3.13 shows that the network cannot permanently remain in a state in which some nodes have . The argument again does not rely on the uniqueness of the s, and only uses that if some non-empty set of nodes satisfies for each , then since for those nodes (Lemma 3.1) the network has pulses still in transit. These pulses must eventually reach nodes in , increase the number of received pulses of nodes in it, and eventually to the point that for a node in , .
Put together, the whole argument still holds with non-unique s.
The proof of our second main theorem is a corollary of the above.
Proof 4.7 (Proof of Theorem 1.2).
Let us modify Algorithm 3 as follows:
-
•
In 2, we set as s , and .
Similar to the argument in the proof of Proposition 4.1, this amounts to running two parallel instances of Algorithm 1 over each channel. As in that proof, consider the maximal clockwise and counterclockwise IDs, and . From Lemma 4.3, we know that the number of clockwise pulses sent and received by each node eventually stabilizes at , and similarly stabilizes at for the counterclockwise direction. This results in a single leader being elected and a consistent orientation as before. The upper bound of follows from pulses being exchanged in one direction, and in the other.
5 Lower Bound On Message Complexity in Content-Oblivious Rings
In this section, we show that the dependency of the message complexity of our algorithms on is natural and inevitable by providing a lower bound showing that the number of pulses sent increases indefinitely with the number of available IDs.
Theorem 5.1.
Let and be arbitrary positive integers, . If distinct IDs are assignable to the nodes of the ring, at least pulses are sent by any leader election algorithm for some assignment of IDs. In particular, an unbounded number of pulses is sent for an infinite supply of IDs even on rings with just a single node.
The proof of this theorem makes use of the following definition.
Definition 5.2 (Solitude pattern).
Consider a ring with a single node (), and fix a specific algorithm. Assume a scheduler that delivers pulses one by one, kee** the order in which they were sent (breaking ties by prioritizing pulses). Define the solitude pattern as the sequence of incoming pulses observed by the node, encoded as a binary string where and encode and pulses, respectively. We denote the solitude pattern of a node with by .
Besides this crucial definition, we make use of the following lemma telling us that each ID has its own, unique solitude pattern. Essentially, the proof relies on matching all possible pairs of IDs against each other in a ring of two nodes. If any two IDs had the same solitude pattern, they would send and receive pulses in this ring () exactly as they would in solitude (). Thus, in one of these execution they give an invalid output.
Lemma 5.3.
For any uniform content-oblivious leader election algorithm, each solitude pattern is unique. In other words, for any pair of distinct IDs , we have .
Proof 5.4.
Fix a content-oblivious leader election algorithm on uniform rings. Seeking contradiction, assume that two nodes with distinct IDs, , have the same solitude pattern, . Note that each of these nodes outputs when run in isolation ().
Consider a ring with nodes, which are assigned the IDs and , respectively. Assume a scheduler behaving the same way as in the definition of a solitude pattern for each node individually. That is, pulses arrive one by one in the order they were sent out. Moreover, we assume that the same delay is applied to all pulses. Since the two nodes’ solitude patterns are identical, and the scheduler maintains order, each node will receive (and thus generate) exactly its solitude pattern. Indeed, since , both nodes send their first pulse in the same direction, and hence both receive it from the same direction as they would when alone and then send their next pulse accordingly; thus both receive and send exactly the pattern . This means that both nodes output as they must in their solitude situation. This contradicts the guarantees of the leader election task.
Having established that each ID has its own unique solitude pattern, a lower bound arises from properties of binary strings, namely the length required to avoid repeating patterns. We begin with the following simple property following from the pigeon-hole principle.
Lemma 5.5.
For any , any set of distinct binary strings contains strings sharing a common prefix of length at least .
Proof 5.6.
Let and be positive integers. There are only distinct binary strings shorter than . Therefore, in a set of distinct binary strings at least of them have length at least , implying that they contain a prefix string of length . There are only distinct binary prefixes of length , thus the pigeon-hole principle implies that at least one prefix of length is shared by at least of the strings in the set.
After deducing another corollary, we are ready to prove the lower bound of Theorem 5.1.
Corollary 5.7.
For any integers , any set of distinct binary strings contains strings sharing a common prefix of length at least .
Proof 5.8.
Apply Lemma 5.5 with the given and . Note that the given set is large enough since .
Proof 5.9 (Proof of Theorem 5.1).
Assume that we have a uniform leader election algorithm, a ring with nodes, and at least assignable IDs for any positive integers . Due to Lemma 5.3 we know that each ID has its own unique solitude pattern, which is just a binary string. By Corollary 5.7, there are at least IDs whose solitude patterns share a common prefix of length . Assume a scheduler that behaves as described in Lemma 5.3, for all nodes. It follows that all nodes send and receive pulses in exactly the same way as in their respective solitude situations for the first time steps, sending one pulse in each time step. Consequently, at least pulses are sent in total, proving the first part of the theorem. The last statement in the theorem follows for an infinite set of assignable IDs because grows indefinitely with increasing , even for .
Theorem 1.3 is then an immediate corollary of the above since the number of distinct IDs is bounded by . This lower bound complements the upper bound of Theorem 1.1 and proves that the term is not an artifact of our analysis or algorithm design but, rather, an inherent property of the problem in this setting.
6 Conclusion and Open Questions
As our main result, we have presented a quiescently terminating algorithm for leader election in oriented rings with unique IDs that communicates pulses. This implies that any content-oblivious computation can be performed on rings without assuming a pre-existing leader. We have also provided a lower bound showing that the message complexity depending on is not a fluke but inherent to the problem.
An immediate candidate for future work is to extend our results from rings to general networks, i.e., to design a content-oblivious leader election algorithm in arbitrary 2-edge connected networks or, alternatively, prove this task impossible. Considering non-oriented rings may be useful towards that goal since there is no sense of direction in general networks. Our content-oblivious leader election for non-oriented rings does not terminate, and we conjecture that this is inherent to the model. It remains as an open task for future work to prove this or find a terminating algorithm.
References
- [1] Y. Afek and Y. Matias. Elections in anonymous networks. Information and Computation, 113(2):312–330, 1994.
- [2] Dana Angluin. Local and global properties in networks of processors (extended abstract). In Proceedings of the Twelfth Annual ACM Symposium on Theory of Computing, STOC ’80, pages 82–93, New York, NY, USA, 1980. ACM.
- [3] Yagel Ashkenazi, Ran Gelles, and Amir Leshem. Noisy bee** networks. Information and Computation, 289(A):104925, 2022.
- [4] Hagit Attiya and Marc Snir. Better computing on the anonymous ring. Journal of Algorithms, 12(2):204–238, 1991.
- [5] Hagit Attiya, Marc Snir, and Manfred K. Warmuth. Computing on an anonymous ring. J. ACM, 35(4):845–875, oct 1988.
- [6] F Thomas Bruss and Colm Art O’cinneide. On the maximum and its uniqueness for geometric random samples. Journal of applied probability, 27(3):598–610, 1990.
- [7] James E. Burns. A formal model for message passing systems. Technical report, Computer Science Dept., Indiana Univ., Bloomington, Ind., 1980. TR91.
- [8] Keren Censor-Hillel, Shir Cohen, Ran Gelles, and Gal Sela. Distributed computations in fully-defective networks. Distributed Computing, 36(4):501–528, 2023.
- [9] Keren Censor-Hillel, Ran Gelles, and Bernhard Haeupler. Making asynchronous distributed computations robust to noise. Distributed Computing, 32(5):405–421, Oct 2019.
- [10] Ernest Chang and Rosemary Roberts. An improved algorithm for decentralized extrema-finding in circular configurations of processes. Commun. ACM, 22(5):281–283, may 1979.
- [11] Alejandro Cornejo and Fabian Kuhn. Deploying wireless networks with beeps. In Distributed Computing, 24th International Symposium, DISC 2010, volume 6343 of LNCS, pages 148–162, 2010, Cambridge, MA, USA, September 13–15, 2010. Proceedings, 2010. Springer.
- [12] Artur Czumaj and Peter Davies. Leader election in multi-hop radio networks. Theoretical Computer Science, 792:2–11, 2019.
- [13] Peter Davies. Optimal message-passing with noisy beeps. In Proceedings of the 2023 ACM Symposium on Principles of Distributed Computing, PODC, pages 300–309, 2023, Orlando, FL, USA, June 19–23, 2023, 2023. ACM.
- [14] Danny Dolev, Maria Klawe, and Michael Rodeh. An unidirectional distributed algorithm for extrema finding in a circle. Journal of Algorithms, 3(3):245–260, 1982.
- [15] Fabien Dufoulon, Janna Burman, and Joffroy Beauquier. Bee** a deterministic time-optimal leader election. In 32nd International Symposium on Distributed Computing, DISC 2018, volume 121 of LIPIcs, pages 20:1–20:17, New Orleans, LA, USA, October 15–19, 2018, 2018. Schloss Dagstuhl – Leibniz-Zentrum für Informatik.
- [16] Fabien Dufoulon, Janna Burman, and Joffroy Beauquier. Can uncoordinated beeps tell stories? In PODC ’20: ACM Symposium on Principles of Distributed Computing, pages 408–417, Virtual Event, Italy, August 3-=7, 2020, 2020. ACM.
- [17] M. El-Ruby, J. Kenevan, R. Carlson, and K. Khalil. A linear algorithm for election in ring configuration networks. In Proceedings of the Twenty-Fourth Annual Hawaii International Conference on System Sciences, volume i, pages 117–123 vol.1, Los Alamitos, CA, USA, 1991. IEEE Computer Society.
- [18] Michael Feldmann, Andreas Padalkin, Christian Scheideler, and Shlomi Dolev. Coordinating amoebots via reconfigurable circuits. Journal of Computational Biology, 29(4):317–343, 2022.
- [19] Paola Flocchini, Evangelos Kranakis, Danny Krizanc, Flaminia L. Luccio, and Nicola Santoro. Sorting and election in anonymous asynchronous rings. Journal of Parallel and Distributed Computing, 64(2):254–265, 2004.
- [20] Klaus-Tycho Förster, Jochen Seidel, and Roger Wattenhofer. Deterministic leader election in multi-hop bee** networks - (extended abstract). In Distributed Computing - 28th International Symposium, DISC’14, volume 8784 of LNCS, pages 212–226, 2014, Austin, TX, USA, October 12–15, 2014. Proceedings, 2014. Springer.
- [21] Greg N. Frederickson and Nancy A. Lynch. Electing a leader in a synchronous ring. J. ACM, 34(1):98–115, jan 1987.
- [22] Ran Gelles. Coding for interactive communication: A survey. Foundations and Trends® in Theoretical Computer Science, 13(1–2):1–157, 2017.
- [23] Mohsen Ghaffari and Bernhard Haeupler. Near optimal leader election in multi-hop radio networks. In SODA’13, pages 748–766, New Orleans, Louisiana, USA, January 6–8, 2013, 2013. SIAM.
- [24] D. S. Hirschberg and J. B. Sinclair. Decentralized extrema-finding in circular configurations of processors. Commun. ACM, 23(11):627–628, nov 1980.
- [25] Alon Itai and Michael Rodeh. Symmetry breaking in distributed networks. Information and Computation, 88(1):60–87, 1990.
- [26] Gérard Le Lann. Distributed systems - towards a formal approach. In Bruce Gilchrist, editor, Information Processing, Proceedings of the 7th IFIP Congress 1977, pages 155–160, Toronto, Canada, August 8–12, 1977, 1977. North-Holland.
- [27] Gary L. Peterson. An unidirectional algorithm for the circular extrema problem. ACM Trans. Program. Lang. Syst., 4(4):758–762, oct 1982.
- [28] Nicola Santoro and Peter Widmayer. Distributed function evaluation in the presence of transmission faults. In Tetsuo Asano, Toshihide Ibaraki, Hiroshi Imai, and Takao Nishizeki, editors, Algorithms, International Symposium SIGAL ’90, volume 450 of Lecture Notes in Computer Science, pages 358–367, Tokyo, Japan, August 16–18, 1990, 1990. Springer.
- [29] Violet Syrotiuk and Jan Pachl. A distributed ring orientation algorithm. In International Workshop on Distributed Algorithms (WDAG’87), pages 332–336. Springer Berlin Heidelberg, 1988.
Appendix
Appendix A Deferred Proofs Regarding Achieving Quiescent Termination
In this section, we provide an analysis of Algorithm 2 showing that it satisfies the conditions of Theorem 1.1, proving the theorem.
See 1.1
We begin with the following lemma, which asserts certain conditions on the number of pulses received over each channel. The lemma suggests that the instance cannot advance beyond the instance. We use -quiescence to denote the less general state of quiescence with respect to the channel only, that is, the network is in -quiescence if it no longer contains pulses. The network then reaches quiescence if both -quiescence and -quiescence are achieved, where the latter is defined analogously.
Lemma A.1.
As long as -quiescence has not been reached, holds for every node , with equality only when .
Proof A.2.
First, note that if a node has , then it has not yet participated in the algorithm, and . Since , the statement holds for . Further, this is always the case at the node for which . Indeed, since Algorithm 2 consists of two independent instances of Algorithm 1, one over each channel, if we restrict the discussion to the channel, the execution of Algorithm 2 is identical to an execution of Algorithm 1, and we may invoke the properties proven in Section 3.1. Then, by Lemma 3.11, while -quiescence has not occurred, we have , and the statement holds for .
We next consider the other nodes and show the statement holds also when . Fix an arbitrary node with . By Item 2, . Now, let be successors of such that is the closest node to with . Since , such a node exists.
Since is monotonically non-decreasing, once the condition on 10 is met, it is always met for all future iterations. As pulses are buffered, i.e., never lost, and because the nodes meet the condition on 10, they can be viewed as running Algorithm 1 over the channel. As such, all the properties proven in the previous section hold for the instance as well 444The only difference is that nodes start the instance in different times, while for the instance we assumed all nodes start at the same time. However, this is not an issue. Pulses on the channel remain in the queue of a node that has not started yet. That is, the situation is equivalent to the case where all the nodes start at a later time and pulses are being delayed accordingly., and we may apply Lemma 3.1 over the channel.
Consequently, for . Moreover, for , and . Combining these inequalities yields
Since , we get . Let be the node with the largest ID out of . Since we have nodes, at least one must have an ID at least by the uniqueness of IDs, that is, .
If , then we have . On the other hand, if , then for some . Using for and yields
Therefore, in both cases we get , which concludes the proof.
A direct implication of Lemma A.1 is that no node may terminate until the phase has concluded since no node may meet the termination condition on 22 and exit the loop.
Corollary A.3.
As long as -quiescence has not been reached, nodes do not terminate.
Proof A.4.
Now we prove a set of necessary conditions that hold if some meets . In particular, is necessarily the node with the largest ID, every node is still awake with , and there must be quiescence in the network over both channels.
Lemma A.5.
If the event occurs for the first time at a node , then at that point of time:
-
1.
the network has reached -quiescence,
-
2.
,
-
3.
there are no pulses in transit, i.e., ,
-
4.
, and
-
5.
no node has terminated.
Proof A.6.
If there is no quiescence over the channel, then no node terminates by Corollary A.3. By Lemma A.1, holds for all nodes with equality only when . Since , this proves the first implication.
By Lemma 3.11 (applied to the instance), -quiescence implies that all nodes satisfy , and, in particular, due to the uniqueness of , only one node with satisfies at this point, which proves the second implication.
Again, by Lemma 3.11, -quiescence is equivalent to all nodes satisfying . Thus, all nodes satisfy the condition on 10 and partake in the instance. Now consider the point of time where holds for the first time. As has not yet executed 19, an execution of Algorithm 2 is identical to an execution of Algorithm 1 over the channel. By Lemma 3.3 (applied to the channel at that point of time), the node is the last node to meet , which is equivalent to by Lemma 3.11, yielding the third implication.
By a symmetric argument for the instance, we get , which proves the fourth implication.
Finally, as argued previously, no node terminates until -quiescence is achieved. Moreover, once there is -quiescence, then remains to hold for all by Lemma 3.11. As all nodes are partaking in the algorithm at this point, by Corollary 3.17 applied to the instance, holds until the event first occurs before executes 19, so no node has terminated, which concludes the proof.
We now show that the condition in Lemma A.5 must be met at some point by a node possessing the largest ID, hence establishing the uniqueness of the event we use to drive termination.
Lemma A.7.
Let be the node with . Then there is an iteration where the event occurs.
Proof A.8.
By Item 2, the event cannot occur at any other node . Assume arguably that never meets this condition, then all nodes are running exactly Algorithm 1 over both channels. Thus, eventually, by Corollary 3.15 applied to both instances, there is some point of time where every node has sent and received exactly pulses over both channels. For node , we then have that occurs, a contradiction.
With the above, we can now conclude the proof of Theorem 1.1.
Proof A.9 (Proof of Theorem 1.1).
Assume an oriented ring of nodes with unique IDs, where each node executes Algorithm 2. Let be the node with the largest ID. We claim that all nodes terminate at some point with exactly one node, , outputting while all other nodes output .
By Lemma A.7, meets the condition at some iteration, and, due to Item 2, no other node does. Consider the first such iteration. By Item 5, no node has terminated prior to that. Additionally, holds for all due to Item 4. Thus, exactly one node, , still satisfies and has a state of while every other node has and a state of . By Item 1, the network is in -quiescence, and no more pulses are sent or received, so those states are final.
It remains to show that all nodes terminate and that when they do so, the network is in quiescence (no pulses still in transit, i.e., a quiescent termination).
By Item 3, no pulses are in transit when the event occurs firstly. Once executes 19 during that iteration, there is exactly one pulse in transit. Therefore, every node , having , receives this pulse, relays it, and then meets the termination condition on 22 and outputs correctly. Finally, due to 21, node has been waiting on a pulse, which it then receives and consumes, reaching -quiescence. The node then meets the condition and terminates with the correct output of . As quiescence has been reached over both channels, the algorithm terminates quiescently and correctly elects a leader.
We finally describe the complexity of the algorithm. By termination, every node in the algorithm has and . Consequently, the overall complexity is .
Appendix B Anonymous Rings
In this section, we consider the setting where a ring consists of identical nodes, each with access to an independent source of randomness. We call such a ring anonymous. As is standard in the literature about randomized algorithms, we aim to solve our computational task with high probability, defined as bounding the probability of failure by an arbitrary inverse power of , the size of the network. That is, we present an algorithm parameterized by a value , such that for any , the algorithm correctly elects a leader in -sized rings with probability at least . Our algorithm also correctly orients a non-oriented ring with high probability.
As alluded to in the main text, electing a leader with quiescent termination is impossible in the context of this section, even if we relax the objective to only succeed with some arbitrary small constant probability. This follows from the following negative result by Itai and Rodeh [25].
Corollary B.1 (Corollary of [25, Thm. 4.2]).
For any constant , there is no quiescently terminating algorithm for electing a leader in the anonymous ring that succeeds with at least constant probability .
Proof B.2.
Itai and Rodeh show that no terminating algorithm can compute the number of nodes in an anonymous ring with any constant probability of success [25, Thm. 4.2]. As any algorithm in our setting also works in the setting considered in that prior work (in which messages carry content instead of being pulses), the impossibility result carries to our setting. As any algorithm for electing a leader with quiescent termination would allow us to count the number of nodes in the ring afterwards [8], leader election suffers from the same impossibility result.
Consequently, we only aim for a quiescently stabilizing algorithm.
As in Section 4, observe that despite assuming the uniqueness of all IDs in Section 3.1 to elect the node with the largest ID, the task remains well-defined even if only the largest ID is unique. Lemma 4.3 showed that on a ring with possibly non-unique IDs, Algorithm 1 elects as leader all nodes such that . Hence, if a single node satisfies , a single leader is elected. Algorithm 3 is simply two parallel executions of Algorithm 1. As we already showed in the proof of Theorem 1.2, those two parallel executions still yield the desired result as long as the maximal ID in the two executions is unique. Hence, providing an algorithm for sampling IDs with the guarantee that the maximal ID is unique with high probability is sufficient to obtain a variant of Theorem 1.2 for anonymous rings.
In what follows, we outline a process by which nodes can utilize their access to randomness to sample random IDs with the guarantee that, with high probability, the maximal ID is unique and of order . The algorithm terminates quiescently—in fact, it uses no communication—enabling composition: any algorithm can be performed afterwards with the sampled IDs. As a result, with high probability, the anonymous setting reduces to the one considered in Lemma 4.3. As explained previously, such an algorithm for sampling IDs immediately implies the following result.
Theorem B.3.
There is a content-oblivious algorithm of complexity that elects a leader and orients an anonymous ring of nodes, each with access to its own source of randomness, with high probability. The algorithm reaches quiescence but does not terminate.
We now present the algorithm for sampling IDs guaranteeing a unique maximal ID with high probability; see Algorithm 4. At a high level, the algorithm has each node first sample the number of bits in its ID from a geometric distribution with parameter before sampling said bits uniformly at random. While each ID is of expected length and value at the end of this process, the maximal ID is of length and value , with high probability. See [6]. Intuitively, while sampling a large ID is an unlikely event, this unlikely event becomes more and more likely to occur somewhere in the network as the network grows. Similar ideas have previously appeared in the literature, e.g., in [1, 18]. While in other settings, as in [1], similar ID sampling algorithms may utilize message-passing to assign unique IDs, this is not an option in a content-oblivious setting. Fortunately, communication between nodes is not necessary in order to just achieve a unique maximal ID with high probability. Giving unique IDs to all nodes with quiescent termination is also impossible, even with just a small constant probability of success from the impossibility result of Itai and Rodeh [25] (see Corollary B.1). This is because unique IDs would allow us to run Algorithm 2 and elect a leader. In fact, most nodes have non-unique IDs after running Algorithm 4.
Lemma B.4.
For any constant , with high probability, running Algorithm 4 in an anonymous ring of nodes assigns each one an ID of size such that the maximal ID is attained uniquely by one node and is at least .
Proof B.5.
Let be random variables associated to the the variable BitCount for each node after termination is reached across all nodes.
Observe that for all and , we have .
Define the random variable , that is, is the length of the longest sampled ID. We first aim to show that exceeds with high probability.
Indeed, the complementary event has probability , where the second equality follows due to the independence between the variables .
By definition of and the bound , we get
Thus, with high probability, . To see that the largest ID is unique with high probability, note that the probability of a collision on bits is at most , which, with high probability due inequality (B.5), is bounded by for any small constant .
Finally, we show that with high probability. Letting , the probability of exceeding can be bound as follows:
where the inequality follows from a union bound. Therefore, with probability at least , the sampled IDs are bounded by .
The proof of Theorem B.3 follows immediately from Lemma B.4.
Finally, we note that a slight modification of Algorithm 3 would also allow us to sample a unique ID for each node (Proposition B.6), with high probability. As a result, the three settings of (1) the anonymous ring, (2) the ring with a leader, and (3) the ring with unique IDs and an orientation, are crucially separated by the possibility of quiescent termination. Leader election, orienting the ring, and assigning unique IDs can all be computed in setting (1). However, they can only be done without termination, while in settings (2) and (3), the same tasks and more can be performed with quiescent termination.
Proposition B.6.
Let be the ID sampled by nodes in Algorithm 4, before running Algorithm 3. Modify Algorithm 3 so that whenever a node receives a pulse, if , node updates its ID to a new ID sampled uniformly at random between and . Then, with high probability, all nodes have distinct IDs when reaching quiescence.
Proof B.7.
First, remark that nodes always forward pulses once has exceeded . The way we update the ID keeps the ID below , so this change does not change the behavior of nodes in the algorithm regarding how they send or receive pulses. It also does not affect the computation of the output.
Each node last resamples its ID when reaches . As the largest ID is at least with high probability, all nodes end up sampling their IDs in a sampling space of size at least . Therefore, the probability of a collision for the last sampled IDs is at most , i.e., there is no collision with high probability.