CPSC 668Set 3: Leader Election in Rings1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.

Slides:



Advertisements
Similar presentations
Leader Election.
Advertisements

Leader Election Breaking the symmetry in a system.
Distributed Leader Election Algorithms in Synchronous Ring Networks
CS 542: Topics in Distributed Systems Diganta Goswami.
CS425 /CSE424/ECE428 – Distributed Systems – Fall 2011 Material derived from slides by I. Gupta, M. Harandi, J. Hou, S. Mitra, K. Nahrstedt, N. Vaidya.
Token-Dased DMX Algorithms n LeLann’s token ring n Suzuki-Kasami’s broadcast n Raymond’s tree.
Chapter 15 Basic Asynchronous Network Algorithms
Leader Election Let G = (V,E) define the network topology. Each process i has a variable L(i) that defines the leader.  i,j  V  i,j are non-faulty.
Distributed Computing 2. Leader Election – ring network Shmuel Zaks ©
Lecture 7: Synchronous Network Algorithms
Outline. Theorem For the two processor network, Bit C(Leader) = Bit C(MaxF) = 2[log 2 ((M + 2)/3.5)] and Bit C t (Leader) = Bit C t (MaxF) = 2[log 2 ((M.
Minimum Spanning Trees
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Self Stabilization 1.
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch.
CPSC 668Set 7: Mutual Exclusion with Read/Write Variables1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
CPSC 668Set 10: Consensus with Byzantine Failures1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
CPSC 668Set 5: Synchronous LE in Rings1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
1 Complexity of Network Synchronization Raeda Naamnieh.
CPSC 668Set 4: Asynchronous Lower Bound for LE in Rings1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
CPSC 668Set 2: Basic Graph Algorithms1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
1 Minimum Spanning Trees Gallagher-Humblet-Spira (GHS) Algorithm.
Asynchronous Consensus (Some Slides borrowed from ppt on Web.(by Ken Birman) )
CPSC 668Set 9: Fault Tolerant Consensus1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
CPSC 668Set 9: Fault Tolerant Consensus1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
CPSC 668Set 12: Causality1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
CPSC 668Set 10: Consensus with Byzantine Failures1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
1 Fault-Tolerant Consensus. 2 Failures in Distributed Systems Link failure: A link fails and remains inactive; the network may get partitioned Crash:
CPSC 668Self Stabilization1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
Leader Election in Rings
Distributed Algorithms (22903) Lecturer: Danny Hendler Leader election in rings This presentation is based on the book “Distributed Computing” by Hagit.
Message Passing Systems A Formal Model. The System Topology – network (connected undirected graph) Processors (nodes) Communication channels (edges) Algorithm.
Message Passing Systems A Formal Model. The System Topology – network (connected undirected graph) Processors (nodes) Communication channels (edges) Algorithm.
Selected topics in distributed computing Shmuel Zaks
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 10 Instructor: Haifeng YU.
Computer Science and Engineering Parallel and Distributed Processing CSE 8380 February 10, 2005 Session 9.
DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch Set 11: Asynchronous Consensus 1.
DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch CSCE
1 Leader Election in Rings. 2 A Ring Network Sense of direction left right.
Leader Election. Leader Election: the idea We study Leader Election in rings.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 5: Synchronous LE in Rings 1.
Lecture #14 Distributed Algorithms (II) CS492 Special Topics in Computer Science: Distributed Algorithms and Systems.
Several sets of slides by Prof. Jennifer Welch will be used in this course. The slides are mostly identical to her slides, with some minor changes. Set.
DISTRIBUTED ALGORITHMS Spring 2014 Prof. Jennifer Welch Set 2: Basic Graph Algorithms 1.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch CSCE 668 Set 3: Leader Election in Rings 1.
1 Fault tolerance in distributed systems n Motivation n robust and stabilizing algorithms n failure models n robust algorithms u decision problems u impossibility.
DISTRIBUTED ALGORITHMS Spring 2014 Prof. Jennifer Welch Set 9: Fault Tolerant Consensus 1.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
1 Fault-Tolerant Consensus. 2 Communication Model Complete graph Synchronous, network.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
Distributed Algorithms (22903) Lecturer: Danny Hendler Leader election in rings This presentation is based on the book “Distributed Computing” by Hagit.
CSE 486/586 CSE 486/586 Distributed Systems Leader Election Steve Ko Computer Sciences and Engineering University at Buffalo.
Distributed Systems Lecture 9 Leader election 1. Previous lecture Middleware RPC and RMI – Marshalling 2.
1 Algorithms for COOPERATIVE DS: Leader Election in the MPS model.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Distributed Algorithms (22903)
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Algorithms for COOPERATIVE DS: Leader Election in the MPS model
Leader Election (if we ignore the failure detection part)
Parallel and Distributed Algorithms
CSE 486/586 Distributed Systems Leader Election
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Lecture 8: Synchronous Network Algorithms
Distributed Algorithms (22903)
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Leader Election Ch. 3, 4.1, 15.1, 15.2 Chien-Liang Fok 4/29/2019
CSE 486/586 Distributed Systems Leader Election
Presentation transcript:

CPSC 668Set 3: Leader Election in Rings1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch

CPSC 668Set 3: Leader Election in Rings2 Ring Networks In an oriented ring, processors have a consistent notion of left and right For example, if messages are always forwarded on channel 1, they will cycle clockwise around the ring

CPSC 668Set 3: Leader Election in Rings3 Why Study Rings? simple starting point, easy to analyze abstraction of a token ring lower bounds and impossibility results for ring topology also apply to arbitrary topologies

CPSC 668Set 3: Leader Election in Rings4 Leader Election Definition Each processor has a set of elected (won) and not-elected (lost) states. Once an elected state is entered, processor is always in an elected state (and similarly for not-elected): i.e., irreversible decision In every admissible execution: –every processor eventually enters either an elected or a not-elected state –exactly one processor (the leader) enters an elected state

CPSC 668Set 3: Leader Election in Rings5 Uses of Leader Election A leader can be used to coordinate activities of the system: –find a spanning tree using the leader as the root –reconstruct a lost token in a token-ring network We will study leader election in rings.

CPSC 668Set 3: Leader Election in Rings6 Anonymous Rings How to model situation when processors do not have unique identifiers? First attempt: require each processor to have the same state machine Subtle point: does algorithm rely on knowing the ring size (number of processors)?

CPSC 668Set 3: Leader Election in Rings7 Uniform (Anonymous) Algorithms A uniform algorithm does not use the ring size (same algorithm for each size ring) –Formally, every processor in every size ring is modeled with the same state machine A non-uniform algorithm uses the ring size (different algorithm for each size ring) –Formally, for each value of n, every processor in a ring of size n is modeled with the same state machine A n. Note the lack of unique ids.

CPSC 668Set 3: Leader Election in Rings8 Leader Election in Anonymous Rings Theorem: There is no leader election algorithm for anonymous rings, even if –algorithm knows the ring size (non-uniform) –synchronous model Proof Sketch: –Every processor begins in same state with same outgoing msgs (since anonymous) –Every processor receives same msgs, does same state transition, and sends same msgs in round 1 –Ditto for rounds 2, 3, … –Eventually some processor is supposed to enter an elected state. But then they all would.

CPSC 668Set 3: Leader Election in Rings9 Leader Election in Anonymous Rings Proof sketch shows that either safety (never elect more than one leader) or liveness (eventually elect at least one leader) is violated. Since the theorem was proved for non- uniform and synchronous rings, the same result holds for weaker (less well-behaved) models: –uniform –asynchronous

CPSC 668Set 3: Leader Election in Rings10 Rings with Identifiers Assume each processor has a unique id. Don't confuse indices and ids: –indices are 0 to n - 1; used only for analysis, not available to the processors –ids are arbitrary nonnegative integers; are available to the processors through local variable id.

CPSC 668Set 3: Leader Election in Rings11 Start with the smallest id and list ids in clockwise order. Example: 3, 37, 19, 4, 25 Specifying a Ring p3p3 p4p4 p0p0 p1p1 p2p2 id = 3 id = 25 id = 4 id = 19 id = 37

CPSC 668Set 3: Leader Election in Rings12 Uniform (Non-anonymous) Algorithms Uniform algorithm: there is one state machine for every id, no matter what size ring Non-uniform algorithm: there is one state machine for every id and every different ring size These definitions are tailored for leader election in a ring.

CPSC 668Set 3: Leader Election in Rings13 Overview of LE in Rings with Ids There exist algorithms when nodes have unique ids. We will evaluate them according to their message complexity. asynchronous ring: –  (n log n) messages synchronous ring: –  (n) messages under certain conditions –otherwise  (n log n) messages All bounds are asymptotically tight.

CPSC 668Set 3: Leader Election in Rings14 O(n 2 ) Messages LE Algorithm send value of own id to the left when receive an id j (from the right): –if j > id then forward j to the left (this processor has lost) –if j = id then elect self (this processor has won) –if j < id then do nothing

CPSC 668Set 3: Leader Election in Rings15 Analysis of O(n 2 ) Algorithm Correctness: Elects processor with largest id. –msg containing largest id passes through every processor Time: O(n) Message complexity: Depends how the ids are arranged. –largest id travels all around the ring (n msgs) –2nd largest id travels until reaching largest –3rd largest id travels until reaching largest or second largest –etc.

CPSC 668Set 3: Leader Election in Rings16 Analysis of O(n 2 ) Algorithm Worst way to arrange the ids is in decreasing order: –2nd largest causes n - 1 messages –3rd largest causes n - 2 messages –etc. Total number of messages is n + (n-1) + (n-2) + … + 1 =  (n 2 ).

CPSC 668Set 3: Leader Election in Rings17 Can We Use Fewer Messages? The O(n 2 ) algorithm is simple and works in both synchronous and asynchronous model. But can we solve the problem with fewer messages? Idea: –Try to have msgs containing smaller ids travel smaller distance in the ring

CPSC 668Set 3: Leader Election in Rings18 O(n log n) Leader Election Algorithm Each proc. tries to probe successively larger neighborhoods in both directions –size of neighborhood doubles in each phase If probe reaches a node with a larger id, the probe stops If probe reaches end of its neighborhood, then a reply is sent back to initiator If initiator gets back replies from both directions, then go to next phase If proc. receives a probe with its own id, it elects itself

CPSC 668Set 3: Leader Election in Rings19 O(n log n) Leader Election Algorithm

CPSC 668Set 3: Leader Election in Rings20 Analysis of O(n log n) Leader Election Algorithm Correctness: Similar to O(n 2 ) algorithm. Message Complexity: –Each msg belongs to a particular phase and is initiated by a particular proc. –Probe distance in phase i is 2 i –Number of msgs initiated by a proc. in phase i is at most 4*2 i (probes and replies in both directions)

CPSC 668Set 3: Leader Election in Rings21 Analysis of O(n log n) Leader Election Algorithm How many procs. initiate probes in phase i ? For i = 0, every proc. does For i > 0, every proc. that is a "winner" in phase i - 1 does –"winner" means has largest id in its 2 i-1 neighborhood

CPSC 668Set 3: Leader Election in Rings22 Analysis of O(n log n) Leader Election Algorithm Maximum number of phase i - 1 winners occurs when they are packed as densely as possible: total number of phase i - 1 winners is at most n/(2 i-1 + 1)

CPSC 668Set 3: Leader Election in Rings23 Analysis of O(n log n) Leader Election Algorithm How many phases are there? At each phase the number of (phase) winners is cut in half (at least) So after at most log 2 n phases, only one winner is left.

CPSC 668Set 3: Leader Election in Rings24 Analysis of O(n log n) Leader Election Algorithm Total number of messages is sum, over all phases, of number of winners at that phase times number of messages originated by that winner: phase 0 msgs msgs for phases 1 to log n termination msgs

CPSC 668Set 3: Leader Election in Rings25 Can We Do Better? The O(n log n) algorithm is more complicated than the O(n 2 ) algorithm but uses fewer messages in worst case. Works in both synchronous and asynchronous case. Can we reduce the number of messages even more? Not in the asynchronous model…