CIS 825 Lecture 8. Leader Election Aim is to elect exactly one node as the leader.

Slides:



Advertisements
Similar presentations
Energy-Efficient Distributed Algorithms for Ad hoc Wireless Networks Gopal Pandurangan Department of Computer Science Purdue University.
Advertisements

Chapter 5: Tree Constructions
Distributed Minimum Spanning Tree Gallagher, Humblet, Spira (1983) pseudocode adaptation by Kenneth J. Goldman September 2002.
Chapter 13 Leader Election. Breaking the symmetry in system Similar to distributed mutual exclusion problems, the first process to enter the CS can be.
UBE529 Distributed Coordination. 2 Leader Election Gerard LeLann posed the Election problem in a famous paper 1977 Many distributed systems are client.
Leader Election Breaking the symmetry in a system.
Distributed Leader Election Algorithms in Synchronous Ring Networks
Introduction to Computer Networks Spanning Tree 1.
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.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Leader Election Steve Ko Computer Sciences and Engineering University at Buffalo.
Lecture 8: Asynchronous Network Algorithms
Token-Dased DMX Algorithms n LeLann’s token ring n Suzuki-Kasami’s broadcast n Raymond’s tree.
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.
1 2 Lecture Outline 1.Problem description TThe distinct weights demand 2.Review of spanning trees PProperties of spanning trees KKruskal’s algorithm.
Lecture 7: Synchronous Network Algorithms
Minimum Spanning Trees
Minimum Spanning Trees
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 7 Instructor: Haifeng YU.
1 Complexity of Network Synchronization Raeda Naamnieh.
1 Minimum Spanning Trees Gallagher-Humblet-Spira (GHS) Algorithm.
CPSC 668Set 3: Leader Election in Rings1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
Computer Science Lecture 11, page 1 CS677: Distributed OS Last Class: Clock Synchronization Logical clocks Vector clocks Global state.
Leader Election in Rings
A Distributed Algorithm for Minimum-Weight Spanning Trees by R. G. Gallager, P.A. Humblet, and P. M. Spira ACM, Transactions on Programming Language and.
Raeda Naamnieh 1. The Partition Algorithm Intuitively, the idea of the following algorithm is to choose each cluster as a maximal subset of nodes whose.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
Election Algorithms and Distributed Processing Section 6.5.
Election Algorithms. Topics r Issues r Detecting Failures r Bully algorithm r Ring algorithm.
Distributed Algorithms 2014 Igor Zarivach A Distributed Algorithm for Minimum Weight Spanning Trees By Gallager, Humblet,Spira (GHS)
Broadcast & Convergecast Downcast & Upcast
Minimum Spanning Tree Given a weighted graph G = (V, E), generate a spanning tree T = (V, E’) such that the sum of the weights of all the edges is minimum.
Diffusing Computation. Using Spanning Tree Construction for Solving Leader Election Root is the leader In the presence of faults, –There may be multiple.
Review for Exam 2. Topics included Deadlock detection Resource and communication deadlock Graph algorithms: Routing, spanning tree, MST, leader election.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms –Bully algorithm.
ADITH KRISHNA SRINIVASAN
1 Shape Segmentation and Applications in Sensor Networks Xianjin Xhu, Rik Sarkar, Jie Gao Department of CS, Stony Brook University INFOCOM 2007.
1 Leader Election in Rings. 2 A Ring Network Sense of direction left right.
Diffusing Computation. Using Spanning Tree Construction for Solving Leader Election Root is the leader In the presence of faults, –There may be multiple.
Minimum Spanning Tree. Given a weighted graph G = (V, E), generate a spanning tree T = (V, E’) such that the sum of the weights of all the edges is minimum.
Leader Election (if we ignore the failure detection part)
Tree Constructions Distributed Algorithms for Multi-Agent Networks Instructor: K. Sinan YILDIRIM.
Hwajung Lee. 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 ::
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch CSCE 668 Set 3: Leader Election in Rings 1.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
1 Chapter 11 Global Properties (Distributed Termination)
CIS 825 Review session. P1: Assume that processes are arranged in a ring topology. Consider the following modification of the Lamport’s mutual exclusion.
Minimum Spanning Tree Given a weighted graph G = (V, E), generate a spanning tree T = (V, E’) such that the sum of the weights of all the edges is minimum.
CSE 486/586 CSE 486/586 Distributed Systems Leader Election Steve Ko Computer Sciences and Engineering University at Buffalo.
CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Transactions are communications with ACID property: Atomicity: all or nothing Consistency:
Distributed Systems Lecture 9 Leader election 1. Previous lecture Middleware RPC and RMI – Marshalling 2.
CIS 825 Lecture 9. Minimum Spanning tree construction Each node is a subtree/fragment by itself. Select the minimum outgoing edge of the fragment Send.
Paola Flocchini Election in Arbitrary Networks Mega-Merger Yo-Yo Some Considerations.
Asstt. Professor Adeel Akram. Other Novel Routing Approaches Link reversal Aimed for highly dynamic networks Goal: to identify some path, as opposed.
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 ::
Khaled M. Alzoubi, Peng-Jun Wan, Ophir Frieder
CSE 486/586 Distributed Systems Leader Election
A Distributed Algorithm for Minimum-Weight Spanning Trees
Election algorithm Who wins? God knows.
Election in the Complete Graph
CS60002: Distributed Systems
Lecture 9: Asynchronous Network Algorithms
Leader Election (if we ignore the failure detection part)
MST GALLAGER HUMBLET SPIRA ALGORITHM
Minimum Spanning Tree.
CSE 486/586 Distributed Systems Leader Election
MST GALLAGER HUMBLET SPIRA ALGORITHM
Lecture 8: Synchronous Network Algorithms
Chapter 15.5 from “Distributed Algorithms” by Nancy A. Lynch
CSE 486/586 Distributed Systems Leader Election
Presentation transcript:

CIS 825 Lecture 8

Leader Election Aim is to elect exactly one node as the leader.

Bully Algorithm Assumes a complete network Uses timeouts to detect failures Node with the highest id is elected the leader

Bully algorithm Any process P i : - leader i = id i send elect(leader i ) to all nodes num_recd i = 0 while (num_recd i != n-1) do receive elect(y) from a process; num_recd i ++; if y > leader i then leader i = y;

Algorithm Process failures: On detecting failure of leader send elect(id i ) to all nodes with larger ids start timer On receiving elect(y) from P x if y < id i then send nack(id i ) to P x send elect(id i ) to all nodes with larger ids; start timer

if y > id i then cancel timer On receiving nack(y), cancel timer Timeout: send elected(id i ) to all processes On recovery, try to elect yourself as the leader.

Election in a ring Send message around the ring with your id If P i receives a message with id x and id i < x then P i forwards the messages; If you receive your own message then declare yourself the leader

Time complexity Time taken from the instant the first process wakes up to the time when the algorithm finishes, assuming that each message transmission takes one time unit and each local computation action takes one time unit.

A more efficient algorithm If phase i, send message to capture nodes up to distance 2 i. If successful in phase i, then an ack is propagated back. When the ack is received back and you have not been captured, the phase number is increased. Capturing is based on (phase, id)

Number of nodes at phase 0: N Number of nodes that finish phase 0: Number of nodes that finish phase 1:

Election in a complete network Candidate node: state i = candidate L1: select a neighbor j from unvisited set; send elect(leader i ) to j; receive msg(j) from k if msg = ack then if j > i then state = passive; leader i = j else if (unvisited != empty) go to L1 else send elected to all nodes if (msg = elect) and (j > i) then state = passive; send ack(leader i ) to j; state i = passive or sleeping receive elect(j) from j; if j > leader i then leader i = j send ack(leader i ) to j

Election in a complete network Candidate node: state i = candidate L1: select S = 2 phasei nodes from unvisited set select elect(phase i, i) to nodes in S; receive msg(phase, j) from k if msg = ack then if (phase, j) > (phase i, i) then state = passive; leader i = j else if (ack received from all nodes in S) then phase i ++; if phase i != logN then go to L1 else send elected to all nodes if (msg = elect) and (phase, j) > (phase i, i) then state = passive; leader i = j; phase i = j send ack(phase,leader i ) to j; state i = passive or sleeping receive elect(phase, j) from j; if (phase, j) > (phase i, leader i ) then leader i = j; phase i = j send ack(phase,leader i ) to j

The number of nodes that own k nodes is at most N/k -The sets of nodes captured by different alive candidates are disjoint

Election in a complete network Candidate node: state i = candidate L1: select S = 2 phasei nodes from unvisited set select elect(phase i, i) to nodes in S; receive msg(phase, j) from k if msg = ack then if (phase, j) > (phase i, i) then state = passive; leader i = j else if (ack received from all nodes in S) then phase i ++; if phase i != logN then go to L1 else send elected to all nodes if (msg = elect) and (phase, j) > (phase i, i) then state = passive; leader i = j; phase i = j send ack(phase,leader i ) to j; if (msg = kill-owner) and (phase, j) > (phasei, i) then state = passive; leaderi= j; phasei = j send owner-accept(phase,leaderi) to k state i = passive or sleeping - receive elect(phase, j) from j; if (phase, j) > (phase i, leader i ) then send kill-owner(phase,j) to leader if owner-accept is received, then send ack(phase,leader i ) to j; leader = j

Minimum Spanning tree construction Each node is a subtree/fragment by itself. Select the minimum outgoing edge of the fragment Send message to connect to the fragment on the other side of this edge to form a larger fragment

Selecting minimum outgoing edge Each fragment has a leader/root Leader send FIND message to all nodes in the fragment Each node sends test message on outgoing edges, one at a time in increasing cost order, to find an outgoing edge Each node reports outgoing edges to the leader Leader then selects the minimum one Root is changed to the node with the minimum outgoing edge

f d b e c a d b e c a d b e c a d b e c a 8 8

d b e c a

Worst Case Message complexity

Level Numbers Initially, fragments of size one are at level 0 When two fragments of size L merge, a new fragment of size L + 1 is created Level number is included in all messages When a node receives a message from a node with a higher level number X, it delays response until its fragment number becomes at least X.

Fragment absorption If node x in fragment F at level L sends message to node y in fragment G at level L’ to combine such that L < L’, then if y is still finding outgoing edge then it absorbs F into G