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

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

Upload: trudy

Post on 12-Jan-2016

20 views

Category:

Documents


0 download

DESCRIPTION

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 - PowerPoint PPT Presentation

TRANSCRIPT

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

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

Page 2: 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

Page 3: A    (nlog(n)) lower bound for leader election in a clique

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

Page 4: A    (nlog(n)) lower bound for leader election in a clique

The algorithm

• The same algorithm to all processors

• The algorithm includes three types of actions (events):

– Sending a massage

– Receiving a massage

– Processing information

Page 5: A    (nlog(n)) lower bound for leader election in a clique

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.

Page 6: A    (nlog(n)) lower bound for leader election in a clique

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.

Page 7: A    (nlog(n)) lower bound for leader election in a clique

NEW(SEND)

• NEW(SEND) = {new1,new2,…newm}

is the subsequence of SEND, where each newi is a send event which uses an unused edge.

Page 8: A    (nlog(n)) lower bound for leader election in a clique

SEND(t), NEW(t)

• SEND(t) – the prefix in length t of SEND.

• NEW(t) – the prefix in length t of NEW.

Page 9: A    (nlog(n)) lower bound for leader election in a clique

Example:

V = (1,2,3,4)

E = (a,b,c,d,e,f)

1

4 3

2a

b

cde f

1

4 3

2a

b

cde f

Let’s build SEND and NEW from a certain algorithm that acts as follows:

Page 10: A    (nlog(n)) lower bound for leader election in a clique

1

4 3

21

4 3

2

SEND = {(1,a,m1),NEW = {(1,a,m1),

a

m1

Page 11: A    (nlog(n)) lower bound for leader election in a clique

1

4 3

21

4 3

2

SEND = {(1,a,m1),(4,b,m2),NEW = {(1,a,m1),(4,b,m2),

b

m2

Page 12: A    (nlog(n)) lower bound for leader election in a clique

1

4 3

21

4 3

2

SEND = {(1,a,m1),(4,b,m2),(2,a,m3),NEW= {(1,a,m1),(4,b,m2),

a

m3

Page 13: A    (nlog(n)) lower bound for leader election in a clique

1

4 3

21

4 3

2

SEND = {(1,a,m1),(4,b,m2),(2,a,m3),(4,d,m4)NEW= {(1,a,m1),(4,b,m2),(4,d,m4),

d m4

Page 14: A    (nlog(n)) lower bound for leader election in a clique

1

4 3

21

4 3

2

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),

f

m5

Page 15: A    (nlog(n)) lower bound for leader election in a clique

1

4 3

21

4 3

2

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)}

d m6

The algorithm has terminated.

Page 16: A    (nlog(n)) lower bound for leader election in a clique

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…)

Page 17: A    (nlog(n)) lower bound for leader election in a clique

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.

Page 18: A    (nlog(n)) lower bound for leader election in a clique

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.

Page 19: A    (nlog(n)) lower bound for leader election in a clique

1

4 3

2a

b

df

1

4 3

2a

b

d

In the previous example:

NEW ={(1,a,m1),(4,b,m2),(4,d,m4),(2,f,m5)}

=> G(NEW) is the following graph:

Can we say that A is a global algorithm?

Page 20: A    (nlog(n)) lower bound for leader election in a clique

Axioms

Some axioms hold for every algorithm A and every graph G (not necessarily complete).

These axioms are needed for the formal proof.

Page 21: A    (nlog(n)) lower bound for leader election in a clique

Axioms: axiom 1

Axiom 1:

The empty sequence {} is in EX(A,G).

(Trivial)

Page 22: A    (nlog(n)) lower bound for leader election in a clique

Axioms: axiom2Assume 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:

Page 23: A    (nlog(n)) lower bound for leader election in a clique

Axioms: axiom 3Axiom 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

e’

Page 24: A    (nlog(n)) lower bound for leader election in a clique

Axioms: axiom 4Axiom4 (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.

Page 25: A    (nlog(n)) lower bound for leader election in a clique

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).

Page 26: A    (nlog(n)) lower bound for leader election in a clique

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.

Page 27: A    (nlog(n)) lower bound for leader election in a clique

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.

Page 28: A    (nlog(n)) lower bound for leader election in a clique

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.

Page 29: A    (nlog(n)) lower bound for leader election in a clique

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) ).

Page 30: A    (nlog(n)) lower bound for leader election in a clique

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.

Page 31: A    (nlog(n)) lower bound for leader election in a clique

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

Page 32: A    (nlog(n)) lower bound for leader election in a clique

References

1. E. Korach, S. Moran and S. Zaks

Optimal lower bounds for some distributed algorithms for a complete network of processors, 1987