320 likes | 399 Views
A (nlog(n)) lower bound for leader election in a clique. General. Asynchronous network n processors Each pair of processors are connected Distinct ID’s Each processor knows only its ID. The net as a graph. Let’s look at the network as a graph: G(V,E) |V| = n G is complete
E N D
General • Asynchronous network • n processors • Each pair of processors are connected • Distinct ID’s • Each processor knows only its ID
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
The algorithm • The same algorithm to all processors • The algorithm includes three types of actions (events): • Sending a massage • Receiving a massage • Processing information
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.
SEND sequence • For each execution of the algorithm: SEND = {send1,send2,…,sendk} 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.
NEW(SEND) • NEW(SEND) = {new1,new2,…newm} is the subsequence of SEND, where each newi is a send event which uses an unused edge.
SEND(t), NEW(t) • SEND(t) – the prefix in length t of SEND. • NEW(t) – the prefix in length t of NEW.
Example: a a V = (1,2,3,4) E = (a,b,c,d,e,f) 1 1 2 2 e e f f d d c c 4 4 3 3 b b Let’s build SEND and NEW from a certain algorithm that acts as follows:
m1 1 1 2 2 a 4 4 3 3 SEND = {(1,a,m1), NEW = {(1,a,m1),
1 1 2 2 m2 4 4 3 3 b SEND = {(1,a,m1),(4,b,m2), NEW = {(1,a,m1),(4,b,m2),
m3 1 1 2 2 a 4 4 3 3 SEND = {(1,a,m1),(4,b,m2),(2,a,m3), NEW= {(1,a,m1),(4,b,m2),
1 1 2 2 d m4 4 4 3 3 SEND = {(1,a,m1),(4,b,m2),(2,a,m3),(4,d,m4) NEW= {(1,a,m1),(4,b,m2),(4,d,m4),
1 1 2 2 f m5 4 4 3 3 SEND = {(1,a,m1),(4,b,m2),(2,a,m3),(4,d,m4),(2,f,m5), NEW= {(1,a,m1),(4,b,m2),(4,d,m4),(2,f,m5),
1 1 2 2 d m6 4 4 3 3 SEND = {(1,a,m1),(4,b,m2),(2,a,m3),(4,d,m4),(2,f,m5),(1,d,m6)} NEW = {(1,a,m1),(4,b,m2),(4,d,m4),(2,f,m5)} The algorithm has terminated.
So we got: SEND= {(1,a,m1),(4,b,m2),(2,a,m3),(4,d,m4),(2,f,m5),(1,d,m6)} = {send1, send2, send3, send4, send5, send6} NEW = {send1, send2, send4, send5} SEND(2) = {send1, send2} NEW(3) = {send1, send2, send4} SEND(0) = NEW(0) = { } (always true…)
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.
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.
In the previous example: NEW ={(1,a,m1),(4,b,m2),(4,d,m4),(2,f,m5)} => G(NEW) is the following graph: a a 1 1 2 2 d d f 4 4 3 3 b b Can we say that A is a global algorithm?
Axioms Some axioms hold for every algorithm A and every graph G (not necessarily complete). These axioms are needed for the formal proof.
Axioms: axiom 1 Axiom 1: The empty sequence {} is in EX(A,G). (Trivial)
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:
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. e’ e’ e e This is because a node cannot distinguish between its unused edges.
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.
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).
Lemma There is an execution of A on G, in which its beginning creates one connected component U, and all other node are isolated. Let A be a global algorithm acting on a complete graph G(V,E), and let U be any subset of V.
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.
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)? No. • What is e(n)? e(n) is the lower bound for edge complexity (and therefore for massage complexity) of A.
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 U1, U2 and {v}, such that |U1| =|U2| = k. We know by the lemma that there is an execution of A, such that its beginning makes U1 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) ).
We know the same about U2. Let’s look at these executions of A, and recall axiom 2. U1 and U2 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 U1 or U2. And, according to axiom 3, it might use an unused edge that goes to another node in U1 or U2. We know that each node in U1 has k unused edges that go to U2, 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.
i 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).
References • E. Korach, S. Moran and S. Zaks Optimal lower bounds for some distributed algorithms for a complete network of processors, 1987