Distributed Leader Election Krishnendu Mukhopadhyaya Indian Statistical Institute, Kolkata
Outline Distributed Systems Distributed Systems: Issues Leader Election – Synchronous ring – LCR Algorithm – HS Algorithm – TimeSlice Algorithm – VariableSpeeds Algorithm – Flooding Geometric Leader Election of Swarm Robots
Distributed Systems A collection of computing elements with no common clock or memory.
Distributed Systems: Issues Timing Model Synchronous / Asynchronous / Semi-sync Failure Model Complete / Transient / Byzantine Unknown number of processes Unknown topology Uncertain message delivery times Unknown message ordering
Leader Election unique A set of processes agree on a unique process as the leader. Required for Token regeneration Central process selection Execute a task etc.
Leader Election: Synchronous Ring n-1 n-2 4 5
Leader Election: Synchronous Ring Variations: Ring Unidirectional / Bidirectional No. of processes known / unknown Processes identical / have UID Restriction on manipulation of UID
Leader Election: Synchronous Ring Theorem: Let A be a system of n processes (n>1) arranged in a bidirectional ring. If all processes in A are identical, then A does not solve the leader- election problem.
Leader Election: Synchronous Ring Proof: Suppose A solves the leader-election problem. Consider an execution of A with identical start states. If any process reaches “LEADER” status after r rounds, all processes reach the same state.
LCR Algorithm (Le Lann – Chang – Roberts) Unidirectional communications Knowledge about n not required Only comparison of UIDs Only leader outputs result Algorithm Each process send its UID along the ring If UID(recd) < UID(i) discard message
LCR Algorithm: Correctness Lemma: Process i max outputs leader by end of round n. Assertion: For 0 ≤ r ≤ n-1, after r rounds, send i max + r = UID max Assertion: After n rounds, status i max = leader
LCR Algorithm: Correctness Lemma: No process other than i max outputs the value leader. Assertion: After r rounds, if i = i max and j ∈ [i max, i) then send j ≠ UID i
LCR Algorithm: Correctness Theorem: LCR solves the leader-election problem. Complexity: n rounds till leader is elected communication complexity O(n 2 ) messages
HS Algorithm Hirschberg – Sinclair Bidirectional ring Ring size unknown Operates in phases 0, 1,2,... Works for variable start times
HS Algorithm Algorithm for process i Initiates only if it received back both of its tokens in the last phase. In phase k sends tokens containing UID i in both directions. Tokens are intended to travel distance 2 k and return. If it receives outbound token UID j then If i > j then discards token If i < j then forwards token If i = j then elects itself leader.
HS Algorithm: Message Complexity Phase 0: 4n messages Phase k (k>0): In a group of consecutive 2 k-1 +1 processes, at most one goes on to initiate in phase k. At most ⌊ n/(2 k-1 +1) ⌋ processes initiate tokens in phase k. Total number of messages in phase k is 4.2 k ⌊ n/(2 k-1 +1) ⌋ ≤ 8n. Total number of messages is ≤ 8n (1 + ⌈ log n ⌉ ), which is O(n log n).
HS Algorithm: Time Complexity Time for Phase k: 2. 2 k = 2 k+1 Time for last-but-one Phase: 2 log n+1 Time for final Phase: n (only outbound traffic) Total time complexity is O(n).
TimeSlice Algorithm Features: Selects leader in less than O(n log n) messages UIDs are positive integers; can be manipulated like general arithmetic operations Ring size n is known to all processes Unidirectional ring
TimeSlice Algorithm Algorithm: Runs in phases 1, 2,..., each of n rounds Phase v has rounds (v-1)n +1,..., vn In phase v, process with UID v (if it exists), elects itself leader, if it has not received any non-null message. Complexity: Messages: n messages Time: n. u min (unbounded)
VariableSpeeds Algorithm Features: Selects leader using O(n) messages UIDs are positive integers; can be manipulated like general arithmetic operations Ring size n is not known Unidirectional ring
VariableSpeeds Algorithm Algorithm: Each process creates a token with its UID For a token carrying UID v, a process waits 2 v rounds, before it forwards it. Complexity: Messages: Exactly n distinct messages. Total messages less than 2n. Time: n. 2^(u min )
Leader Election: General Synchronous Networks Flooding: max Each process maintains the max UID it has seen so far max At each round, each process propagates this max along all its edges. diammax After diam rounds, if this max is still the UID of the process, the process declares itself leader; else it is a non- leader. max No. of messages is reduced, if a process broadcasts its max only when it changes.
Sruti Gan Chaudhury Geometric Leader Election for Swarm Robots Slides by: Sruti Gan Chaudhury
Outline What is Geometric Leader Election? The Robot Model Background of the work - Geometric Problems of swarm Robots. - Why Leader Election? Previous Work Our Approach Reference
Geometric Leader Election for Swarm Robots Swarm robots - multiple low cost autonomous mobile robots cooperatively performing tasks. Given a set of such swarm robots scattered on the plane, what are the (minimal) geometric conditions for them to be able to deterministically agree on a single robot as leader?
Robots Model Dimensionless or point (or unit disc) Autonomous Homogeneous Oblivious Distributed coordinate system No communication Moves on 2D plane Execute Look-compute-move cycle (asynchronously) x x x x x x y y y y y y
Look-Compute-Move Look RvRv Visibility radius/range (R v ) may be infinite Takes snapshot
Look-Compute-Move Compute Computes destination: P P
Look-Compute-Move Move Moves to P in straight line. SYM model: - Instantaneous. - when the robot is moving other robots can not see it. CORDA model: - not Instantaneous. - when the robot is moving other robots can see it. P
Geometric Problems of Swarms Gathering: - gathering multiple autonomous mobile robots into a point or a small region - The choice of the point is not known in advance Arbitrary Pattern Formation: - forming different geometric patterns such as straight line, circle, polygon etc. by the robot swarms. Leader Election : - electing a unique robot among a set of robots. - Leader election is needed for Gathering and Pattern Formation.
Why Leader Election ? Compute a destination point C (invariant) C Select one (nearest to C) robot and move it to C Tie occurs if multiple robots are equidistant from C Leader Election is required to break this tie
Given the positions of n swarm robots in the plane, the n robots are able to deterministically agree on the same position L called the leader. Yoann Dieudonn´e and Franck Petit worked on “Deterministic Leader Election in Anonymous Sensor Networks Without Common Coordinated System”. Previous Work
Sense of Direction and Chirality The robots agree on a common direction of one axis (x or y) and its orientation. The sense of direction is said to be partial if the agreement relates to the direction only - i.e., they are not required to agree on the orientation. The robots have chirality if they share the same handedness.
Sense of Direction and Chirality (a)Sense of Direction and Chirality (b) Sense of Direction and No Chirality (c) No Sense of Direction and Chirality (d) No Sense of Direction and No Chirality x y y y y y y y y y y y y x x x x x x x x x
Lyndon word A word w (|w|>0) is a Lyndon word if and only if w is nonempty, primitive and strictly minimal, i.e., w != and for all j in{ 2,..., |w|}, w < R j (w). Let u and v be the words. k is an integer. A word u is said to be primitive if and only if u = v k where k = 1 A word u is said to be strictly periodic if and only if u = v k where k > 1 The j th rotation of a word w is defined by : R j (w) = if w = a j,…,a 1,…,a j-1 otherwise (w = a 1,…,a l l > 1) A word w is said to be minimal if and only if for all j in {1,..., l}, w < R j (w)
Leader Election with Chirality O a b c c c c c c d e r A word W(r) is associated with a robot R at r distance apart from the center of SEC (O), such that, W(R) = (abc, β) (c 2,γ) 2 (c,γ)(d,β)(e,α). Theorem 1. Leader election is possible if and only if there exists a robot R such that W(R) is a Lyndon Word. Proof : If W(R) is a Lyndon Word then R is unique. The leader is the robot on the radius which is the nearest from the center of SEC. R SEC
Leader Election with Chirality If there exists no robot R such that W(R) is a Lyndon Word, then for each R, W(R) is strictly periodic. For each robot there exists at least another robot which has the same view of the world. x x x x x x a b ab d d
Leader Election without Chirality d d d d x x xx Theorem 2: Without chirality, leader election is possible if and only if n (number of robots ) is odd and there exists r such that W(r) is a Lyndon Word. Without chirality, if the number of robots is even, leader election may not be possible. Ex: Ref. to the figure, For any orientation, there exists one Lyndon Word = (d, )(d, )(d, )(d, ). The symmetry of the configuration does not allow to choose any sensor as a Leader.
Our Approach Leader election is not sufficient for Gathering and Arbitrary pattern formation. Ex: Leader election is possible but gathering is not possible. C Leader STUCK
Our Approach Given a set of robots on the 2D plane, we order the robots with respect to the destination. Ordering is invariant. The first robot in the ordering is leader C Leader
Our Results and Discussions Ordering is possible if and only if robots are in asymmetric configuration. C C Ordering Possible Ordering not Possible Line of symmetry
References [1] Nancy A. Lynch, Distributed Algorithms. [2] Yoann Dieudonn´e and Franck Petit worked on “Deterministic Leader Election in Anonymous Sensor Networks Without Common Coordinated System”, INRIA Lab, [3] S. Gan Chaudhuri, K. Mukhopadhaya, Gathering Asynchronous Transparent Fat Robots, ICDCIT 2010.