◄ WORLD V · SONNY 5DART 216 · a helldive at the net

THE LEADER ELECTION the highest id wins the ring

Before a group can act as one it must pick a single coordinator — from symmetric peers, with no boss to appoint one. Chang–Roberts solves it on a ring: each node forwards the largest id it has seen; the token travels the circle and only the true maximum returns to its own sender, who declares itself leader. A deterministic tie-break (the id) and a topology (the ring) turn a symmetry into a single, agreed choice.

THE TECHNIQUE forward the running max around the ring; max returns to itself → leader

Give a ring of nodes their ids and send the election around: each passes on the biggest id it has seen, and the one whose own id comes back is the leader — always the maximum: live demo


HISTORY & CREDIT LeLann 1977 · Chang & Roberts 1979

“Electing a leader among equals needs randomness or a central authority.” — neither. A total order on ids plus a ring is enough: the maximum is the one value that survives every pairwise comparison, so it is the unique fixed point of “forward the larger.” Determinism, not dice. cited

1977 · Gérard LeLann — the first ring-based election.
1979 · Chang & Roberts — the efficient ring algorithm: forward only ids larger than your own, average O(n log n) messages.
1982 · Garcia-Molina — the Bully algorithm: the same “highest id wins” on a fully connected network with crash recovery.

The winner is not the strongest or the first — it is simply the maximum, the one value no other can beat in a comparison. Leadership as the survivor of a total order. Chang–Roberts 1979

RECOMMEND FOR I-13 the ring elects the maximum id, computed

On the canonical compiler, a ring of ids [3, 17, 9, 42, 8] elects 42 — the maximum, the only id that returns to its own sender:

$ i13 run leader.i13 # ring [3,17,9,42,8], forward the running max elected = 42 -- the maximum id; the one value that survives every comparison
Recommend: leader election is LIT for I-13 — verified a ring of [3,17,9,42,8] elects 42, the maximum. It is a fold of max around a cycle: symmetric peers reach an agreed, unique coordinator with no central authority and no randomness — the prerequisite for Raft's very first move.