Presentation is loading. Please wait.

Presentation is loading. Please wait.

A (nlog(n)) lower bound for leader election in a clique.

Similar presentations


Presentation on theme: "A (nlog(n)) lower bound for leader election in a clique."— Presentation transcript:

1 A (nlog(n)) lower bound for leader election in a clique

2 General Asynchronous network n processors Each pair of processors are connected Distinct ID’s Each processor knows only its ID

3 The net as a graph Let’s look at the network as a graph: G(V,E) |V| = n G is complete From now on, we don’t distinguish between processors and nodes, and between edges and connections

4 The algorithm The same algorithm to all processors The algorithm includes three types of actions (events): –Sending a massage –Receiving a massage –Processing information

5 Send event Let us look at the first type event, sending a massage, and define it as “send” event. Each send event is identified with the triple (v,e,m), where v is the node sending massage m on edge e.

6 SEND sequence For each execution of the algorithm: SEND = {send 1,send 2,…,send k } is the sequence of send events that occurred in the execution, in their chronological order. Of course for each algorithm there are many different executions and therefore many different potential SEND sequences.

7 NEW(SEND) NEW(SEND) = {new 1,new 2,…new m } is the subsequence of SEND, where each new i is a send event which uses an unused edge.

8 SEND(t), NEW(t) SEND(t) – the prefix in length t of SEND. NEW(t) – the prefix in length t of NEW.

9 Example: V = (1,2,3,4) E = (a,b,c,d,e,f) 1 43 2 a b cd e f 1 43 2 a b cd e f Let’s build SEND and NEW from a certain algorithm that acts as follows:

10 1 43 21 43 2 SEND = {(1,a,m 1 ), NEW = {(1,a,m 1 ), a m 1

11 1 43 21 43 2 SEND = {(1,a,m 1 ),(4,b,m 2 ), NEW = {(1,a,m 1 ),(4,b,m 2 ), b m 2

12 1 43 21 43 2 SEND = {(1,a,m 1 ),(4,b,m 2 ),(2,a,m 3 ), NEW= {(1,a,m 1 ),(4,b,m 2 ), a m 3

13 1 43 21 43 2 SEND = {(1,a,m 1 ),(4,b,m 2 ),(2,a,m 3 ),(4,d,m 4 ) NEW= {(1,a,m 1 ),(4,b,m 2 ),(4,d,m 4 ), d m 4

14 1 43 21 43 2 SEND = {(1,a,m 1 ),(4,b,m 2 ),(2,a,m 3 ),(4,d,m 4 ),(2,f,m 5 ), NEW= {(1,a,m 1 ),(4,b,m 2 ),(4,d,m 4 ),(2,f,m 5 ), f m 5

15 1 43 21 43 2 SEND = {(1,a,m 1 ),(4,b,m 2 ),(2,a,m 3 ),(4,d,m 4 ),(2,f,m 5 ),(1,d,m 6 )} NEW = {(1,a,m 1 ),(4,b,m 2 ),(4,d,m 4 ),(2,f,m 5 )} d m 6 The algorithm has terminated.

16 So we got : SEND= {(1,a,m 1 ),(4,b,m 2 ),(2,a,m 3 ),(4,d,m 4 ),(2,f,m 5 ),(1,d,m 6 )} = {send 1, send 2, send 3, send 4, send 5, send 6 } NEW = {send 1, send 2, send 4, send 5 } SEND(2) = {send 1, send 2 } NEW(3) = {send 1, send 2, send 4 } SEND(0) = NEW(0) = { } (always true…)

17 EX(A,G) for every possible execution of A on G there is NEW. EX is all the prefixes of all possible NEWs. We call EX the exhaustive set of A on G.

18 Global algorithm G(NEW) is the same graph as G, but contains only edges that were used in NEW. Algorithm A is global, if for every execution of A, G(NEW) is connected. This means that every time we run the algorithm, the edges that it uses create a connected graph. Clearly, algorithm for leader election must be global.

19 1 43 2 a b d f 1 43 2 a b d In the previous example: NEW ={(1,a,m 1 ),(4,b,m 2 ),(4,d,m 4 ),(2,f,m 5 )} => G(NEW) is the following graph: Can we say that A is a global algorithm?

20 Axioms Some axioms hold for every algorithm A and every graph G (not necessarily complete). These axioms are needed for the formal proof.

21 Axioms: axiom 1 Axiom 1: The empty sequence {} is in EX(A,G). (Trivial)

22 Axioms: axiom2 Assume that the beginnings of 2 executions of A do not touch a common node in G:  If we concatenate them we get a legal beginning of A:

23 Axioms: axiom 3 Axiom 3: Assume A began acting on G, and last send that used an unused edge was (v,e,m). Assume also that v has another unused edge e’. => There is an execution where A uses e’ instead. This is because a node cannot distinguish between its unused edges. e e’ e

24 Axioms: axiom 4 Axiom4 (holds for global algorithms): Assume A began acting on G and created one or more connected components and all other nodes are isolated: => could be that the next node that will use an unused edge belongs to one of these components. A is global, so some unused edges have to be used, but maybe all the isolated nodes are asleep.

25 Edge complexity and massage complexity The edge complexity of an algorithm A (on a graph G) is the maximal length of NEW, over all possible executions of A. We denote it by e(A). This is the maximal number of edges A might use. The massage complexity of an algorithm A (on a graph G) is the maximal length of SEND, over all possible executions of A. We denote it by m(A). This is the maximal number of massages A might cause. It’s obvious that m(A) e(A).

26 Lemma Let A be a global algorithm acting on a complete graph G(V,E), and let U be any subset of V. There is an execution of A on G, in which its beginning creates one connected component U, and all other node are isolated.

27 Proof: We construct the execution s as follows: If |U| 1 then s = {} (axiom 1). Else: Start with {} (axiom 1). Choose u from U. Define W = {u}. W is now the connected component from axiom 4. While (W U) { Send a massage from a node in W (axiom 4) to a node v U (axiom 3 + graph completeness). If v W then W = W {v}. } Because A is global the above process will terminate.

28 e(U), e(k) We saw in the lemma that for every subset U of V we can find at least one execution of A that its beginning will make U a connected component and leave all another nodes isolated. From all the executions that do so we will choose the one that uses the maximal number of edges, and denote that number e(U). If |U| = k then we denote e(k) to be e(U). Could it be that for different U, V that have the same size e(U) != e(V)? What is e(n)? e(n) is the lower bound for edge complexity (and therefore for massage complexity) of A. No.

29 Claim : e(2k+1) 2e(k) + k + 1 Proof: Let U be a subset of V, holds |U| = 2k + 1. We can see U as a disjoint union of U 1, U 2 and {v}, such that |U 1 | =|U 2 | = k. We know by the lemma that there is an execution of A, such that its beginning makes U 1 a connected component and leaves all other nodes isolated. We know that the execution that does so using maximal number of edges use e(k) edges (according to the definition of e(k) ).

30 We know the same about U 2. Let’s look at these executions of A, and recall axiom 2. U 1 and U 2 do not have a common node, So the concatenation of the executions is a legal beginning of A. Now we have a legal execution of A, which created 2 connected components, leaves all other nodes isolated, and used 2e(k) edges. According to axiom 4, could be that next massage that is sent on an unused edge is sent from U 1 or U 2. And, according to axiom 3, it might use an unused edge that goes to another node in U 1 or U 2. We know that each node in U 1 has k unused edges that go to U 2, and vice versa. So, This process might continue at least k times. After that, could be that the next massage that use new edge goes to v.

31 So, we got execution that creates one connected component U of size 2k +1, and e(U) = e(2k+1) 2e(k) + k +1. With the initial condition of e(1) = 0 we have for n = 2 – 1: e(n) 1/2 (n+1)log(1/2(n+1)) = (nlogn).  e(m) = (nlogn). i

32 References 1.E. Korach, S. Moran and S. Zaks Optimal lower bounds for some distributed algorithms for a complete network of processors, 1987


Download ppt "A (nlog(n)) lower bound for leader election in a clique."

Similar presentations


Ads by Google