A Near Time-optimal Population Protocol for Self-stabilizing Leader Election on Rings with a Poly-logarithmic Number of States
Abstract.
We propose a self-stabilizing leader election (SS-LE) protocol on ring networks in the population protocol model. Given a rough knowledge on the population size , the proposed protocol lets the population reach a safe configuration within steps with high probability starting from any configuration. Thereafter, the population keeps the unique leader forever. Since no protocol solves SS-LE in steps with high probability, the convergence time is near-optimal: the gap is only an multiplicative factor. This protocol uses only states. There exist two state-of-the-art algorithms in current literature that solve SS-LE on ring networks. The first algorithm uses a polynomial number of states and solves SS-LE in steps, whereas the second algorithm requires exponential time but it uses only a constant number of states. Our proposed algorithm provides an excellent middle ground between these two.
1. Introduction
We consider the population protocol (PP) model (Angluin et al., 2006) in this paper. A network called population consists of a large number of finite-state automata, called agents. Agents make interactions (i.e., pairwise communication) with each other to update their states. A population is modeled by a graph , where represents the set of agents, and indicates a set of possible interactions, that is, which pair of agents can interact. Each pair of agents has interactions infinitely often, while each pair of agents never has an interaction. At each time step, one pair of agents chosen uniformly at random from all pairs in has an interaction. This assumption enables us to evaluate time complexities of population protocols in terms of in expectation and/or with high probability. Almost all studies in the population protocol model make this assumption when they evaluate time complexities of population protocols. In the field of population protocols, many efforts have been devoted to devising protocols for a complete graph, i.e., a population where every pair of agents interacts infinitely often, while several studies (Alistarh et al., 2022; Angluin et al., 2008b, 2006; Beauquier et al., 2013; Canepa and Potop-Butucaru, 2007; Chen and Chen, 2019; Cordasco and Gargano, 2017; Mertzios et al., 2014; Sudo et al., 2014, 2016, 2020a, 2018) have investigated populations forming graphs other than complete graphs.
Self-stabilization (Dijkstra, 1974) is a fault-tolerant property whereby, even when any number and kinds of faults occur, the network can autonomously recover from the faults. Formally, self-stabilization is defined as follows: (i) starting from an arbitrary configuration, a network eventually reaches a safe configuration (convergence), and (ii) once a network reaches a safe configuration, it maintains its specification forever (closure). Self-stabilization is of great importance in the PP model because this model typically represents a network consisting of a large number of inexpensive and unreliable nodes, which requires strong fault tolerance. Consequently, many studies have been devoted to self-stabilizing population protocols (Angluin et al., 2008b; Beauquier et al., 2013; Cai et al., 2012; Canepa and Potop-Butucaru, 2007; Chen and Chen, 2019; Fischer and Jiang, 2006; Izumi, 2015; Sudo et al., 2014, 2021a, 2016, 2012, 2020a, 2018, 2020b; Yokota et al., 2021). For example, Angluin, Aspnes, Fischer, and Jiang (Angluin et al., 2008b) proposed self-stabilizing protocols for a variety of problems, i.e., leader election in rings, token circulation in rings with a pre-selected leader, 2-hop coloring in degree-bounded graphs, consistent global orientation in undirected rings, and spanning tree construction in regular graphs. Sudo, Ooshita, Kakugawa, Masuzawa, Datta, and Larmore (Sudo et al., 2016, 2018) gave a self-stabilizing 2-hop coloring protocol that uses much smaller memory space of agents. Sudo, Shibata, Nakamura, Kim, and Masuzawa (Sudo et al., 2021b) investigated the possibility of self-stabilizing protocols for leader election, ranking, degree recognition, and neighbor recognition on arbitrary graphs.
The self-stabilizing leader election (SS-LE) has received the most attention among problems related to self-stabilization in the PP model. This is because leader election is one of the most fundamental problems, and several important protocols (Angluin et al., 2008b, 2006, a) assume a pre-selected unique leader. In particular, Angluin, Aspnes, Eisenstat (Angluin et al., 2008a) show that all semi-linear predicates can be solved very quickly (i.e., steps with high probability) if we have a unique leader (although their algorithm is not self-stabilizing). Unfortunately, SS-LE is impossible to solve without an additional assumption even if we focus only on complete graphs (Angluin et al., 2008b; Cai et al., 2012; Sudo et al., 2021b). Many studies are devoted to overcome this impossibility by making an additional assumption, restricting topology, and/or slightly relaxing the requirements of SS-LE (Angluin et al., 2008b; Beauquier et al., 2013; Burman et al., 2021; Cai et al., 2012; Canepa and Potop-Butucaru, 2007; Chen and Chen, 2019, 2020; Fischer and Jiang, 2006; Izumi, 2015; Sudo et al., 2014, 2021a, 2016, 2012, 2020a, 2018, 2020b, 2021b; Yokota et al., 2021). sf
Some studies (Burman et al., 2021; Cai et al., 2012; Sudo et al., 2021b) assume that every agent knows the exact number of agents. With this assumption, Cai, Izumi, and Wada (Cai et al., 2012) gave an SS-LE protocol for complete graphs, Burman, Chen, Chen, Doty, Nowak, Severson, and Xu (Burman et al., 2021) gave faster protocols in the same setting, and Sudo et al. (Sudo et al., 2021b) gave an SS-LE protocol for arbitrary graphs.
Several studies (Beauquier et al., 2013; Canepa and Potop-Butucaru, 2007; Fischer and Jiang, 2006) employs oracles, a kind of failure detectors to overcome the impossibility of SS-LE. Fischer and Jiang (Fischer and Jiang, 2006) introduced an oracle that eventually tells all agents whether or not at least one agent satisfy a given condition, e.g. being a leader or having a special token. They proposed two SS-LE protocols using , one for complete graphs and the other for rings. After that, Canepa and Potop-Butucaru (Canepa and Potop-Butucaru, 2007) proposed two SS-LE protocols that use , i.e., a deterministic protocol for trees and a randomized protocol for arbitrary graphs. Beauquier, Blanchard, and Burman (Beauquier et al., 2013) presented a deterministic SS-LE protocol for arbitrary graphs that uses two kinds of .
Another class of studies (Angluin et al., 2008b; Chen and Chen, 2019, 2020; Fischer and Jiang, 2006; Yokota et al., 2021) restricts the topology of a graph to avoid the impossibility of SS-LE. A class of graphs is called simple if there does not exist a graph in which contains two disjoint subgraphs that are also in . Angluin et al. (Angluin et al., 2008b) proved that there exists no SS-LE protocol that works for all the graphs in any non-simple class. If we focus on a simple class of graphs, there may exist an SS-LE protocol for all graphs in the class. As a typical example, the class of rings is simple. Angluin et al. (Angluin et al., 2008b) gave an SS-LE protocol that works for all rings whose sizes are not multiples of a given integer (for example, rings of odd size). They posed a question whether SS-LE is solvable or not for general rings (i.e., rings of any size) without any oracle, while Fischer and Jiang (Fischer and Jiang, 2006) solved SS-LE for general rings using oracle . This question had been open for a decade until Chen and Chen (Chen and Chen, 2019) gave an SS-LE protocol for general rings. These three protocols given by (Angluin et al., 2008b; Chen and Chen, 2019; Fischer and Jiang, 2006) use only a constant number of states per agent. The expected convergence times (i.e., the expected numbers of steps required to elect a unique leader starting from any configuration) of the protocols proposed by (Angluin et al., 2008b; Fischer and Jiang, 2006) are , while the protocol given by (Chen and Chen, 2019) requires an exponentially long convergence time. Here, the convergence time of the protocol of (Fischer and Jiang, 2006) is bounded by assuming that the oracle immediately reports the absence of the leader to each agent. Yokota, Sudo, and Masuzawa (Yokota et al., 2021) gave a time-optimal SS-LE protocol for rings: it elects a unique leader within steps in expectation starting from any configuration and uses states, given an upper bound on the population size such that . Note that this knowledge is equivalent to the knowledge , which we will assume in this paper. Chen and Chen (Chen and Chen, 2020) extended their protocol on rings so that it can work on arbitrary regular graphs.
Several studies (Izumi, 2015; Sudo et al., 2014, 2021a, 2016, 2012, 2020a, 2018, 2020b) slightly relax the requirement of the original self-stabilization and gave loosely-stabilizing leader election protocols. Specifically, the studies of this category allow a population to deviate from the specification of the problem (i.e., a unique leader) after the population satisfies the specification for an extremely long time. This concept was introduced by (Sudo et al., 2012). The protocols given by (Izumi, 2015; Sudo et al., 2021a, 2012, 2020b) work for complete graphs and those given by (Sudo et al., 2014, 2016, 2020a, 2018) work for arbitrary graphs.
Assumption | Convergence Time | #states | |
---|---|---|---|
(Angluin et al., 2008b) | is not multiple of a given | ||
(Fischer and Jiang, 2006) | oracle | ||
(Chen and Chen, 2019) | none | exponential | |
(Yokota et al., 2021) | knowledge | ||
this work | knowledge |
Our Contribution
We propose an SS-LE protocol that works only for rings. Specifically, given an integer , elects a unique leader in steps both in expectation and with high probability on any ring and uses states. The results on SS-LE on rings are summarized in Table 1. This work drastically reduces the number of agent states of (Yokota et al., 2021) by slightly sacrificing the expected convergence time under the same assumption. One can easily prove that no protocol solves SS-LE in expected steps, thus our protocol is near time-optimal.
The main technical contribution of this paper is a novel mechanism that largely improves the number of states required to detect the absence of a leader in the population compared to (Yokota et al., 2021). The protocol given by (Yokota et al., 2021) requires states to detect the absence of a leader, but our mechanism requires only states. In addition, protocol uses the same method as (Yokota et al., 2021) to decrease the number of leaders to one. As a result, protocol requires only expected steps, while the existing three SS-LE protocols for rings (Angluin et al., 2008b; Chen and Chen, 2019; Fischer and Jiang, 2006) requires expected steps.
Our protocol (and the protocol given in (Yokota et al., 2021)) assumes that the rings are oriented or directed. 111 The protocol with super-exponential convergence time in (Chen and Chen, 2019) is also designed for directed rings, but it works for undirected rings without sacrificing any complexity by using a known self-stabilizing ring-orientation protocol (Angluin et al., 2008b) that uses only states and requires a polynomial convergence time. Unfortunately, we cannot use this ring-orientation protocol (Angluin et al., 2008b) for our SS-LE protocol because we conjecture that the convergence time of the ring-orientation protocol is steps. However, this does not lose generality because we can remove this assumption: in Section 5, we give a self-stabilizing ring orientation protocol that uses only a constant number of states and requires steps in expectation and with high probability.
Relation with SS-LE protocols in the standard distributed computing model
Generally, the model of population protocols is very different than the standard models of distributed computing such as the state-reading model and the message passing model. Unlike those models, in the population protocols, (i) nodes are anonymous, (ii) nodes cannot distinguish their neighbors or even recognize their degree, and (iii) nodes update their states in pairs (they do not have the ability to observe the current states of all their neighbors when they update their states). These are the weak points of population protocols. On the strong side, the population protocols usually assume the random scheduler: at each time step, one pair of neighboring agents is chosen uniformly at random to interact. The random scheduler enables us to (loosely) synchronize the population and utilize randomization even with deterministic algorithms. Our algorithm fully makes use of this assumption to achieve a fast convergence time with bits per node.
When we focus on rings, the second weak point disappears because then every node knows that its degree is exactly two, thus the population protocols become a little bit close to the standard models. To the best of our knowledge, every SS-LE algorithm on standard models in the literature that has bits and is designed for anonymous systems has a larger convergence time than ours. The fastest one among such algorithms is given by Awerbuch and Ostrovsky (Awerbuch and Ostrovsky, 1994) (Strictly speaking, some of those algorithms have much smaller convergence time, but we exclude them because they require strong knowledge such as the exact value of , where is the smallest integer not dividing the network size .) This algorithm uses bits and requires asynchronous rounds to solve SS-LE. Even if we can simulate their algorithm without additional cost in the model of population protocols, the convergence time would become steps in expectation, which is larger than our algorithm. (Our algorithm converges in steps with bits per node. And, it requires steps in expectation to let every node have an interaction at least once.) Moreover, it requires careful discussion about the possibility to simulate algorithms designed for ordinary models by population protocols. In particular, when we use a small number of bits of agent memory such as bits, there is no way in the literature to simulate the message passing model or state-reading model.
2. Preliminaries
A population is a weakly connected digraph , where is a set of agents and is a set of arcs. Define and assume . Each arc represents a possible interaction (or communication between two agents): If , agents and can interact with each other, where serves as an initiator and serves as a responder. If , such an interaction never occurs. In this paper, we consider only a population represented by a directed ring, i.e., we assume that and . Here, we use the indices of the agents only for simplicity of description, and the agents cannot access their indices. The agents are anonymous, i.e., they do not have unique identifiers. We call and the left neighbor and the right neighbor of , respectively. We omit “modulo by ” (i.e., ) in the indices of agents when no confusion occurs. We sometimes denote “left to right” direction by clockwise direction, and “right to left” direction by counter-clockwise direction.
A protocol consists of a finite set of states, a finite set of output symbols, transition function , and an output function . When an interaction between two agents occurs, determines the next states of the two agents based on their current states. The output of an agent is determined by : the output of agent with state is . We assume that all agents have a common knowledge . Thus, the components , , and may depend on . However, for simplicity, we do not explicitly write protocol as parameterized with , e.g., .
A configuration is a mapping that specifies the states of all the agents. We denote the set of all configurations of protocol by . We simply denote it by when protocol is clear from the context. We say that configuration changes to by an interaction , denoted by if we have and for all . We simply write if there exists such that . We say that a configuration is reachable from if there exists a sequence of configurations such that , , and for all . We also say that a set of configurations is closed if no configuration outside is reachable from any configuration in .
A scheduler determines which interaction occurs at each time step (or just step). In this paper, we consider a uniformly random scheduler : each is a random variable such that for any and . Each represents the interaction that occurs at step . Given an initial configuration , the execution of protocol under is defined as such that for all . We denote simply by when no confusion occurs.
We address the self-stabilizing leader election problem in this paper. For simplicity, we give the definition of a self-stabilizing leader election protocol instead of giving the definitions of self-stabilization and the leader election problem separately.
Definition 2.1 (Self-stabilizing Leader Election).
For any protocol , we say that a configuration of is safe if (i) exactly one agent outputs (leader) and all other agents output (follower) in , and (ii) at every configuration reachable from , all agents keep the same outputs as those in . A protocol is a self-stabilizing leader election (SS-LE) protocol if reaches a safe configuration with probability for any configuration .
We denote interaction by . For any two sequences of interactions and , we define . That is, we use “” for the concatenation operator. For any sequence of interactions and integer , denotes the -times repeating sequence of : and . For any integer and any integer , we define and . We say that a sequence of interactions have length if it consists of interactions.
Definition 2.2.
Let be a sequence of interactions. We say that occurs within steps when occurs in this order (not necessarily in a row) within steps. Formally, the event “ occurs within steps from a time step ” is defined as the following event: holds for all for some sequence of integers . We say that from step , completes at step if occurs within steps but does not occur within steps. When the starting step is clear from the context, we just write “ occurs within steps” and “ completes at step ”.
Lemma 2.3.
Let be a sequence of interactions with length . Then, occurs within steps in expectation. For any , occurs within steps with probability .
Proof.
The first claim immediately follows from linearity of expectation and the fact that for any , the -th interaction of occurs with probability at each step. The second claim follows from Chernoff bound (See Lemma A.1 in Appendix.). ∎
Throughout this paper, we use “with high probability”, abbreviated as w.h.p., to denote with probability . The set of integers for is denoted by .
Lemma 2.4.
For any SS-LE protocol and a function , the convergence time (i.e., the number of steps to reach a safe configuration) of is steps in expectation if the convergence time of is bounded by steps w.h.p.
Proof.
Let , where is the expected convergence time when the initial configuration is . Then, we have because a self-stabilizing protocol must deal with an arbitrary initial configuration. Solving the inequality gives . ∎
Note that this lemma depends on the assumption that is self-stabilizing. We cannot use this kind of translation from “w.h.p. time” to “expected time” for non-self-stabilizing algorithms.
3. Self-Stabilizing Leader Election on a Ring
In this section, we prove the following theorem.
Theorem 3.1.
If knowledge is given, there exists a self-stabilizing leader election protocol that works for any directed ring such that (i) for any , reaches a safe configuration within steps both w.h.p. and in expectation, and (ii) each agent uses states.
To prove the above theorem, we give an SS-LE protocol that satisfies the requirements of the theorem. Thanks to Lemma 2.4, we consider the convergence time of only in terms of “w.h.p.” in the rest of this paper. In addition, we assume without loss of generality: we can solve SS-LE in a straightforward way if because it yields .
The pseudocode of is given in Algorithms 1, 2, 3, 4, and 5, which describes how two agents and update their states, i.e., their variables, when they have an interaction. Here, and represent the initiator and the responder in the interaction, respectively. That is, is the left neighbor of , and is the right neighbor of . We denote the value of variable at agent by . Similarly, we denote the value of variable in state by . In this algorithm, each agent maintains an output variable , according to which it determines its output. Agent outputs when and outputs when . We say that is a leader if ; otherwise is called a follower. For each , we define the distance to the nearest left leader and the distance to the nearest right leader of as and , respectively. When there is no leader in the ring, we define . By definition, when is a leader. Note that and are not variables maintained by agents, but just notations.
The pseudocode of the main function of is shown in Algorithm 1, which consists of two functions and . To design a self-stabilizing protocol, we must consider an arbitrary initial configuration, where there may be no leader, or there may be two or more leaders. The goal of is to create a new leader when no leader exists in the population, while the goal of is to decrease the number of leaders to one when there are two or more leaders. Function , presented in (Yokota et al., 2021), decreases the number of leaders to one within steps with high probability using only a constant number of states. Although we use without any modification, we will present in Section 3.4 for the completeness of this paper.
3.1. Overview
The difficulty of designing lies in detecting the absence of a leader in a self-stabilizing fashion. Starting from an arbitrary configuration without a leader, the population must detect the absence of a leader and create a new leader.
The protocol presented in (Yokota et al., 2021) achieves the detection in a naive way using states, given knowledge : each agent computes the distance from the nearest left leader and detects the absence of a leader when the computed distance is or larger. However, is allowed to use only states, so we cannot take this approach. One may think that we can still use this strategy by maintaining approximate distance instead of the exact distance from the nearest left leader, in order to reduce the number of states to . We conjecture that this does not work. If we try to use approximate distance, the agents sometimes compute a far large distance, which results in misdetecting the absence of a leader and creating a new leader even if the population already has a unique leader. Such an event may occur extremely rarely, however, it eventually occurs even after an extremely long expected time. So, the resulting algorithm is not self-stabilizing.
The protocol presented in (Chen and Chen, 2019) detects the absence of a leader in a different way. Their protocol lets the population reach a safe configuration where exactly one leader exists and a bit-string that can prove the existence of a leader is embedded on the ring. Specifically, a prefix of the bit-string called Thue-Morse string (Thue, 1912) is embedded: each agent has variable , and is a prefix of Thue-Morse string, where and is the unique leader. Although we do not write the definition of Thue-Morse string here, it has a good property called cube-freeness, that is, it does not contain as a sub-string for any string . Using this property, the population declares the detection of the absence of a leader if and only if it finds a string for some . After the population reaches a safe configuration, the cube-freeness of Thue-Morse string guarantees that the protocol does not find such a string. On the other hand, if there is no leader, the agents can eventually observe for for some , letting them detect the absence of a leader. Chen and Chen (Chen and Chen, 2019) implement this idea with states per agent. However, implementing this idea is not easy, so that their protocol requires extremely long convergence time, i.e., a super-exponential number of steps in expectation and w.h.p.

We embed a much simpler string on the ring to achieve much faster convergence time, i.e., steps, at the cost of increasing the number of states from to . Each maintains two variables and for the string embedding. When the embedding is complete,
(1) |
must hold. We call an agent that satisfies a border. We say that a sequence of agents is a segment when and are borders and are not borders. Let . We define the ID of a segment as , that is, is the integer that corresponds to a bit string in the base-2 numeral system. For a segment , we denote the previous segment by . When the embedding is complete, a segment must satisfy
(2) |
We say that a configuration is perfect if no violation occurs against (1) or (2) in . For any and , there exists a perfect configuration with one leader. See examples in Figure 1 (a) and (b). The segment IDs increase one by one in the clockwise direction starting with the segment that contains a leader, while we do not need to care about the IDs of the first and the last segments, which are drawn in bold curves in Figure 1. Importantly, a perfect assignment requires the existence of a leader. That is, every configuration containing no leader violates (1) or (2). For example, in Figure 1 (c) with , the segment with ID 8 violates condition (2) because . This claim can be easily proved from the fact that and , as follows.
Lemma 3.2.
A configuration without a leader is not perfect.
Proof.
Assume for contradiction that there is a perfect configuration that does not have a leader. Since (1) holds for all and there is no leader in , the length of all segments is , thus the number of segments is exactly in . This yields that there is at least one segment that violates (2), which contradicts the assumption. ∎
The basic structure of , whose pseudocode is shown in Algorithm 2, is as follows.
-
(1)
Each agent maintains a variable . We say that is in the detection mode if ; Otherwise is in the construction mode. Function
, called at Line 3, determines which mode the agents in the population should be in. As we will see later, guarantees that-
•
once a leader exists in the population, all agents will enter the construction mode within steps and keep the construction mode in the next steps for arbitrarily large constant w.h.p 222 Actually, this constant depends on the parameter . We can increase arbitrarily by increasing so that the whole population stays in the construction mode in a sufficiently long time. , and
-
•
if there is no leader, a new leader is created or all the agents will enter the detection mode within steps w.h.p., after which no agent goes back to the construction mode until a new leader is created.
-
•
-
(2)
The agents in the construction mode try to let the population reach a perfect configuration by updating variables and . If all agents are in the construction mode and there is one leader, they will, within steps w.h.p., make a perfect configuration from which no agent changes and .
-
(3)
The agents in the detection mode try to detect the imperfection of the current configuration. If all agents are in the detection mode and there is no leader, they will detect the imperfection and create a new leader within steps w.h.p.
Thus, the combination of and lets the population reach, within steps w.h.p., a safe configuration such that there is exactly one leader and no leader will be created in the following execution. Function may kill (i.e., remove) a leader even if it is the unique leader in the population. This is due to the inconsistency of variables that might occur in some configurations. (Recall that we must consider an arbitrary initial configuration to design a self-stabilizing protocol.) However, as we will see in Section 4, and will remove this inconsistency within steps w.h.p. Thereafter, will never kill the last leader in the population, i.e., will remove a leader only when there are two or more leaders. If there is no leader, lets all agents enter the detection mode, after which lets the agents detect the imperfection of the current configuration and create a new leader (not necessarily a single leader), which requires steps w.h.p. Once a leader appears in the population, lets all agents enter the construction mode within steps and keep the construction mode for a sufficiently large steps w.h.p. As mentioned above, decreases the number of leaders to one within steps w.h.p. Thus, during the period where all agents are in the construction mode, elects a unique leader, and updates and so that the population reaches a configuration such that (i) is perfect, and (ii) no agent changes or from unless a new leader is created. Thereafter, no agent creates a new leader even if some agent goes back to the detection mode. Thus, the population keeps the unique leader forever.
The rest of this section is organized as follows. In Section 3.2, we explain how constructs a perfect configuration when the agents are in the construction mode and how it detects the imperfection of the current configuration when the agents are in the detection mode and there is no leader. In Section 3.3, we explain how determines the mode of the agents and how it shows the desirable behavior mentioned above. In Section 3.4, we explain how given by (Yokota et al., 2021) eliminates the number of leaders to one for the completeness of this paper.
3.2. Construction and Detection
In this section, we explain how guarantees that
-
•
when all agents are in the construction mode and there is exactly one leader, the population reaches a perfect configuration within steps w.h.p., and
-
•
when all agents are in the detection mode and there is no leader, the imperfection of the current configuration is detected and a new leader is created within steps w.h.p.
Thus, we do not consider the case where there are two or more leaders in the population throughout this section.
The pseudocode of , shown in Algorithm 2, consists of three parts: the first part manages variable by invoking (Line 3), the second part manages variables and (Lines 4–9), and the third part manages variable by invoking a function (Lines 10–11). The first part is left to Section 3.3. The second and third parts guarantee the above specification by updating and checking variables , , and .
The second part is simple. When and have an interaction, the right agent tries to compute its distance to the nearest left leader modulo on a temporary variable by executing if is a leader; otherwise . If is in the construction mode, it just substitutes the computed value for . If is in the detection mode and , this difference yields that the current configuration is not perfect. Then, creates a new leader. (Ignore variables , , and at Line 6 for now. We will explain these variables in Section 3.4.) The variable indicates whether agent belongs to the last segment, i.e., the segment such that is a leader. At each interaction, the left agent updates at Line 9 irrespective of its mode.
Consider that interaction sequence occurs, during which is always a unique leader and all agents are in the construction mode. Then, the population reaches a configuration where no agent violates the first condition of perfection, i.e., (1), and the agents in the last segment have and the other agents have . Consider that occurs for some , during which there is no leader and all agents are in the detection mode. If the population has some inconsistency in variable , i.e., for some , at least one agent detects the inconsistency and creates a leader in this period. Otherwise, the population reaches a configuration where holds for all agents in this period. In both cases, occurs within steps w.h.p. by Lemma 2.3.
Thus, in the rest of Section 3.2, we explain how the third part works assuming that there is no agent violating the first condition of perfection and holds if and only if belongs to the last segment. Again, we consider only two cases in this section (Section 3.2): (i) there is exactly one leader, and (ii) there is no leader. Without loss of generality, we assume that is the unique leader in the first case, while we assume in the second case. Then, we have segments in the population where for and . We say that a segment is black if is even; Otherwise is white. We call the border agent in a black (resp. white) segment a black border (resp. white border).

The goal of the third part is as follows: for each , it embeds on variable on the agents in to satisfy in the construction mode, while it creates a new leader when it finds in the detection mode. To achieve this goal, we use two kinds of tokens, black tokens and white tokens. For each , the border agent in creates a black (resp. white) token if it is black (resp. white), and the generated token moves back and forth in the trajectory shown in Figure 2, conveying two bits and . These two bits are used to compute : maintains the binary value that will be set to the target index and maintains the carry flag. Specifically, the agents in two segments and move the token in the following steps:
-
(1)
When creates a token, it initializes and as
and set the target index .
-
(2)
The token moves right toward . It disappears if it enters the last segment.
-
(3)
The token arrives at eventually. If is in the construction mode at that time, it copies to . Otherwise, it does not update . Instead, it checks whether holds. If it does not hold, becomes a leader.
-
(4)
The token disappears if , i.e., it has already reached the final destination . Otherwise, it begins to move left toward .
-
(5)
The token moves left toward .
-
(6)
The token arrives at eventually. It updates and as
and increments the target index by one and goes back to Step 2.
This behavior of the token obviously achieves the above goal. We realize this behavior with two variables , which represent black and white tokens, respectively. For any agent , (resp. ) means that is not carrying a black (resp. white) token currently. In the following, we only explain how the agents realize the behavior of a black token with variable . The behavior of a white token is realized in completely the same way. If , the black token consists of three elements. The first element represents the relative position of the target. When , the black token at is moving right toward . When , the token is moving left toward . The second element and the third element respectively correspond to the two bits and that were used to describe the behavior specified by Steps 1–6. Each step is realized by the following lines at Algorithm 3:
-
•
Step 1: Lines 12–13,
-
•
Step 2: Lines 14–15 and 23–25,
-
•
Step 3: Lines 16–20,
-
•
Step 4: Lines 21–22 and 32–33,
-
•
Step 5: Lines 29–31,
-
•
Step 6: Lines 26–28.
Note that in the pseudocode, we have when we deal with a black token, while we have when we deal with a white token. (See Lines 10 and 11 in Algorithm 2.) The above implementation of the behavior of the tokens is straightforward and requires no explanation except for Lines 14–15 and 32–33. Lines 14–15 specify what happens if two black tokens meet. At that time, the left token disappears. This destruction does not cause live-lock because the rightmost black token in the segments and is never killed by any token until it reaches the final destination . Lines 32–33 have three roles: the first one is deleting a token that has reached the final destination. The second one is deleting the invalid tokens. Roughly speaking, we say that a token is invalid if it is out of its trajectory. Formally, we define invalid tokens as follows.
Definition 3.3.
A token located at agent is invalid if
where if the token is black, and otherwise. A token is valid if it is not invalid.
A valid token never gets invalid before it reaches its final destination, at which point it disappears. (See Figure 2.) Invalid tokens may exist in an initial configuration, which the adversary can arbitrarily choose. However, Lines 32–33 delete all invalid tokens during the period occurs, which requires only steps w.h.p. by Lemma 2.3. The third one is deleting a token located at the last segment.
The length of the trajectory of a token is exactly . Thus, under the assumption that variable is correctly computed, every token moves at most times.
Definition 3.4.
We say that a token completes its trajectory when it moves times.
Lemma 3.5.
Let and . Let be a set of all configurations where and hold for all . Consider execution . If holds and interaction sequence occurs in the first steps, there is at least one token such that (i) does not exist in , (ii) is generated by , and (iii) completes its trajectory in .
Proof.
We will prove the lemma for the case . The case can be dealt with in the same way. Since , is a black border. Let be the time step at which the first completes. Then, all black tokens that exist at in disappear in . If there are one or more black tokens at in , let be the rightmost token among them. The token does not exist in , is generated in the first steps, and completes its trajectory in . Otherwise, the first token generated by after step completes its trajectory in . ∎
Consider the case that there exists exactly one leader and all agents are in the construction mode. Then, the third part (i.e., the movement of black and white tokens) correctly constructs the segment IDs so that holds for all , i.e., lets the population reach a perfect configuration, while occurs, by Lemma 3.5. This interaction sequence has length at most , thus occurs within at most steps w.h.p. by Lemma 2.3.
Consider the case that there is no leader and all agents are in the detection mode. Then, under the aforementioned assumption, all segments have length and all agents have . Thus, by Lemma 3.2, there exists a segment such that . Then, the third part detects the inconsistency and creates a new leader while occurs. This interaction sequence occurs within at most steps w.h.p. by Lemma 2.3.
3.3. Mode Determination
To describe the goal of properly, we define three sets of configurations, , and . We define as the set of configurations with at least one leader. We define . We define as the set of all configurations such that an execution of starting from will never enter , i.e., never kill the last leader. We will prove in Section 4 that holds, and an execution of reaches a configuration in within steps w.h.p. starting from any configuration. The goal of this section is to give such that the following two lemmas hold for a parameter with a sufficiently large constant . We assume , i.e., .
Lemma 3.6.
There exists a set of configurations such that (i) an execution of starting from any configuration in reaches a configuration in within steps w.h.p., and (ii) all agents are in the construction mode in the first steps w.h.p. in an execution of starting from any configuration in .
Lemma 3.7.
Let be the set of all configurations such that, in an execution of starting from , all agents are always in the detection mode before a leader is created. Let . Execution reaches a configuration in within steps w.h.p.
We design with a variable . We use this variable as a barometer of the absence of a leader: high value of indicates a high chance that there is no leader. The mode (detection or construction) of an agent is uniquely determined by this variable: if and only if (Lines 49–50). The basic idea is as follows. A leader always generates a resetting signal, which indicates that there is a leader in the population. This signal moves in the ring in the clockwise direction, i.e., from left to right, resetting the clocks of the agents it visits. To implement the resetting signal, each agent maintains a variable . The value of represents the TTL (Time To Live) of the signal that carries, and means that does not carry a resetting signal. A leader generates a new signal when it interacts with its left neighbor (Lines 34–35). Each time an agent with a signal interacts with its right neighbor, the signal moves from left to right (Line 42). If the right neighbor also carries a signal, the two signals are merged at the right neighbor and the merged signal will get the higher TTL. Each agent resets the clock to zero when it observes the signal (Line 39). Thus, the existence of a leader prevents the clock of each agent from reaching , while all agents increase their clocks to and thus will enter the detection mode in steps w.h.p. when there is no leader: as we will see later, each requires steps with probability to increase its clock by .
We have to decrease the TTL of resetting signals in some way because we must remove all signals from the population when no leader exists. On the other hand, we require that a newly generated signal traverses the whole ring (i.e., moves right times) w.h.p. before it disappears, which is necessary to reset the clocks of all agents. To achieve this with states, we implement signals using the lottery game (Alistarh et al., 2017). Each agent maintains a variable . Agent increases by one when it interacts with its left neighbor (Line 37), while it resets when it interacts with its right neighbor (Line 36). The uniform randomness of the scheduler assures that interacts with its right neighbor with probability each time has an interaction. If a signal at agent observes , it decreases its TTL by one and is reset to zero (Lines 43–45). Consider that and have an interaction when both have resetting signals, thus those signals are merged. Then, we say that ’s signal absorbs ’s signal if ; otherwise we say that ’s signal absorbs ’s signal. To simplify the analysis, we reset to zero in the former case, i.e., when ’s signal moves right absorbing ’s signal (Lines 40–42). Note that a signal at moves right if and only if interacts with its right neighbor. Thus, a signal decreases its TTL if and only if it observes interactions without moving right. Thus, every signal requires interactions (i.e., steps) with probability before it is absorbed or it disappears (i.e., decreases its TTL to zero).333 This requires careful analysis. We will prove this fact as Lemma 3.11 later. Since a signal moves right times in steps w.h.p. by Lemma 2.3, the signal can visit all agents w.h.p. On the other hand, when no leader exists, the population will reach a configuration with no signals in steps w.h.p. because no signal is newly generated.
We use completely the same mechanism to increase a variable . Each time observes , it increases by one (Lines 38–41). Thus, when no signal exists in the population, each requires steps with probability to increase its clock by . Therefore, when no leader exists, a new leader is created or all agents enter the detection mode within steps w.h.p. On the other hand, when there is at least one leader, the population reaches a configuration where the clocks of all agents are not more than within steps w.h.p., and all agents remain in the construction mode (i.e., no agent increases its clock to ) in the next steps w.h.p.
Definition 3.8.
Let and be positive integers. Consider that a player makes independent coin flips repeatedly. The result of each flip is head with probability and tail with probability . One round of the lottery game ends each time the player sees a tail or consecutive heads. If a round ends in the former case (i.e., the round ends with the observation of a tail), the player looses the game in that round; Otherwise, the player wins the game in that round. Define a random variable as the number of rounds that the player wins in the first flips.
Lemma 3.9.
holds for any and .
Proof.
Let . The player wins the game with probability at each round independently from other rounds. Therefore, by Chernoff bound (Lemma A.1), the player wins the game at most times in the first rounds with probability at least . Obviously, the player plays at most rounds in the first flips, which completes the proof. ∎
Lemma 3.10.
holds for any and .
Proof.
Let . The player wins the lottery game in at least rounds in the first flips if (i) the player plays at least rounds in the first flips, and (ii) the players wins the game at least rounds in the first rounds. By Chernoff bound (Lemma A.1), the first event occurs with probability at least . The player wins the game with probability at each round independently from other rounds. Therefore, by Chernoff bound (Lemma A.1), the second event occurs with probability at least . Thus, the proof follows from the union bound. ∎
We say that a signal at agent encounters an interaction when has an interaction.
Proof of Lemma 3.6.
We prove that the claim of the lemma holds when we define as the set of all configurations in where and for all .
First, we consider execution , where . Since , we can assume that is a leader in without loss of generality. The leader generates a new signal when it interacts with .444 Strictly speaking, may be killed within a short time, but there must be always at least one leader because ; thus we can shift indices of the agents so that is still a leader. This event occurs within steps with probability . The generated signal visits all agents and resets their clocks in the next steps for a constant if all of the following events occur:
- (A):
-
occurs in the steps,
- (B):
-
The signal encounters at most interactions in the steps, and
- (C):
-
The signal does not decrease its TTL to zero in the first interactions it encounters.
Event (A) occurs w.h.p. by Lemma 2.3, while event (B) also occurs w.h.p. by Chernoff bound (Lemma A.1) because the signal encounters an interaction with probability at each step. Event (C) holds w.h.p. by Lemma 3.9 with and for a sufficiently large . Thus, by the union bound, the clock of every agent is reset to zero at least once in the steps. Again, by Lemma 3.9 with and , it holds w.h.p. that no agent increases its clock times in the steps. Hence, the population will enter within steps w.h.p.
Next, we consider execution , where . In this execution, all agents remain in the construction mode until some agent increases its clock times. By Lemma 3.9 with and , each agent increases its clock or more times in its next interactions with probability at most . By Chernoff bound (Lemma A.1), requires at least steps to have interactions with probability . Hence, by the union bound, in an execution starting from a configuration in , all agents remain in the construction mode in the first steps w.h.p. ∎
Lemma 3.11.
Every resetting signal will be absorbed or disappear in steps with probability .
Proof.
The TTL of a resetting signal never increases unless it is absorbed and merged with another signal. Hence, by Lemma 3.10 with and , the resetting signal is absorbed or disappears in the first interactions it encounters with probability . By Chernoff bound (Lemma A.1), a signal encounters at least interactions or disappears within steps with probability . Thus, the union bound gives the lemma. ∎
Proof of Lemma 3.7.
It is clear that a configuration is in if there is no leader, all agents are in the detection mode, and no resetting signal exists in . We will prove that reaches such a configuration within steps w.h.p. Assume . The number of resetting signals is monotonically non-increasing as long as there is no leader. Thus, the union bound and Lemma 3.11 yield that the population reaches a configuration where there is no signal or there is a leader within steps w.h.p. If there is no leader at this time, by Lemma 3.10 with and , each agent increases its clock to in its next interactions or some agent becomes a leader during the period with probability . By Chernoff bound (Lemma A.1), has at least interactions within steps with probability . Thus, the union bound gives the lemma. ∎
3.4. Leader Elimination
We use the leader elimination part of the protocol given by Yokota, Sudo, and Masuzawa (Yokota et al., 2021) as Function without any modification. The pseudocode is given in Algorithm 5. In this module, leaders try to kill each other by firing bullets to decrease the number of leaders to one. This module uses Shields, which removes bullets, to avoid killing all leaders from the population. An SS-LE protocol with bullets and shields in the ring is first introduced in Fischer and Jiang (Fischer and Jiang, 2006), but it requires expected steps for convergence. Yokota et al. (Yokota et al., 2021) improves the bullets-and-shields-war strategy to elect exactly one leader within steps in expectation and steps with high probability.
The basic strategy is as follows. A leader fires a bullet to kill another leader. The fired bullet moves from left to right in the ring until it reaches a leader. A leader does not always fire a bullet: it fires a bullet only after it detects that the last bullet it fired reaches a (possibly different) leader. A leader may have a shield: a shielded leader is never killed even if it meets a bullet. There are two kinds of bullets: live bullets and dummy bullets. A live bullet kills an unshielded leader. However, a dummy bullet does not have capability to kill a leader. When a leader decides to fire a new bullet, the bullet becomes live or dummy with probability each. When a leader fires a live bullet, it simultaneously generates a shield (if it is unshielded). When a leader fires a dummy bullet, it breaks the shield (if it is shielded). Thus, roughly speaking, each leader is shielded with probability at each step. Therefore, when a live bullet reaches a leader, the leader becomes a follower with probability . This strategy is well designed: not all leaders kill each other simultaneously because a leader must be shielded if it fired a live bullet in the last shot. As a result, the number of leaders eventually decreases to one, but not to zero.
In what follows, we explain how we implement this strategy. Each agent maintains variables , , and . As their names imply, (resp. , ) indicates that is now conveying no bullet (resp. a dummy bullet, a live bullet), while indicates that is shielded. A variable is used by a leader to detect that the last bullet it fired already disappeared. Specifically, indicates that is propagating a bullet-absence signal. A leader always generates a bullet-absence signal in its left neighbor when it interacts with its left neighbor (Line 62). This signal propagates from right to left (Line 62), while a bullet moves from left to right (Lines 58-60). A bullet disables a bullet-absence signal regardless of whether it is live or dummy, i.e., is reset to when two agents and such that and have an interaction (Line 61). Thus, a bullet-absence signal propagates to a leader only after the last bullet fired by the leader disappears. When a leader receives a bullet-absence signal from its right neighbor , waits for its next interaction to extract randomness from the uniformly random scheduler. At the next interaction, by the definition of the uniformly random scheduler, interacts with its right neighbor with probability and its left neighbor with probability . In the former case, fires a live bullet and becomes shielded (Lines 51-52). In the latter case, fires a dummy bullet and becomes unshielded (Lines 53-54). In both cases, the received signal is deleted (Lines 52 and 54). The fired bullet moves from left to right each time the agent with the bullet, say , interacts with its right neighbor (Lines 59-60). However, the bullet disappears without moving to if already has another bullet at this time. Suppose that the bullet now reaches a leader. If the bullet is live and the leader is not shielded at that time, the leader is killed by the bullet (Line 56). The bullet disappears at this time regardless of whether the bullet is alive and/or the leader is shielded (Line 57).
Yokota et al. (Yokota et al., 2021) proves that this method decreases the number of leaders to one within steps in expectation (thus within steps w.h.p. ) starting from any configuration in . (See Lemma 4.11 in Section 4.2.)
4. Correctness and Convergence Time
In this section, we prove Theorem 3.1 by showing that is an SS-LE protocol on directed rings of any size given knowledge and that the convergence time of is steps w.h.p. First, in Section 4.1, we introduce a set of configurations and prove that every configuration in is safe. Next, in Section 4.2, we prove that the population reaches a configuration in within steps w.h.p. starting from any configuration.
We use several functions whose return values depend on a configuration, such as and . When a configuration should be specified, we explicitly write a configuration as the first argument of those functions. For example, we denote and to denote and in a configuration , respectively.
4.1. Safe Configurations
We introduce a set of safe configurations here. Define as the set of configurations where there is exactly one leader. In the rest of this paper, whenever we consider a configuration , we always assume that is the unique leader in without loss of generality.
Of course, must hold. Moreover, an execution starting from must keep exactly one leader. Thus, it must not kill the unique leader . Let us discuss what configurations have this property. We say that a live bullet located at agent is peaceful when the following predicate holds:
A peaceful bullet never kills the last leader in the population because its nearest left leader is shielded. A peaceful bullet never becomes non-peaceful; because letting be the agent at which the bullet is located, the agents will never have a bullet-absence signal thus never becomes unshielded before the bullet disappears. At the beginning of an execution, there may be one or more non-peaceful live bullets. However, every newly-fired live bullet is peaceful because a leader becomes shielded and disables the bullet-absence signal when it fires a live bullet. Thus, once the population reaches a configuration where every live bullet is peaceful and there are one or more leaders, the number of leaders never becomes zero. Formally, we define the set of such configurations as follows:
The following lemmas hold from the above discussion.
Lemma 4.1.
is closed.
Lemma 4.2.
.
Then, is closed? If the answer is yes, every configuration in is safe; thus we can define . Unfortunately, the answer is no: an execution starting from a configuration in never kills the unique leader , however it may create a new leader. We must specify the condition that the population never creates a leader. First, we define as the set of configurations where and are correctly computed at every agent. Formally, we define
(Recall .) Second, we consider the condition on a variable . We define for any and call as the -th segment. Each segment is a sequence of agents, but we sometimes use as a set by abuse of notation. If a configuration is safe, we expect for any , that is, must be perfect. This condition is still insufficient because a token may hold an inconsistent value so that it will change variable or create a new leader even if the current configuration is perfect. Thus, we also expect that there is no such token. For any token located at , we call agent the target of , denoted by . Recall that a token changes its moving direction every time it reaches its target. For any , we say that a valid token located at is working for if both and are in . Recall the definition of valid tokens (Definition 3.3). Since is valid, is an even number if and only if is black. For any , we say that a valid token working for is in the -th round if its target is or . In each round , the token moves right from , reaches the target , changes the direction to the left, and finally reaches the target . Then, we can define the correctness of tokens. Recall that stores the binary value to set (check) at the target and stores the carry flag.
Definition 4.3.
Consider that a valid token working for is in the -th round and is located at . Let be the minimum integer in such that . Define if no such exists in . Then, we say that is correct if all of the followings hold:
-
•
if and only if , and
-
•
.
The following lemmas immediately follow from the definition of correct tokens.
Lemma 4.4.
Let , and let be a correct token which is working for , located at , and in the -th round in a configuration . Then, satisfies , where is a sequence of bits such that in .
Lemma 4.5.
A correct token working for becomes incorrect only when changes, as long as the population is in .
Now, we have all ingredients to define .
Definition 4.6.
Define as the set of configurations in where all tokens are valid and correct, and holds for all .
Lemma 4.7.
is closed. Every configuration in is safe.
Proof.
Since , every configuration in is safe if is closed. Thus, it suffices to prove the first claim: is closed. Let be configurations such that changes to by one interaction. Since all tokens are correct in , by Lemma 4.4, no agent changes variable and no agent becomes a new leader in that interaction. The population can deviate from only when a new leader is created. Thus, and holds. By Lemma 4.5, all tokens that appear in are still correct in . Moreover, every token is valid and correct when it is generated by a leader by definition of correctness. Thus, all tokens are valid and correct in . Hence, is still in , which proves the lemma. ∎
4.2. Convergence
In this subsection, we prove that an execution of starting from any configuration in reaches a configuration in within steps w.h.p. We give this upper bound in two steps: we first show that execution enters within steps w.h.p. for any , and next show that enters within steps w.h.p. if .
To prove the first claim, we introduce two sets of configurations and : is the set of all configurations where there is no live bullets in the population, and is the set of all configurations where there is no bullet-absence signal in the population.
Lemma 4.8.
Let . Then, enters within steps w.h.p.
Proof.
By Lemma 2.3, it suffices to show that enters before or when completes. Assume because otherwise we do not need to prove anything. Then, there are one or more live bullets in . Let be any such live bullet. The sequence of interactions lets visit all agents in the clockwise direction or disappear. Consider that survives in . If there is a leader in the population at that time, must be peaceful because there is no bullet-absence signal between and its nearest left leader. Otherwise, has removed all bullet-absence signals from the population. Since we picked up any live bullet for and a newly generated live bullet is always peaceful, we can conclude that at least one of the followings holds when completes: (i) there is no live bullet, (ii) there is no bullet-absence signal, or (iii) there is a leader and all live bullets are peaceful. This completes the proof. ∎
Lemma 4.9.
Let . Then, enters within steps w.h.p.
Proof.
holds by definition of . Hence, let us assume because otherwise and the proof is already done. Let be the minimum positive integer such that and . Only leaders generate bullet-absence signals or fire live bullets. Thus, . An agent gets shielded and fires a live bullet when it becomes a leader (Lines 6 and 18). If , the fired bullet is peaceful and the only live bullet in the population, thus . If , all live bullets become peaceful by the event of leader creation, thus . Therefore, in any case, we have .
Thus, it suffices to show that a leader is created within steps w.h.p. All agents enter the detection mode and all resetting signals disappear from the population in steps w.h.p. by Lemma 3.7. Thereafter, all agents are in the detection mode until a new leader is created. We can assume that can be divided by and holds for all because otherwise the inconsistency is detected and a new leader is created (Line 6) within steps w.h.p. We assume without loss of generality. Then, all agents will have before or when completes, which requires steps w.h.p. by Lemma 2.3. Thereafter, no agent changes or until a leader is created. Let for all , where . At this time, by Lemma 3.2, there must be such that . Agents in the detection mode never update variable , thus never changes until a leader is created. Since a newly generated token is always correct, by Lemmas 3.5, 4.4, and 4.5, will be detected and a new leader will be created before or when completes, which requires steps w.h.p. by Lemma 2.3. To conclude, a new leader is created within steps w.h.p. ∎
Lemma 4.10.
Let . Then, enters within steps w.h.p.
Next, we prove the second claim, i.e., enters within steps w.h.p. for any . To prove the claim, we introduce a new protocol , which can be obtained by removing Lines 6 and 18, i.e., by disabling the ability to create a leader. Note that holds because and have the same set of variables. Importantly, two executions and are the same until a new leader is created in .
Lemma 4.11 ((Yokota et al., 2021)).
Let . Then, enters within steps w.h.p.
Proof.
Yokota et al. (Yokota et al., 2021) shows that decreases the number of leaders to one within steps in expectation as long as a new leader is not created. Since does not have ability to create a new leader, reaches a configuration in within steps in expectation. By Markov’s inequality, enters within steps with probability . Since is closed by Lemma 4.1, enters within steps with probability at least . ∎
Lemma 4.12.
Let . Then, enters within steps w.h.p.
Proof.
We can assume by Lemma 4.11. As mentioned above, we always assume that is the unique leader in a configuration in . Then, let the population enter , which requires steps w.h.p. by Lemma 2.3. Since a newly generated token is always correct, the next , where , lets the population enter by Lemmas 3.5, 4.4, and 4.5. This requires steps w.h.p. by Lemma 2.3. ∎
Lemma 4.13.
Let . Then, enters within steps w.h.p. for a sufficiently large .
Proof.
By Lemma 3.6, there exists a set of configurations such that (i) enters within steps w.h.p., and (ii) letting , all agents are in the construction mode in the first steps of w.h.p. Thus, does not create a leader in the first steps w.h.p. Therefore, and are the same in the first steps w.h.p. Since is a sufficiently large value, by Lemma 4.12, we conclude that enters within steps w.h.p. ∎
5. Removal of the Orientation Assumption
In this section, we present how to remove the assumption that the population is a directed ring. Specifically, we present a self-stabilizing ring orientation algorithm that uses only states and converges in steps w.h.p. on any (non-directed) ring . As in the previous sections, we assume , but do not assume . Instead, we assume in this section. We define a self-stabilizing ring orientation algorithm as follows.
Definition 5.1 (Self-stabilizing Ring Orientation (SS-RO)).
Let be a protocol that has output variables , where is a positive integer. We say that a configuration of is safe if (i) for any , (ii) holds for any or holds for any , and (iii) at every configuration reachable from , no agent changes the values of the output variables or . A protocol is a self-stabilizing ring orientation (SS-RO) protocol if reaches a safe configuration with probability for any configuration .
The first condition is the specification of a well-known problem called two-hop coloring, by which each agent can distinguish its two neighbors. The second condition give the agents a common sense of direction: each agent points at one of its neighbors, and two neighboring agents and never points at each other, i.e., .
Fortunately, there are several self-stabilizing two-hop coloring protocols (Angluin et al., 2008b; Sudo et al., 2018). We use the protocol presented in (Sudo et al., 2018) here. This protocol uses a polynomial number of colors (i.e., ) to guarantee fast convergence time for arbitrary graphs. However, for a constant degree graph, this protocol converges in sufficiently short time (i.e., steps) w.h.p. with a constant number of colors. Moreover, once two-hop coloring is achieved, the agents can memorize the set of the colors of their two neighbors in steps w.h.p. with states by the following simple protocol:
Each agent memorizes the two different colors that it observes most recently.
Therefore, without loss of generality, we give an SS-RO protocol under the assumption that the first condition of Definition 5.1 is always satisfied, each agent maintains two variables , and these variables always satisfy for any .
The proposed SS-RO protocol, named , is shown in Algorithm 6. In this pseudocode, is the initiator and is the responder. We call a maximal sequence of agents such that with every a right segment. We call a head in this segment. We call a maximal sequence of agents such that with every a left segment. We call a head in this segment. We collectively call those segments just segments. In , each head always tries to extend its segment. When two heads meet, only one of the two heads wins and succeeds in extending its segment (Line 63-69). The lost segment decreases its size by one. Segment extension occurs only when two heads meet. Thus, the number of segments in the population is monotonically non-increasing. When a segment with size one loses, the segment disappears and the number of segments decreases by one or two. Usually, the number of segments decreases by two because when a segment disappears, its two neighboring segments are merged. Only exception is the case where there are only two segments and one of them disappers. Thus, the population will eventually reach a configuration where there is only one segment, at which the ring orientation is achieved.
To speed up the protocol, we introduce a variable . An agent is called strong if . Otherwise, the agent is weak. We have the following rule (Lines 64–69):
-
•
When a strong head and a weak head meets, a strong head always wins.
-
•
When two strong heads meet, the initiator wins.
-
•
When two weak heads meet, the initiator wins and becomes strong.
Moreover, if a non-head agent is strong, it becomes weak in the next interaction (Lines 70–73). Consider that two segments and face each other, i.e., their heads are neighboring. As long as both the segments survive, the number of strong non-heads in those segments is monotonically non-increasing and becomes zero within steps with probability . Then, once the head of a segment wins, the head of always wins thereafter until disappears. This event must occur during a sequence of interactions occurs, which requires steps with probability by Lemma 2.3. Therefore, or disappears in steps with probability . This means that the number of segments in the population decreases by half in each steps with probability . In total, the number of segments becomes one, i.e., the ring orientation is done, in steps w.h.p.
By Lemma 2.4, we have the following theorem.
Theorem 5.2.
There is a self-stabilizing ring orientation (SS-RO) protocol that converges in steps both w.h.p. and in expectation and uses states per agent.
Acknowledgements.
This work was supported by JSPS KAKENHI Grant Numbers 19H04085, 20H04140, 20KK0232, 21K19770, and 22K11903.References
- (1)
- Alistarh et al. (2017) Dan Alistarh, James Aspnes, David Eisenstat, Rati Gelashvili, and Ronald L Rivest. 2017. Time-space trade-offs in population protocols. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms. SIAM, 2560–2579.
- Alistarh et al. (2022) Dan Alistarh, Joel Rybicki, and Sasha Voitovych. 2022. Near-Optimal Leader Election in Population Protocols on Graphs. In Proceedings of the 43rd ACM Symposium on Principles of Distributed Computing. 246–256.
- Angluin et al. (2006) Dana Angluin, James Aspnes, Zoë Diamadi, Michael J. Fischer, and René Peralta. 2006. Computation in networks of passively mobile finite-state sensors. Distributed Computing 18, 4 (2006), 235–253.
- Angluin et al. (2008a) Dana Angluin, James Aspnes, and David Eisenstat. 2008a. Fast computation by population protocols with a leader. Distributed Computing 21, 3 (2008), 183–199.
- Angluin et al. (2008b) Dana. Angluin, J. Aspnes, Michael. J Fischer, and Hong. Jiang. 2008b. Self-stabilizing population protocols. ACM Transactions on Autonomous and Adaptive Systems 3, 4 (2008), 1–28.
- Awerbuch and Ostrovsky (1994) Baruch Awerbuch and Rafail Ostrovsky. 1994. Memory-efficient and self-stabilizing network reset. In Proceedings of the thirteenth annual ACM symposium on Principles of distributed computing. 254–263.
- Beauquier et al. (2013) Joffroy Beauquier, Peva Blanchard, and Janna Burman. 2013. Self-stabilizing leader election in population protocols over arbitrary communication graphs. In International Conference on Principles of Distributed Systems. 38–52.
- Burman et al. (2021) Janna Burman, Ho-Lin Chen, Hsueh-Ping Chen, David Doty, Thomas Nowak, Eric Severson, and Chuan Xu. 2021. Time-optimal self-stabilizing leader election in population protocols. In Proceedings of the 2021 ACM Symposium on Principles of Distributed Computing. 33–44.
- Cai et al. (2012) Shukai Cai, Taisuke Izumi, and Koichi Wada. 2012. How to prove impossibility under global fairness: On space complexity of self-stabilizing leader election on a population protocol model. Theory of Computing Systems 50, 3 (2012), 433–445.
- Canepa and Potop-Butucaru (2007) Davide Canepa and Maria G. Potop-Butucaru. 2007. Stabilizing leader election in population protocols. http://hal.inria.fr/inria-00166632 (2007).
- Chen and Chen (2019) Hsueh-Ping Chen and Ho-Lin Chen. 2019. Self-stabilizing leader election. In Proceedings of the 38th ACM Symposium on Principles of Distributed Computing. 53–59.
- Chen and Chen (2020) Hsueh-Ping Chen and Ho-Lin Chen. 2020. Self-Stabilizing Leader Election in Regular Graphs. In Proceedings of the 39th ACM Symposium on Principles of Distributed Computing. 210–217.
- Cordasco and Gargano (2017) Gennaro Cordasco and Luisa Gargano. 2017. Space-optimal proportion consensus with population protocols. In International Symposium on Stabilization, Safety, and Security of Distributed Systems. 384–398.
- Dijkstra (1974) Edger W. Dijkstra. 1974. Self-stabilizing systems in spite of distributed control. Commun. ACM 17, 11 (1974), 643–644.
- Fischer and Jiang (2006) Michael J. Fischer and Hong Jiang. 2006. Self-stabilizing Leader Election in Networks of Finite-State Anonymous Agents. In International Conference on Principles of Distributed Systems. 395–409.
- Izumi (2015) Taisuke Izumi. 2015. On Space and Time Complexity of Loosely-Stabilizing Leader Election. In International Colloquium on Structural Information and Communication Complexity. 299–312.
- Mertzios et al. (2014) George B Mertzios, Sotiris E Nikoletseas, Christoforos L Raptopoulos, and Paul G Spirakis. 2014. Determining majority in networks with local interactions and very small local memory. In International Colloquium on Automata, Languages, and Programming. 871–882.
- Mitzenmacher and Upfal (2005) Michael Mitzenmacher and Eli Upfal. 2005. Probability and Computing: Randomized Algorithms and Probabilistic Analysis. Cambridge University Press.
- Sudo et al. (2021a) Yuichi Sudo, Ryota Eguchi, Taisuke Izumi, and Toshimitsu Masuzawa. 2021a. Time-optimal Loosely-stabilizing Leader Election in Population Protocols. In 35nd International Symposium on Distributed Computing (DISC 2021). 40:1–40:17.
- Sudo et al. (2016) Yuichi Sudo, Toshimitsu Masuzawa, Ajoy K Datta, and Lawrence L Larmore. 2016. The Same Speed Timer in Population Protocols. In the 36th IEEE International Conference on Distributed Computing Systems. 252–261.
- Sudo et al. (2012) Yuichi Sudo, Junya Nakamura, Yukiko Yamauchi, Fukuhito Ooshita, Hirotsugu. Kakugawa, and Toshimitsu Masuzawa. 2012. Loosely-stabilizing leader election in a population protocol model. Theoretical Computer Science 444 (2012), 100–112.
- Sudo et al. (2014) Yuichi Sudo, Fukuhito Ooshita, Hirotsugu Kakugawa, and Toshimitsu Masuzawa. 2014. Loosely-Stabilizing Leader Election on Arbitrary Graphs in Population Protocols. In International Conference on Principles of Distributed Systems. 339–354.
- Sudo et al. (2020a) Yuichi Sudo, Fukuhito Ooshita, Hirotsugu Kakugawa, and Toshimitsu Masuzawa. 2020a. Loosely Stabilizing Leader Election on Arbitrary Graphs in Population Protocols without Identifiers or Random Numbers. IEICE Transactions on Information and Systems 103, 3 (2020), 489–499.
- Sudo et al. (2018) Yuichi Sudo, Fukuhito Ooshita, Hirotsugu Kakugawa, Toshimitsu Masuzawa, Ajoy K Datta, and Lawrence L Larmore. 2018. Loosely-stabilizing leader election for arbitrary graphs in population protocol model. IEEE Transactions on Parallel and Distributed Systems 30, 6 (2018), 1359–1373.
- Sudo et al. (2020b) Yuichi Sudo, Fukuhito Ooshita, Hirotsugu Kakugawa, Toshimitsu Masuzawa, Ajoy K Datta, and Lawrence L Larmore. 2020b. Loosely-stabilizing leader election with polylogarithmic convergence time. Theoretical Computer Science 806 (2020), 617–631.
- Sudo et al. (2021b) Yuichi Sudo, Masahiro Shibata, Junya Nakamura, Yonghwan Kim, and Toshimitsu Masuzawa. 2021b. Self-stabilizing population protocols with global knowledge. IEEE Transactions on Parallel and Distributed Systems 32, 12 (2021), 3011–3023.
- Thue (1912) Axel Thue. 1912. Uber die gegenseitige Lage gleicher Teile gewisser Zeichenreihen. Kra. Vidensk. Selsk. Skrifer, I. Mat. Nat. Kl. (1912), 1–67.
- Yokota et al. (2021) Daisuke Yokota, Yuichi Sudo, and Toshimitsu Masuzawa. 2021. Time-optimal self-stabilizing leader election on rings in population protocols. IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences 104, 12 (2021), 1675–1684.
Appendix A Chernoff Bounds
Lemma A.1 ((Mitzenmacher and Upfal, 2005), Theorems 4.4, 4.5).
Let be independent Poisson trials, and let . Then
(3) | ||||
(4) |