All-Initiator Unidirectional FIFO Ring Election Steps #
Intermediate steps for unidirectional asynchronous FIFO ring election on Fin n (n ≥ 1) with
injective identifiers uid : Fin n → U when all n nodes initiate simultaneously and the election
pass ends upon the maximum-identifier node receiving its own identifier back (steps towards
Chang and Roberts, not the arbitrary-initiator or announcement-pass endpoints of
[ChangRoberts1979]).
Initially every node i : Fin n injects its own identifier uid i into its outgoing clockwise
FIFO channel i → i + 1 (crAllInit). Whenever the channel target - 1 → target is nonempty, its
oldest message m may be delivered to target (crStep, crLTS):
- if
uid target < m,targetforwardsmontotarget → target + 1; - if
m < uid target,targetdiscardsm; - if
m = uid target,targetsetsisLeader target := truewithout forwardingm.
Because each node's forwarding decision compares m only against its static identifier
uid target, every token uid s traverses a schedule-independent clockwise arc of length
crHops uid s ∈ {1, …, n} until hitting the first node j with uid s ≤ uid j. Tracking per-node
delivery progress yields:
- Safety and termination steps (
crAllInit_isLeader_le,crAllInit_isLeader_iff_max,crAllInit_terminates): in every state reachable fromcrAllInit uid, only auid-maximizer can setisLeader = true; every execution terminates in at most∑ s, crHops uid sdeliveries; and every quiescent reachable state elects the uniqueuid-maximizing nodei*while allj ≠ i*haveisLeader j = false. - Worst-case and best-case message steps (
crAllInit_messages_le,crAllInit_totalMsgs_rev_eq,crAllInit_totalMsgs_id_eq): total messages transmitted fromcrAllInit uidsatisfycrAllInitMsgs uid sched ≤ n * (n + 1) / 2, attainingn * (n + 1) / 2onFin.revand2 * n - 1onid. - Average-case step (
crAllInit_avg_totalMsgs_eq): over uniform random identifier permutationsσ : Equiv.Perm (Fin n), the average ofcrAllInitTotalMsgsequals∑ k ∈ Finset.Icc 1 n, (n : ℚ) / k, proved via clockwise arc partitioning (sum_arcLen_eq) and left-composition withEquiv.swap v uwithin upper-level sets.
Main definitions #
Cslib.Distributed.RingElection.CRConfig,crAllInit,crStep,crLTS,crExec: asynchronous FIFO configurations, simultaneous all-initiator start state, transitions, and LTS.Cslib.Distributed.RingElection.crAllInitMsgs,crAllInitTotalMsgs,crHops: operational and combinatorial message/hop counts for simultaneous all-node initiation.
Main results #
Cslib.Distributed.RingElection.crAllInit_isLeader_le: safety step fromcrAllInit uid.Cslib.Distributed.RingElection.crAllInit_isLeader_iff_max: quiescent leader characterization step fromcrAllInit uid.Cslib.Distributed.RingElection.crAllInit_terminates: bounded-termination and unique-leader step fromcrAllInit uid.Cslib.Distributed.RingElection.crAllInit_execMsgs_eq_totalMsgs,Cslib.Distributed.RingElection.crAllInit_messages_le: complete-run message-count step and≤ n * (n + 1) / 2bound step fromcrAllInit uid.Cslib.Distributed.RingElection.crAllInit_totalMsgs_rev_eq,Cslib.Distributed.RingElection.crAllInit_totalMsgs_id_eq:n * (n + 1) / 2and2 * n - 1evaluation steps forcrAllInitTotalMsgs.Cslib.Distributed.RingElection.crAllInit_avg_totalMsgs_eq:n H_npermutation-average step forcrAllInitTotalMsgs.
References #
Operational asynchronous FIFO ring model #
Global configuration of unidirectional FIFO ring election on Fin n.
Whether node
ihas received its own identifier back and declared leadership.Clockwise FIFO channel on directed edge
i → i + 1(head is oldest, tail is newest).
Deliver the oldest message on channel target - 1 → target to node target (no-op if empty):
forward if uid target < m, drop if m < uid target, and set isLeader target := true if
m = uid target.
Total messages transmitted across edges in schedule sched from crAllInit uid: the n
initial identifier injections plus all subsequent message forwardings.
Clockwise arc lengths and per-token hop counts #
Clockwise hop count made by node s's initial message uid s before reaching the first node
j with uid s ≤ uid j (1 ≤ crHops uid s ≤ n).
Total number of edge transmissions in a complete election pass from crAllInit uid.
Message conservation and reachable-state invariant #
Correctness and termination theorems #
A safety step for simultaneous all-initiator unidirectional FIFO ring election (a step towards
Chang and Roberts, not the arbitrary-initiator endpoint): in any configuration
reachable from crAllInit uid, if cfg.isLeader i = true then uid i maximizes uid.
A quiescent-characterization step for simultaneous all-initiator unidirectional FIFO ring
election (a step towards Chang and Roberts, not the arbitrary-initiator
endpoint): at any quiescent (LTS.IsTerminal) state reachable from crAllInit uid,
cfg.isLeader i = true iff uid i is the global maximum identifier.
A complete-run message-count step for simultaneous all-initiator unidirectional FIFO ring
election (a step towards Chang and Roberts, not the cited endpoint): every
quiescent configuration reachable from crAllInit uid was reached in crAllInitTotalMsgs uid
deliveries and transmitted crAllInitTotalMsgs uid messages in total.
A bounded-termination and unique-leader step for simultaneous all-initiator unidirectional FIFO
ring election (a step towards Chang and Roberts, not the arbitrary-initiator
endpoint): every configuration reachable from crAllInit uid extends to quiescence, and every
reachable quiescent state elects the unique uid-maximizing node i*.
Tight worst-case and best-case message bounds #
A worst-case operational message-bound step for simultaneous all-initiator unidirectional FIFO
ring election (a step towards Chang and Roberts, not the cited endpoint): in
every execution (crLTS uid).MTr (crAllInit uid) sched cfg, total messages transmitted satisfy
crAllInitMsgs uid sched ≤ n * (n + 1) / 2.
A reverse-ordered evaluation step for crAllInitTotalMsgs (a step towards
Chang and Roberts, not the cited endpoint): when identifiers decrease along the
clockwise traversal direction (Fin.rev : Fin n → Fin n), every node s sends its token
n - s.val hops to node 0, giving n * (n + 1) / 2 total messages.
An increasing-order evaluation step for crAllInitTotalMsgs (a step towards
Chang and Roberts, not the cited endpoint): when identifiers increase clockwise
(id : Fin n → Fin n), nodes 0, …, n - 2 travel 1 hop while node n - 1 travels n hops,
giving 2 * n - 1 total messages.
Exact n H_n average-case message complexity #
An average-case step for simultaneous all-initiator unidirectional FIFO ring election (a step
towards Chang and Roberts, not the cited endpoint): averaged uniformly over all
n! identifier permutations σ : Equiv.Perm (Fin n), crAllInitTotalMsgs equals
∑ k ∈ Finset.Icc 1 n, (n : ℚ) / k.