Distributed Algorithms (22903)

Slides:



Advertisements
Similar presentations
Chapter 5: Tree Constructions
Advertisements

Chapter 13 Leader Election. Breaking the symmetry in system Similar to distributed mutual exclusion problems, the first process to enter the CS can be.
Leader Election Breaking the symmetry in a system.
Distributed Leader Election Algorithms in Synchronous Ring Networks
CS 542: Topics in Distributed Systems Diganta Goswami.
Lecture 8: Asynchronous Network Algorithms
Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks ©
Token-Dased DMX Algorithms n LeLann’s token ring n Suzuki-Kasami’s broadcast n Raymond’s tree.
Chapter 15 Basic Asynchronous Network Algorithms
Multiprocessor Synchronization Algorithms ( ) Lecturer: Danny Hendler The Mutual Exclusion problem.
Distributed Computing 2. Leader Election – ring network Shmuel Zaks ©
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.
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 7 Instructor: Haifeng YU.
CPSC 668Set 10: Consensus with Byzantine Failures1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday:
CPSC 668Set 5: Synchronous LE in Rings1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
CPSC 668Set 4: Asynchronous Lower Bound for LE in Rings1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
CPSC 668Set 3: Leader Election in Rings1 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.
Distributed systems Module 2 -Distributed algorithms Teaching unit 1 – Basic techniques Ernesto Damiani University of Bozen Lesson 4 – Consensus and reliable.
 Idit Keidar, Principles of Reliable Distributed Systems, Technion EE, Spring Principles of Reliable Distributed Systems Lecture 12: Impossibility.
Message Passing Systems A Formal Model. The System Topology – network (connected undirected graph) Processors (nodes) Communication channels (edges) Algorithm.
Election Algorithms and Distributed Processing Section 6.5.
Message Passing Systems A Formal Model. The System Topology – network (connected undirected graph) Processors (nodes) Communication channels (edges) Algorithm.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 8 Instructor: Haifeng YU.
Computer Science and Engineering Parallel and Distributed Processing CSE 8380 February 10, 2005 Session 9.
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.
Distributed systems Consensus Prof R. Guerraoui Distributed Programming Laboratory.
Impossibility of Distributed Consensus with One Faulty Process By, Michael J.Fischer Nancy A. Lynch Michael S.Paterson.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch CSCE 668 Set 3: Leader Election in Rings 1.
Alternating Bit Protocol S R ABP is a link layer protocol. Works on FIFO channels only. Guarantees reliable message delivery with a 1-bit sequence number.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
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.
1 Algorithms for COOPERATIVE DS: Leader Election in the MPS model.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSE 486/586 Distributed Systems Leader Election
Lecture 17: Leader Election
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Algorithms for COOPERATIVE DS: Leader Election in the MPS model
Lecture 9: Asynchronous Network Algorithms
Formal Models of Distributed Systems
MST GALLAGER HUMBLET SPIRA ALGORITHM
Alternating Bit Protocol
Distributed Consensus
Agreement Protocols CS60002: Distributed Systems
Parallel and Distributed Algorithms
Leader Election CS60002: Distributed Systems
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSE 486/586 Distributed Systems Leader Election
CSE 486/586 Distributed Systems Mutual Exclusion
MST GALLAGER HUMBLET SPIRA ALGORITHM
CS210- Lecture 5 Jun 9, 2005 Agenda Queues
Lecture 8: Synchronous Network Algorithms
Distributed Algorithms (22903)
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
Distributed algorithms
CIS825 Lecture 5 1.
CSE 486/586 Distributed Systems Mutual Exclusion
Locality In Distributed Graph Algorithms
CSE 486/586 Distributed Systems Leader Election
Presentation transcript:

Distributed Algorithms (22903) Leader election in rings Lecturer: Danny Hendler This presentation is based on the book “Distributed Computing” by Hagit attiya & Jennifer Welch

Message-passing systems 1 1 2 1 3 2 2 1 p2 Processes are represented by graph nodes Bi-directional (unless otherwise stated) labeled communication links (reliable, FIFO) Each process pi (having r links) has state consisting of: Program state inbufi[m], 1 ≤ m ≤ r outbufi[m], 1 ≤ m ≤ r (this is inaccessible to pi)

Message-passing systems (cont'd) 1 1 2 1 3 2 2 1 p2 A Configuration is a vector of process states (q0, …, qn-1) In the initial configuration inbuf buffers are empty outbuf buffers may contain messages

Synchronous message-passing systems 1 1 2 1 3 2 2 1 p2 Computation proceeds in rounds In each round: All messages in the outbuf buffers are delivered Each process performs a computational step and sends at most a single message on every link.

Asynchronous message-passing systems 1 1 2 1 3 2 2 1 p2 No fixed upper bound on the delay of a message or the time between computation steps An execution is a sequence of events: comp(i) – a computational step by process i del(i,j,m) – the delivery of message m from pi to pj

Leader Election in Rings p0 2 1 1 2 p2 p1 2 1 Each process has to decide whether it is a leader or not Termination states are partitioned to elected and not-elected. In every execution, exactly one process enters an elected state, all others enter a non-elected state. We assume rings are oriented.

Leader election in anonymous (synchronous) rings p 2 1 1 2 p p 2 1 A ring algorithm is anonymous if processes don’t have an ID they can use in the algorithm (all perform the same code) An anonymous leader election algorithm …Is impossible!!... What about the asynchronous model? The set of asynch. executions is a superset of the set of synch. executions

A simple algorithm for (non-anonymous) asynchronous rings Each process sends probe(ID) to its left neighbor (and then waits) Upon receiving a message probe(i) (from the right) if (i > ID) forward message to the left if (i=ID) send terminate(ID) and terminate as leader Upon receiving terminate(i) forward message to the left and terminate as non-leader Message complexity is… Θ(n2)

A more efficient asynchronous leader election algorithm Processes may join the algorithm either by spontaneous wakeup at the same time or by receiving a message from an awake process Only spontaneously awakened processes actively participate – the process with maximum ID wins Algorithm proceeds in phases In phase j, a process tries to become the temporary leader of its 2j-neighborhood Has to have maximum ID in this neighborhoud Only temporary leaders of phase-j continue to phase j+1

A more efficient asynchronous leader election algorithm Processes may join the algorithm either by spontaneous wakeup at the same time or by receiving a message from an awake process Only spontaneously awakened processes actively participate – the process with maximum ID wins Algorithm proceeds in phases In phase j, a process tries to become the temporary leader of its 2j-neighborhood Has to have maximum ID in this neighborhoud Only temporary leaders of phase-j continue to phase j+1

An O(n log n) messages asynchronous leader election algorithm (cont’d) Initially, asleep=true, participating=false Upon receiving no message (spontaneous wakeup) asleep:=false, participating=true send probe(ID, 0, 1) to left and right Upon receiving probe(j,l,d) from left (resp., right) if (j=ID) terminate as leader ;a termination message should be sent if (j>ID or participating) and (d<2l) send probe(j,l,d+1) to right (resp., left) if (j>ID or participating) and (d = 2l) send reply(j,l) to left (resp. right) Upon receiving reply(j,l) from left (resp., right) if (j ≠ ID) send reply(j,l) to right (resp., left) else if already received reply(j,l) from right (resp. left) send probe(ID,l+1,1) to left and right

The message complexity of the asynchronous leader election algorithm is O(n log n)

An (n log n) lower bound on the number of messages for asynchronous rings A ring algorithm is uniform if it has no knowledge of the size of the ring. It is non-uniform if it can use its knowledge about the size of the ring. We’ll see a proof for uniform algorithms where the process with the maximum ID must be elected and all other processes must learn its ID (write it to some local variable).

Pasting R1 and R2 into R (illustration 1. for Lemma 6) q1 q2 p1 p2 ep R1 R2 eq q1 q2

Induction step of lower bound (illustration 2. for Lemma 6) eq q1 q2 Q

An O(n) messages Non-uniform Algorithm for Synchronous Rings Initially phase:=0 and round :=0 if (phase = ID) send Leader(ID) terminate as leader else round:=round+1 if (round = n) phase:=phase+1 round=0 Upon receiving Leader(j) if (round < n-1) send Leader(j) terminate as non-leader Synchronized start Only clockwise links are used Time complexity? n(minID+1)

An O(n) messages Uniform Algorithm Does not rely on synchronized start: a preliminary wake-up phase is added (first-phase messages) Processes that do not wake-up spontaneously act as relays Messages from process with ID i travel at speed 1/2i (second-phase messages)

An O(n) messages uniform Algorithm (cont’d) Initially waiting is empty and status=asleep Let R be the set of messages received in this computation round S := empty set ; Set of IDs to send if (status=asleep) then if (R is empty) ; Woke-up spontaneously status:=participating min := ID ; add (ID,1) to S ; First-phase message Else status=relay, min := ∞ ; Act as a relay for each <m , h > in R do if (m < min) become not elected min:=m if (status=relay) and (h=1) add < m, 1 > to S ; m stays first-phase else add <m, 2> to waiting tagged with current round number elseif (m = ID) become elected ; if m>min message is swallowed for each <m,2 > in waiting do if <m,2 > was received 2m-1 rounds ago remove <m, 2 > from waiting and add to S Send S to left

A proof that the algorithm has linear complexity