Distributed Leader Election Algorithms in Synchronous Ring Networks

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.
Distributed Algorithms – 2g1513
Leader Election Breaking the symmetry in a system.
Global States.
Two absolute bounds for distributed bit complexity Yefim Dinitz, Noam Solomon, 2007 Presented by: Or Peri & Maya Shuster.
Lecture 19: Parallel Algorithms
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.
Routing in a Parallel Computer. A network of processors is represented by graph G=(V,E), where |V| = N. Each processor has unique ID between 1 and N.
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 ©
Gossip and its application Presented by Anna Kaplun.
1 Maximal Independent Set. 2 Independent Set (IS): In a graph G=(V,E), |V|=n, |E|=m, any set of nodes that are not adjacent.
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.
Università degli Studi dell’Aquila Academic Year 2009/2010 Course: Algorithms for Distributed Systems Instructor: Prof. Guido Proietti Time: Monday:
1 Maximal Independent Set. 2 Independent Set (IS): In a graph, any set of nodes that are not adjacent.
CPSC 668Set 5: Synchronous LE in Rings1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
S NAPSHOT A LGORITHM. W HAT IS A S NAPSHOT - INTUITION Given a system of processors and communication channels between them, we want each processor to.
1 Complexity of Network Synchronization Raeda Naamnieh.
CS 582 / CMPE 481 Distributed Systems
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 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.
CPSC 668Set 3: Leader Election in Rings1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch.
Computer Science Lecture 11, page 1 CS677: Distributed OS Last Class: Clock Synchronization Logical clocks Vector clocks Global state.
Bit Complexity of Breaking and Achieving Symmetry in Chains and Rings.
1 Brief Announcement: Distributed Broadcasting and Mapping Protocols in Directed Anonymous Networks Michael Langberg: Open University of Israel Moshe Schwartz:
Leader Election in Rings
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
Distributed Algorithms 2014 Igor Zarivach A Distributed Algorithm for Minimum Weight Spanning Trees By Gallager, Humblet,Spira (GHS)
Lecture #12 Distributed Algorithms (I) CS492 Special Topics in Computer Science: Distributed Algorithms and Systems.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 10 Instructor: Haifeng YU.
Consensus and Its Impossibility in Asynchronous Systems.
1 Maximal Independent Set. 2 Independent Set (IS): In a graph G=(V,E), |V|=n, |E|=m, any set of nodes that are not adjacent.
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.
Lecture #14 Distributed Algorithms (II) CS492 Special Topics in Computer Science: Distributed Algorithms and Systems.
DISTRIBUTED ALGORITHMS Spring 2014 Prof. Jennifer Welch Set 2: Basic Graph Algorithms 1.
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.
Andrea CLEMENTI Radio Networks The Model Broadcast.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
CSE 486/586 CSE 486/586 Distributed Systems Leader Election Steve Ko Computer Sciences and Engineering University at Buffalo.
CIS 825 Lecture 8. Leader Election Aim is to elect exactly one node as the leader.
2016/6/23Election Algorithms1 Introduction to Distributed Algorithm Part Two: Fundamental Algorithm Chapter 7- Election Algorithms Teacher: Chun-Yuan Lin.
Distributed Leader Election Krishnendu Mukhopadhyaya Indian Statistical Institute, Kolkata.
Michael Langberg: Open University of Israel
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Lecture 9: Asynchronous Network Algorithms
Alternating Bit Protocol
Distributed Consensus
Parallel and Distributed Algorithms
Leader Election CS60002: Distributed Systems
CSE 486/586 Distributed Systems Leader Election
Lecture 8: Synchronous Network Algorithms
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:

Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens

Distributed Computing Distributed computing is decentralised and parallel computing, where two or more processors communicate over a network to accomplish a common task. The collaborating processors are often identical. One of the central problems is…

Leader Election Given a network of processors, exactly one processor should output the decision that it is the leader. It is usually required that all non-leader processors are informed of the leader’s election. Βοηθάει στο να σπάει η συμμετρία και να μπορούμε να τρέχουμε centralized αλγόριθμους σε decentralized network.

The Synchronous Network Model

Network representation Directed Graph G(V,E), |V|= n Nodes represent processors Edges represent (directed) communication channels Message Passing System Global Clock (for every tic a step of the algorithm is executed)

Processor’s fields Every processor consists of the following: statesi (a not necessarily finite set of states) starti (the initial state) msgsi (a message generation function) transi (a state transition function) Κάθε επεξεργαστής αποτελείται από τα εξής πεδία: Ένα σύνολο καταστάσεων από το οποίο επιλέγει την τρέχουσα κατάστασή του κάθε φορά, δηλαδή τι τιμές θα έχουν κάθε στιγμή της οι μεταβλητές που θα χρησιμοποιήσει για την εκτέλεση του αλγόρίθμου. Η αρχική του κατάσταση είναι μια από το σύνολο καταστάσεων με την οποία ξεκινά την εκτέλεση (πώς αρχικοποιούνται οι μεταβλητές που χρησιμοποιεί) Μια γεννήτρια συνάρτηση μηνυμάτων βάσει της οποίας παράγει τα μηνύματα που θα στείλει στους γείτονές του Μια συνάρτηση μετάβασης καταστάσεων βάσει της οποίας θα υπολογίσει τη νέα κατάσταση, δηλαδή θα αλλάξει τιμές στις μεταβλητές.

Step Apply the message generation function to the current state to generate the messages to be sent to all outgoing neighbors. Apply the state transition function to the current state and the incoming messages to obtain the new state. Η εκτέλεση ξεκινά με όλους τους επεξεργαστές να βρίσκονται σε κάποια initial state. Μετά οι επεξεργαστές κάνουν τα ακόλουθα δύο πράγματα: Σύμφωνα με την κατάσταση που βρίσκονται υπολογίζουν το μήνυμα που θα στείλουν στους γείτονές τους και το στέλνουν Έπειτα ανάλογα με την τρέχουσα κατάστασή τους και τα μηνύματα που θα λάβουν υπολογίζουν την καινούρια κατάστασή τους. Αυτά αποτελούν ένα βήμα Ο κατανεμημένος υπολογισμός αποτελείται από κάποιο αριθμό τέτοιων βημάτων.

Complexity measures Time complexity: the number of the steps until all outputs are produced or all the processors halt. Communication complexity: the number of non-null messages that are sent during the execution. Αυτό που μας ενδιαφέρει κυρίως είναι το time αρκεί να μην επιβαρύνεται τόσο πολύ το σύστημα που να επιβραδύνεται η διαδικασία

Leader Election in Rings with UIDs

Setting The network graph is a directed ring consisting of n nodes (n is unknown to the processors). Processors run the same deterministic algorithm. The only piece of information supplied to the processors is a unique integer identifier (UID). Οι διαδικασίες είναι ακίνητες πάνω στους κόμβους και τρέχουν όλες ταυτόχρονα τον ίδιο ντετερμινιστικό αλγόριθμο. Αν το n είναι γνωστό τότε οι διαδικασίες μπορούν να το χρησιμοποιήσουν στα προγράμματα τους. Εκτός αυτού οι διαδικασίες έχουν και περιορισμένη δύναμη, δηλαδή μπορούν μόνο να στέλνουν κάποια μηνύματα στους out_nbrs που να περιέχουν περιορισμένη πληροφορία (το uid και ίσως και κάποιου είδους μετρητές ή διακριτικά) και να δέχονται τέτοια μηνύματα απο τους in_nbrs. Επίσης μπορούν να εκτελούν συγκρίσεις και ίσως και κάποιου είδους υπολογισμούς βάσει των οποίων θα αποφασίσουν αν θα στείλουν μήνυμα στις επόμενες διαδικασίες. Θα αποδείξουμε στη συνέχεια ότι αν οι διαικασίες ήταν πανομοιότυπες τότε θα ήταν αδύνατη η εκλογή αρχηγού, αφού δε θα είχαν κανένα στοιχείο που να τις ξεχωρίζει μεταξύ τους

Related Work and Important Results Algorithm Time Complexity Msg Complexity LCR (‘79) O(n) O(n2) HS (’80) O(nlogn) Our Algorithm O(nlogn) (better constant) Lower bound Ω(n) (trivial) Ω(nlogn) FL (’87) Franklin, Dolev- Klawe- Rodeh, Peterson, δικός μου

Our Algorithm

Basic Idea Every processor starts by sending a message with its UID Nodes which receive a UID greater than their own take on the task of forwarding it around the ring, while the node which initially possessed it becomes inactive. The processor that will become the leader is the one with the greatest UID and this will happen when its UID returns to itself after traveling around the ring.

Description Every processor has the following fields: Its own UID The greatest UID it has seen so far One activity field {active, inactive, waiting} One status field {leader, unknown}

Description The algorithm is executed in phases 0, 1, 2... Every phase k has two parts

First Part of Phase k Every active processor i sends a token with the greatest UID it has seen so far to travel for distance at most 2k.

First Part of Phase k When a processor receives a UID that is equal to its own UID, it declares itself the leader. If this is not the case then it compares it with the greatest UID it has seen so far.

First Part of Phase k If the incoming UID is smaller then it discards it. If the incoming UID is greater then It saves this UID as the greatest it has seen so far. Either it becomes waiting if it is the incoming UID’s end of path (it has already traveled distance 2k), or it passes it to the next processor and becomes inactive.

Second Part of Phase k After this time (2k), if i is still active resends the UID to travel distance 2k and becomes inactive. If a waiting processor receives again the same UID after 2k time then it becomes active. If not it becomes inactive. The next phase k+1 begins…

A Simple Example

4 7 2 5 2 4 7 5

4 7 2 5 2 4 7 5

4 7 2 5 2 2 4 5 4 7 7 5

4 7 2 5 2 5 4 5 4 7 7 7

4 7 2 5 5 4 7 7

4 7 2 5 5 4 4 7 7 7

4 2 5 4 4 7 7 5 7 7

A More Complicated Example

5 3 4 2 6 8 1 7 7 5 1 3 4 8 6 2

5 3 4 2 6 8 1 7 7 5 1 Phase 0 Part 1 Step 1 3 4 8 6 2

5 3 4 2 6 8 1 7 7 5 1 3 4 8 6 2

5 3 4 2 6 8 1 7 1 7 7 5 1 3 5 3 4 6 8 4 2 8 6 2

5 3 4 2 6 8 1 7 1 7 7 5 7 3 5 6 5 6 8 4 2 8 8 4

5 3 4 2 6 8 1 7 7 5 7 Phase 0 Part 2 Step 1 6 5 8 8 4

5 3 4 2 6 8 1 7 7 5 7 6 5 8 8 4

5 3 4 2 6 8 1 7 7 7 5 7 5 6 5 8 8 8 4

5 3 4 2 6 8 1 7 7 7 5 7 5 6 5 8 8 8 4

5 3 4 2 6 8 1 7 7 5 7 Phase 1 Part 1 Step 1 6 5 8 8 4

5 3 4 2 6 8 1 7 5 3 4 2 6 8 1 7 7 5 7 6 5 8 8 4

5 3 4 2 6 8 1 7 7 7 5 7 6 5 8 8 5 8 4

5 3 4 2 6 8 1 7 7 7 7 7 8 5 8 8 5 8 5

5 3 4 2 6 8 1 7 7 7 7 Phase 1 Part 1 Step 2 8 5 8 8 5

5 3 4 2 6 8 1 7 7 7 7 8 5 8 8 5

5 3 4 2 6 8 1 7 7 7 7 8 7 8 5 8 5 8 5

5 3 4 2 6 8 1 7 8 7 7 8 7 8 7 8 5 8 5

5 3 4 2 6 8 1 7 8 7 7 Phase 1 Part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8

5 3 4 2 6 8 1 7 8 8 8 8 8 8 8 8

5 3 4 2 6 8 1 7 8 8 8 Phase 2 Part 2 Step 3 8 8 8 8 8

5 3 4 2 6 8 1 7 8 8 8 8 8 8 8 8

5 3 4 2 6 8 1 7 8 8 8 8 8 8 8 8

5 3 4 2 6 8 1 7 8 8 8 Phase 2 Part 2 Step 4 8 8 8 8 8

5 3 4 2 6 8 1 7 8 8 8 8 8 8 8 8

5 3 4 2 6 8 1 7 8 8 8 8 8 8 8 8 8

5 3 4 2 6 8 1 7 8 8 8 8 8 8 8 8 8

5 3 4 2 6 8 1 7 8 8 8 Phase 3 Part 1 Step 1 8 8 8 8 8

5 3 4 2 6 8 1 7 8 8 8 8 8 8 8 8

5 3 4 2 6 8 1 7 8 8 8 8 8 8 8 8 8

5 1 7 8 8 8 3 8 8 4 8 8 2 8 6 8 8

Complexity Analysis

Execution Time Total running time = time until maximum UID reaches its initiator (one round = n steps) But how many phases will be executed until maxUID reaches its initiator?

5 1 7 3 4 2 8 8 6

5 1 7 3 4 8 2 8 6

5 1 7 8 3 4 2 8 6

5 1 7 3 4 8 2 8 6

5 1 7 3 4 2 8 8 6

Number of Phases f = total number of phases. 1 + 2 + 4 + … + 2f-1 < n → 2f – 1 < n 2f+1 – 1 ≥ n So f ≈ logn

Time Complexity In every phase i: 2 parts 2i steps each part Total running time 2 + 4 + 8 + … + 2f + rest ≤ ≤ 2f+2 – 2 = O(2logn) = = O(n) 2i+1 steps

Messages Only an active processor can initiate a message. Inactive processors pass the message to the final receiver

2i+1

In phase i+1 2i+1 → 1 active processor n → (n / 2i+1) active processors Every active processor causes 2∙2i+1= 2i+2 messages to be sent. Total number of messages in this phase: (n / 2i+1) ∙ 2i+2 ≈ 4n

Message Complexity Total number of phases ≈ logn Number of messages in every phase ≈ 4n The total number of messages during the execution is O(nlogn) with a constant factor 4 (improving a previous constant factor 8 in HS).

Complexity Time Complexity: O(n) Message Complexity: O(nlogn) For non-leader results we need n extra steps and n extra messages.

THANK YOU!

Leader Election in Anonymous Rings

General Lemma: If the network is symmetric (i.e. a ring) and anonymous (the processors haven’t UIDs) then it is impossible to elect a leader by a deterministic algorithm. [by Angluin (1980)] Probabilistic algorithms are used to break symmetry.

Itai and Rodeh Algorithm Assumption: processors know n. The Algorithm The algorithm proceeds in phases, each of them containing n steps. At every phase, a ≤ n processors are active (initially everyone). During each phase some processors may become inactive. At the beginning of every phase, every active processor decides with probability a-1 whether or not to become a candidate. To do that, it picks a random number r, 0<r<1 and if r<a-1, then it becomes a candidate and initiates a pebble to travel around the ring. Αυτός το 1990. Ένας προηγούμενός τους αλγόριθμος 1981, στηρίζεται στον αλγόριθμο LCR

Itai and Rodeh Algorithm To compute the number of candidates (c), each processor counts the pebbles it has seen. Number of pebbles counted = Number of candidates. At the end of the phase, every processor has calculated c. If c=1 then sole candidate becomes leader. If c>1 then a new phase begins with the new active processors (the candidates of the previous phase). If c=0 the phase was useless.

Itai and Rodeh Algorithm 0.46 0.04 a-1 = 1/10 c = 2 0.37 0.35 0.83 0.64 0.08 0.22 0.53 0.93

Itai and Rodeh Algorithm Useless phase 0.74 a-1 = 1/2 c = 2 0.88

Itai and Rodeh Algorithm 0.32 a-1 = 1/2 c = 1 0.69

Itai and Rodeh Algorithm The leader!!!

Itai and Rodeh Algorithm- Complexity Analysis p(a,c) : the probability that c out of a active processors become candidates. Then Proof: Xi a random variable, Xi=1 if i becomes a candidate, else 0 (bernoulli trial) Then X=ΣnXi= the number of processors become candidates. X~binomial distribution. Thus

Itai and Rodeh Algorithm- Complexity Analysis Average Case Time Complexity: 2.441716 · n Message Complexity: 2.441716 · n The number of pebbles initialized per phase is X (the number of active processors that become candidates). E[X ] = E[ΣaXi ] = Σa(E[Xi ]) = a · a-1 = 1 Thus, the expected message complexity per phase is n. Για n τείνει στο άπειρο το L = 2.441716 σταθερό Ο αριθμός αυτός διαισθητικά είναι σταθερός επειδή το Ε[Χ] = 1 Bit Complxity ίδια! Σημαντική βελτίωση από τον προηγούμενό τους αλγόριθμο ο οποίος ήταν O(nlogn)

Itai and Rodeh Algorithm- Complexity Analysis Theorem: The expected number of phases required to reduce the number of active processors from a to 1 l(a) converges to 2.441716… Proof sketch:

Itai and Rodeh Algorithm- Complexity Analysis For fixed c, L(a,c) converges, L( ,c) converges, . Thus, So, L ≈ 2.441716

Itai and Rodeh Algorithm- Complexity Analysis Average Case Time Complexity: 2.441716 · n Message Complexity: 2.441716 · n The number of pebbles initialized per phase is X (the number of active processors that become candidates). E[X ] = E[ΣaXi ] = Σa(E[Xi ]) = a · a-1 = 1 Thus, the expected message complexity per phase is n.