1 Selecting leader in a clique in O (n log n) By Pierre A.Humblet Presented by: Anat Berkman, 236357 Distributed Algorithms, Technion.

Slides:



Advertisements
Similar presentations
Chapter 5: Tree Constructions
Advertisements

Lecture 15. Graph Algorithms
Global States.
Covers, Dominations, Independent Sets and Matchings AmirHossein Bayegan Amirkabir University of Technology.
Two absolute bounds for distributed bit complexity Yefim Dinitz, Noam Solomon, 2007 Presented by: Or Peri & Maya Shuster.
How to Schedule a Cascade in an Arbitrary Graph F. Chierchetti, J. Kleinberg, A. Panconesi February 2012 Presented by Emrah Cem 7301 – Advances in Social.
Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks ©
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
Uncoordinated Checkpointing The Global State Recording Algorithm Cristian Solano.
Greedy Algorithms Greed is good. (Some of the time)
Approximation, Chance and Networks Lecture Notes BISS 2005, Bertinoro March Alessandro Panconesi University La Sapienza of Rome.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Determinization of Büchi Automata
Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
Bounds on Code Length Theorem: Let l ∗ 1, l ∗ 2,..., l ∗ m be optimal codeword lengths for a source distribution p and a D-ary alphabet, and let L ∗ be.
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.
Tirgul 8 Graph algorithms: Strongly connected components.
Distributed Computing 8. Impossibility of consensus Shmuel Zaks ©
Optimization of Pearl’s Method of Conditioning and Greedy-Like Approximation Algorithm for the Vertex Feedback Set Problem Authors: Ann Becker and Dan.
Lectures on Network Flows
Yangjun Chen 1 Bipartite Graphs What is a bipartite graph? Properties of bipartite graphs Matching and maximum matching - alternative paths - augmenting.
CPSC 668Set 4: Asynchronous Lower Bound for LE in Rings1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
CS 582 / CMPE 481 Distributed Systems
Leader in a clique in O(nlog(n)) messages By Pierre A. Humblet and the help of Miki Asa.
CPSC 668Set 3: Leader Election in Rings1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
CPSC 668Set 12: Causality1 CPSC 668 Distributed Algorithms and Systems Fall 2009 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:
Computer Science Lecture 11, page 1 CS677: Distributed OS Last Class: Clock Synchronization Logical clocks Vector clocks Global state.
Yangjun Chen 1 Bipartite Graph 1.A graph G is bipartite if the node set V can be partitioned into two sets V 1 and V 2 in such a way that no nodes from.
A (nlog(n)) lower bound for leader election in a clique.
Bit Complexity of Breaking and Achieving Symmetry in Chains and Rings.
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.
Maximal Independent Set Distributed Algorithms for Multi-Agent Networks Instructor: K. Sinan YILDIRIM.
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.
Message Passing Systems A Formal Model. The System Topology – network (connected undirected graph) Processors (nodes) Communication channels (edges) Algorithm.
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
Induction and recursion
Message Passing Systems A Formal Model. The System Topology – network (connected undirected graph) Processors (nodes) Communication channels (edges) Algorithm.
Distributed Algorithms 2014 Igor Zarivach A Distributed Algorithm for Minimum Weight Spanning Trees By Gallager, Humblet,Spira (GHS)
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Week 11 - Monday.  What did we talk about last time?  Binomial theorem and Pascal's triangle  Conditional probability  Bayes’ theorem.
Agenda Fail Stop Processors –Problem Definition –Implementation with reliable stable storage –Implementation without reliable stable storage Failure Detection.
1 Leader Election in Rings. 2 A Ring Network Sense of direction left right.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Impossibility of Distributed Consensus with One Faulty Process By, Michael J.Fischer Nancy A. Lynch Michael S.Paterson.
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
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.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
1 Fault-Tolerant Consensus. 2 Communication Model Complete graph Synchronous, network.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
1 Distributed Vertex Coloring. 2 Vertex Coloring: each vertex is assigned a color.
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
Complexity and Computability Theory I Lecture #12 Instructor: Rina Zviel-Girshin Lea Epstein.
Khaled M. Alzoubi, Peng-Jun Wan, Ophir Frieder
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Computing Connected Components on Parallel Computers
Lectures on Network Flows
MST GALLAGER HUMBLET SPIRA ALGORITHM
Distributed Consensus
MST GALLAGER HUMBLET SPIRA ALGORITHM
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Locality In Distributed Graph Algorithms
Presentation transcript:

1 Selecting leader in a clique in O (n log n) By Pierre A.Humblet Presented by: Anat Berkman, Distributed Algorithms, Technion

2 Problem background Arbitrary non empty subset wake up spontaneously ans start executing common asynchronous distributed algorithm

3 Assumption ● Messages arrive without error after an arbitrary but finite delay

4 The algorithm ● Main idea : as long as a node did not surrender he tries to capture other nodes according to the edges. First he tries to capture the node at the end point of edge #1, then #2 and so on

5 5 wants to capture Let me ask my master 3. Master, 5 want to have a fight1. TEST: I want to capture you! Lets have a fight: 5 vs 17

6 5 wants to capture Let me ask my master 3. Master, 5 want to have a fight1. TEST: I want to capture you! Lets have a fight: 5 vs Answer to the fight 6. If 5 won- tell him

7 Wake up call WINNER(A) A:B:

8 Wake up call WINNER(A) A: STATE:active SIZE:0 MASTER:A B: STATE:active SIZE:0 MASTER:B STATE is active\stopped. Active means he was not captured yet SIZE is the size of my kingdom MASTER is the identity of my master

9 A process the message of type “WINNER” A: STATE:active SIZE:0 MASTER:A WINNER(A) If ID=id (yes) if state='active' then SIZE=SIZE+1 If SIZE=N stop if STATE='active' then send TEST(SIZE,ID) on edge SIZE B: STATE:active SIZE:0 MASTER:B

10 A process the message of type “WINNER” A: STATE:active SIZE:1 MASTER:A WINNER(A) If ID=id (yes) if state='active' then SIZE=SIZE+1 if SIZE=N stop! if STATE='active' then send TEST(SIZE,ID) on edge SIZE B: STATE:active SIZE:0 MASTER:B

11 A process the message of type “WINNER” A: STATE:active SIZE:1 MASTER:A WINNER(A) If ID=id (yes) if state='active' then SIZE=SIZE+1 if SIZE=N stop! if STATE='active' then send TEST(SIZE,ID) on edge SIZE B: STATE:active SIZE:0 MASTER:B

12 A process the message of type “WINNER” A: STATE:active SIZE:1 MASTER:A WINNER(A) If ID=id (yes) If STATE='active' then SIZE=SIZE+1 If SIZE=N stop if STATE='active' then Send TEST(SIZE,ID) on edge SIZE B: STATE:active SIZE:0 MASTER:B TEST(1,A)

13 B process the message of type “TEST” on edge 1 A: STATE:active SIZE:1 MASTER:A WINNER(A) If e >= SIZE then: \\{not in our domain, tell the master} EDGE_TO(id)=e PENDING=PENDING+1 IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,if) in PENDING_SET B: STATE:active SIZE:0 MASTER:B TEST(1,A) EDGE_TO(MASTER)= -1

14 B process the message of type “TEST” on edge 1 A: STATE:active SIZE:1 MASTER:A WINNER(A) If e >= SIZE then: \\{not in our domain, tell the master} EDGE_TO(id)=e \\{not in our domain, tell the master} PENDING=PENDING+1 IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,if) in PENDING_SET B: STATE:active SIZE:0 MASTER:B TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1

15 B process the message of type “TEST” on edge 1 A: STATE:active SIZE:1 MASTER:A WINNER(A) If e >= SIZE then: \\{not in our domain, tell the master} EDGE_TO(id)=e PENDING=PENDING+1 IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,if) in PENDING_SET B: STATE:active SIZE:0 MASTER:B TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1 PENDING=0+1=1 PENDING is the number of messages I received but did not finished responding

16 B process the message of type “TEST” on edge 1 A: STATE:active SIZE:1 MASTER:A WINNER(A) If e >= SIZE then: \\{not in our domain, tell the master} EDGE_TO(id)=e PENDING=PENDING+1 IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,if) in PENDING_SET B: STATE:active SIZE:0 MASTER:B TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1 PENDING=0+1=1 TEST(1,A)

17 B process the message of type “TEST” on edge -1 A: STATE:active SIZE:1 MASTER:A WINNER(A) If e >= SIZE then: \\{not in our domain, tell the master} EDGE_TO(id)=e PENDING=PENDING+1 IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,if) in PENDING_SET B: STATE:active SIZE:0 MASTER:B TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1 PENDING=0+1=1 TEST(1,A)

18 B process the message of type “TEST” on edge -1 A: STATE:active SIZE:1 MASTER:A WINNER(A) If e >= SIZE then: \\{not in our domain, tell the master} EDGE_TO(id)=e PENDING=PENDING+1 IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,if) in PENDING_SET else \\(e (SIZE,ID) then STATE='stopped' send WINNER(id) on edge e B: STATE:stopped SIZE:0 MASTER:B TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1 PENDING=0+1=1 TEST(1,A)

19 B process the message of type “TEST” on edge -1 A: STATE:active SIZE:1 MASTER:A WINNER(A) If e >= SIZE then: \\{not in our domain, tell the master} EDGE_TO(id)=e PENDING=PENDING+1 IF PENDING=1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,if) in PENDING_SET else \\(e (SIZE,ID) then \\if (1,A) > (0,B) YES!!!! lexicographic order STATE='stopped' send WINNER(id) on edge e B: STATE:stopped SIZE:0 MASTER:B TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1 PENDING=0+1=1 TEST(1,A) WINNER(A)

20 B process the message of type “WINNER(A)” on edge -1 A: STATE:active SIZE:1 MASTER:A WINNER(A) B: STATE:stopped SIZE:0 MASTER:A TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1 PENDING=0+1=1 TEST(1,A) WINNER(A) If ID=id Else If MASTER <> id //if B<>A MASTER=id send WINNER(id) on EDGE_TO(A) PENDING=PENDING-1 If PENDING > 0 then..

21 B process the message of type “WINNER(A)” on edge -1 A: STATE:active SIZE:1 MASTER:A WINNER(A) B: STATE:stopped SIZE:0 MASTER:A TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1 PENDING=0+1=1 TEST(1,A) WINNER(A) If ID=id Else If MASTER <> id //if B<>A MASTER=id send WINNER(id) on EDGE_TO(A) PENDING=PENDING-1 If PENDING > 0 then.. WINNER(A)

22 B process the message of type “WINNER(A)” on edge -1 A: STATE:active SIZE:1 MASTER:A WINNER(A) B: STATE:stopped SIZE:0 MASTER:A TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1 PENDING=1-1=0 TEST(1,A) WINNER(A) If ID=id Else If MASTER <> id //if B<>A send WINNER(id) on EDGE_TO(A) PENDING=PENDING-1 If PENDING > 0 then.. WINNER(A)

23 A process the message of type “WINNER(A)” on edge 1 A: STATE:active SIZE:1 MASTER:A WINNER(A) B: STATE:stopped SIZE:0 MASTER:A TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1 PENDING=1-1=0 TEST(1,A) WINNER(A) If ID=id Else If MASTER <> id //if B<>A send WINNER(id) on EDGE_TO(A) PENDING=PENDING-1 If PENDING > 0 then.. WINNER(A)

24 A process the message of type “WINNER(A)” on edge 1 A: STATE:active SIZE:2 MASTER:A WINNER(A) B: STATE:stopped SIZE:0 MASTER:A TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1 PENDING=1-1=0 TEST(1,A) WINNER(A) If ID=id \\ if A=A if STATE='active then SIZE=SIZE+1 if SIZE=N then STOP Else If MASTER <> id //if B<>A send WINNER(id) on EDGE_TO(A) PENDING=PENDING-1 If PENDING > 0 then.. WINNER(A)

25 A process the message of type “WINNER(A)” on edge 1 A: STATE:active SIZE:1 MASTER:A WINNER(A) B: STATE:stopped SIZE:0 MASTER:A TEST(1,A) EDGE_TO(MASTER)=-1 EDGE_TO(A)=1 PENDING=1-1=0 TEST(1,A) WINNER(A) If ID=id \\ if A=A if STATE='active then SIZE=SIZE+1 if SIZE=N then STOP – you are the leader!!!!!!!!!! Else If MASTER <> id //if B<>A send WINNER(id) on EDGE_TO(A) PENDING=PENDING-1 If PENDING > 0 then.. WINNER(A)

26 The algorithm ● When node ID receive WINNER(id) : if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE ● else if MASTER <>id then MASTER=id send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1 ● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER)

27 The algorithm ● When node ID receive TEST(size,id) on edge e: ● if e (SIZE,ID) then //lexicographic STATE='stopped' send WINNER(id) on edge e else send WINNER(ID) on edge e else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 if PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET

28 Example WINNER(A) A: WINNER(C) C: D: B: E: WINNER(D) FGF H IJ

29 A<B<C<D<... WINNER(A) A: WINNER(C) C: D: B: E: WINNER(D) FGF H IJ

30 if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE A WINNER(A) A: WINNER(C) C: D: B: E: WINNER(D) FGF H IJ

31 if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE A WINNER(A) A: WINNER(C) C: D: B: E: WINNER(D) FGF H IJ

32 if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE A WINNER(A) A: WINNER(C) C: D: B: E: WINNER(D) TEST(1,A) FGF H IJ

33 if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE C WINNER(A) A: WINNER(C) C: D: B: E: WINNER(D)TEST(1,C) FGF H IJ

34 If e < SIZE //message comes from our Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET B-process A's message WINNER(A) A: WINNER(C) C: D: B: E: WINNER(D) TEST(1,A) FGF H IJ

35 If e < SIZE //message comes from our Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET WINNER(A) A: WINNER(C) C: D: B: E: WINNER(D) FGF H IJ B-process C's message(1,C)

36 If e < SIZE //message comes from our Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET B-process B's message (test(1,A)) WINNER(A) A: WINNER(C) C: D: B: E: WINNER(D) FGF H IJ

37 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e Else Send WINNER(ID) on edge e B-process B's message (test(1,A)) WINNER(A) A: WINNER(C) C: D: B: E: WINNER(D) WINNER(A) FGF H IJ

38 ● if ID=id then ● ELSE if MASTER <>id then MASTER=id send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1 ● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER) B-process B's message WINNER(A) WINNER(A) A: WINNER(C) C: D: B: E: WINNER(D) WINNER(A) TEST(1,C) FGF H IJ

39 ● if ID=id then ● if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE A-process B's message WINNER(A) A: C: D: B: E: TEST(2,A) FGF H IJ

40 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e Else Send WINNER(ID) on edge e A-process B's message TEST(1,C) A: C: D: B: E: WINNER(A) FGF H IJ

41 ● if ID=id then ● else if MASTER <>id then MASTER=id send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1 ● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER) B-process A's message WINNER(A) A: C: D: B: E: FGF H IJ

42 If e < SIZE Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) Else put TEST(size,id) in PENDING_SET C-process A's message TEST(2,A) A: C: D: B: E: TEST(2,A) FGF H IJ

43 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e Else Send WINNER(ID) on edge e C-process C's message TEST(2,A) A: C: D: B: E: WINNER(A) FGF H IJ

44 if ID=id then else if MASTER <>id then MASTER=id send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1 if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER) C-process C's message WINNER(A) A: C: D: B: E: WINNER(A) FGF H IJ

45 ● if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE A-process C's message WINNER(A) A: C: D: B: E: TEST(3,A) FGF H IJ

46 ● if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE D-process awake WINNER(D) A: C: D: B: E: TEST(1,D) FGF H IJ

47 If e < SIZE Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET D-process A message TEST(3,A) A: C: D: B: E: TEST(3,A) FGF H IJ

48 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e Else Send WINNER(ID) on edge e D-process D message TEST(3,A) A: C: D: B: E: WINNER(A) FGF H IJ

49 if ID=id then else if MASTER <>id then MASTER=id send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1 if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER) D-process D message WINNER(A) A: C: D: B: E: WINNER(A) FGF H IJ

50 ● if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE A-process D message WINNER(A) A: C: D: B: E: TEST(4,A) FGF H IJ

51 If e < SIZE Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER)Else put TEST(size,id) in PENDING_SET E-process A message TEST(4,A) A: C: D: B: E: TEST(4,A) FGF H IJ

52 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e Else Send WINNER(ID) on edge e E-process E message TEST(4,A) A: C: D: B: E: WINNER(A) FGF H IJ

53 if ID=id then else if MASTER <>id then MASTER=id send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1 if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER) E-process E message WINNER(A) A: C: D: B: E: WINNER(A) FGF H IJ

54 ● if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE F woke up A: C: D: B: E: FGF H IJ

55 ● if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE F woke up A: C: D: B: E: FGF H IJ TEST(1,F)

56 If e < SIZE //message comes from our Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET G process the message TEST from F A: C: D: B: E: FGF H IJ TEST(1,F)

57 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e Else Send WINNER(ID) on edge e G process the message TEST from G A: C: D: B: E: FGF H IJ WINNER(F)

58 ● if ID=id then ● ELSE if MASTER <>id then MASTER=id send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1 ● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER) G process message WINNER from G A: C: D: B: E: F G F H IJ WINNER(F)

59 ● if ID=id then ● if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE F process message WINNER(F) from G A: C: D: B: E: F G F H IJ TEST(2,F)

60 If e < SIZE //message comes from our Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET H process message TEST from F A: C: D: B: E: F G F H IJ TEST(2,F)

61 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e Else Send WINNER(ID) on edge e H process message TEST from H A: C: D: B: E: F G F H IJ WINNER(F)

62 ● if ID=id then ● ELSE if MASTER <>id then MASTER=id send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1 ● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER) H process message WINNER(F) from H A: C: D: B: E: F G F H IJ WINNER(F)

63 ● if ID=id then ● if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE F process message WINNER(F) from H A: C: D: B: E: F G F H IJ TEST(3,F)

64 If e < SIZE //message comes from our Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET I process message TEST from F A: C: D: B: E: F G F H IJ TEST(3,F)

65 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e Else Send WINNER(ID) on edge e I process message TEST from I A: C: D: B: E: F G F H IJ WINNER(F)

66 ● if ID=id then ● ELSE if MASTER <>id then MASTER=id send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1 ● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER) I process message WINNER(F) from I A: C: D: B: E: F G F H IJ WINNER(F)

67 ● if ID=id then ● if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE F process message WINNER(F) from H A: C: D: B: E: F G F H IJ TEST(4,F)

68 If e < SIZE //message comes from our Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET J process message TEST from F A: C: D: B: E: F G F H IJ TEST(4,F)

69 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e Else Send WINNER(ID) on edge e J process message TEST from J A: C: D: B: E: F G F H IJ WINNER(F)

70 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e Else Send WINNER(ID) on edge e J process message WINNER(F) from J A: C: D: B: E: F G F H IJ WINNER(F)

71 if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE F process message WINNER(F) from J A: C: D: B: E: F G F H IJ TEST(5,F)

72 If e < SIZE //message comes from our Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET C process message TEST(5,F) from F A: C: D: B: E: F G F H IJ TEST(5,F)

73 ● if ID=id then ● if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE A-process E message WINNER(A) A: C: D: B: E: TEST(5,A) F G F H IJ

74 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e A process message TEST(5,F) from C A: C: F if (5,F) > (5,A) WINNER(F)

75 ● if ID=id then ● else if MASTER <>id then MASTER=id send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1 ● if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER) C process message WINNER(F) from A A: C: F WINNER(F)

76 ● if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE F process message WINNER(F) from C A: C: F TEST(6,F)

77 If e < SIZE Else //message from outsize the domain EDGE_TO(id) = e PENDING = PENDING +1 If PENDING =1 then send TEST(size,id) on EDGE_TO(MASTER) else put TEST(size,id) in PENDING_SET A process message TEST(6,F) from F A: C: F TEST(6,F)

78 If e (SIZE,ID) then //lexicographic STATE='stopped' Send WINNER(id) on edge e Else Send WINNER(ID) on edge e A process message TEST(6,F) from A A: C: F WINNER(F)

79 if ID=id then else if MASTER <>id then MASTER=id send WINNER(id) on EDGE_TO(id) PENDING=PENDING-1 if PENDING > 0 then send a message from PENDING_SET on edge EDGE_TO(MASTER) A process message WINNER(F) from A A: C: F WINNER(F)

80 if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! If STATE='active' then \\no fight has been lost send TEST(SIZE,ID) on edge SIZE F process message WINNER(F) from A A: F B: TEST(7,F)

81 B process message TEST(F) A: B: A: C: D: B: E: FGF H IJ TEST(7,F)

82 A: B: A: C: D: B: E: FGF H IJ WINNER(F)

83 A: B: A: C: D: B: E: FGF H IJ WINNER(F)

84 A: B: A: C: D: B: E: FGF H IJ TEST(8,F)

85 A: B: A: C: D: B: E: FGF H IJ TEST(8,F)

86 A: B: A: C: D: B: E: FGF H IJ WINNER(F)

87 A: B: A: C: D: B: E: FGF H IJ WINNER(F)

88 A: B: A: C: D: B: E: FGF H IJ TEST(9,F)

89 A: B: A: C: D: B: E: FGF H IJ TEST(9,F)

90 A: B: A: C: D: B: E: FGF H IJ WINNER(F) if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop!

91 A: B: A: C: D: B: E: FGF H IJ if ID=id then if STATE='active' then SIZE=SIZE+1 if SIZE=N then stop! WE HAVE A LEADER!!!!!!!!!!!

92 Correctness ● We would like to show : ● 1. Termination ● 2. One leader is elected and only one

93 Termination ● We will show: 1. The number of messages is bounded 2. There is no deadlock therefore the algorithm stop after a finite number of messages.

94 Termination- proof The number of messages is bounded: Each processor can send at most N-1 TEST messages. TEST message can cause at most more 3 messages (to the master,from the master,to the origin node-only if won). So total there is at most messages.

95 Termination- proof There is no deadlock: Assume there is a deadlock. Now let's look at the processor with the highest (SIZE,ID). He waits for an answer for his TEST message. Assume node u received the TEST message. Node u will eventually deliver it to it's master. At the end of the battle one will win and continue (send more TEST messages or win)- no deadlock. Bounded number of messages + no deadlock = termination

96 One leader is elected ● Define 'domain' of node ID at time t as the set of nodes from which it has receive winner(ID), including itself and the node was active. ● The domain size can not decrease ● For each active node: the domain size equal to SIZE: (from the code upon receiving WINNER(ID)) This is the only line SIZE is changed if ID=id then if STATE='active' then SIZE=SIZE+1

97 ● Let be the domain of node B at time tb ● Lemma 1: ● Proof: assume v in from time and in v joins so we will show by induction on j- the number of new masters v had after till (include)

98 ● Basis j=1: v belonged to domain A and then joined domain B (directly). AB V B sent TEST to v, who gave it to A. At time t', A processed this message: TEST(Bsize,B) v joined B so : either or but B>A. After v join Domain B Domain A no longer increase. In both cases after v join B :

99 ● Step: if the statement holds for some natural number j=x, then the statement holds for j=x+1. From the correctness for j=x we know that as in the basis we can prove that so total we can have:

100 ● So we proved that in other words:

101 ● Rank the nodes in order of decreasing order of SIZE at termination, breaking ties arbitrarily and denote by Si the final SIZE of the i”th ranked node. Lemma 2: Proof: ● each once was in the same size of Si. By lemma1 we know they all disjoin. If we divide all nodes (N) equally we will get

102 ONE LEADER ● The node with the largest (SIZE,ID) is S1, it is not possible it lost a fight (if it has there was Si with larger SIZE). So he won all the fights- at termination it's size is N. the size of S2 is smaller than S1 (lemma2 + S1 with SIZE=N) so S2 did not win. Same for all other nodes.

103 Complexity ● Each domain can at most send TEST message as it's size so: assume k woke up arbitrary (each test message can cause at most three more messages) So total we have O(N log(k)) messages

104 Lower bound From the paper “ Optimal lower bounds for some distributed algorithms for a complete network of predecessors “ Written by: E.Korach, S.Moran, S.Zaks

105 Main Idea- lower bound ● The adversary will always choose the “longest algorithm”. So we look at all possible executions, then we drop messages which don't use “new” edges, and we show that even if we drop messages our best algorithm is still bounded by

106 Lower bound ● Let A be a distributed algorithm acting on graph G=(V,E). Execution of A may consist events: sending a message, receiving a message or doing local computation. ● We assume no two message are sent in exactly the same time, therefor in each execution we associate a sequence ● SEND =

107 ● For every event where is the node sending the message and is the edge used by it ● Example 1 ● Example 2 V1V2 SEND= V1V2 SEND= <>

108 ● Let SEND(t) be the prefix of length t of SEND, ● If t<t' then we say SEND(t') is an extension of SEND(t) and SEND(t)<SEND(t')

109 ● Let NEW=NEW(SEND) be the subsequence of SEND that consist of all the events that use previously unused edges. V1V2 1 2 SEND= NEW =

110 ● G(NEW(t)) = (V,E(NEW(t))) where E(NEW(t)) is the set of edges used in NEW(t). NEW(t) - prefix of size t of NEW ● Example: V1V2 1 2 V3 G V1V2 G(NEW(1)) V3

111 ● If for every execution of the algorithm A the corresponding graph G(NEW) is connected then we term this algorithm global.

112 ● The edge complexity e(A) of an algorithm A acting on a graph G is the maximal length of a sequence NEW over all executions of A ● The message complexity m(A) of an algorithm A acting on a graph G is the maximal length of a sequence SEND over all executions of A. ● Clearly

113 ● For each algorithm A and graph G we define the exhaustive set of A with respect to G, denoted by EX(A,G) (or E(A)) as the set of all the sequences NEW(t) corresponding to possible executions of A

114 Axiom 1 ● The empty sequence is in EX(A,G) intuitive explanation: EX(A,G) is the set of all the sequences NEW(t) corresponding to possible executions of A, in particular EX(A,G) includes the sequence corresponding to NEW(0).

115 Axiom 2 ● If two sequences NEW1,NEW2 which do not interfere with each other are in EX(A,G) then so is also their concatenation NEW1 NEW2 Other nodes New1 New2

116 Axiom 3 ● If NEW(t) is a sequence in EX(A,G) with last element (v,e), and if e' is an unused edge adjacent to v, then the sequence obtained from NEW(t) by replacing e by e' is also in EX(A,G) Other nodes (v,e) Other nodes e The adversary Other nodes (v,e') Other nodes e'

117 Axiom 4 ● If NEW(t) is in EX(A,G) and C is a proper subgraph of G(NEW(t)) which is a union of some connected components, then there is an extension of NEW(t) in which the first new message (v,e) satisfies v in C. (A global) Other nodes C1 C2 C It is impossible that it's the end of the algorithm (and the other nodes sleep)

118 Lemma 1 ● Lemma 1: Let A be a global algorithm acting on a complete graph G=(V,E) and let ● then there exists a sequence of messages NEW in EX(A,G) such that G(NEW) has one connected component whose set of vertexes is U and the vertexes in V-U are isolated

119 Lemma 1 ● Proof:By induction we will build: If there is nothing to prove. If ( assume v1, v2) : we start with the empty sequence (axiom 1). Define C={v1},with axiom 4 we have extension which starts in v1. We have unused edged (v1,v2) so according to axiom 3 we can replace it.

120 Lemma 1 ● Proof: the main idea is we can keep this process as long we have an unused edge: Each iterate we pick a node from C(4). If it's connected to all it's neighbors in C- we done. Else- we can connect it to a neighbor it's not connected to (3), we can proceed until there is a node which is saturated (and then C is connected component) Other nodes

121 Theorem 1 ● Theorem 1: let A be a global algorithm acting on a completed graph G with n nodes. Then the edge complexity e(A) of A is at least O(n log n). ● Proof: for a subset U of V we define e(U) to be the maximal length of a sequence NEW in EX(A,G), which induces a graph that has a connected component whose set of vertexes is U and isolated vertexes otherwise (Exist from lemma 1)

122 Theorem 1- proof ● Define note: e(n) is the edge complexity of A. ● Now we will prove that Let U be a disjoint union of and {v} such that |U1|=|U2|=k so e(U)=e(2k+1).

123 Other nodes C U2U1 v U

124 NEW=NEW1 NEW2 (axiom 2) Other nodes C U2U1 v U NEW1NEW2

125 Axiom4: edge from C Other nodes C U2U1 v U NEW1NEW2

126 Axiom4: edge from C Other nodes C U2U1 v U NEW1NEW2

127 Axiom3: replace with unused edge Other nodes C U2U1 v U NEW1NEW2 Unused edges between U1 and U2

128 Axiom3: replace with unused edge Other nodes C U2U1 v U NEW1NEW2 Unused edges between U1 and U2

129 Axiom3: replace with unused edge Other nodes C U2U1 v U NEW1NEW2 Unused edges between U1 and U2

130 Axiom3: replace with unused edge- at least k times Other nodes C U2U1 v U NEW1NEW2 Unused edges between U1 and U2

131 Change C Other nodes C U2U1 v NEW1NEW2

132 Change C- axiom 4+3 Other nodes C U2U1 v NEW1NEW2

133 Change C- axiom 4+3 Other nodes C U2U1 v NEW1NEW2 Unused edge

134 Change C- axiom 4+3 Other nodes C U2U1 v NEW1NEW2

135 Total at least: e(U1)+e(U2)+k+1 Other nodes C U2U1 v NEW1NEW2

136 ● Let U be a disjoint union of and {v} such that |U1|=|U2|=k so e(U)=e(2k+1). Define Let NEW1,NEW2 be sequences in EX(A,G) of lengths e(U1),e(U2) inducing subgraphs G1,G2 that have one connected component with vertex set U1,U2 respectively (all other isolated). These two sequences do not interfere with each other and by axiom2 their concatenation NEW=NEW1 NEW2 is also in EX(A,G).

137 ● C satisfies the assumptions of axiom 4, each node in C has at least k unused edges, so there is an extension of NEW by a message (v',e) where v' in C. by axiom 3 we can change this with one of the unused edges. This process can be repeated until at least one vertex in C saturates all its edges to other vertexes in C. this requires at least k messages along previously unused edges. ● We change C to include now also {v} and from axiom 4+3 we will get an edge to v.

138 ● So we have: By induction we will show that for

139

140 Conclusion Theorem 2: Let A be a global algorithm acting on a complete graph G with n nodes. Then the message complexity m(A) is If k nodes woke up we get As we seen Humblet algorithm was therefore it reaches the lower bound.

141

142 THANK Y O U