distributed computing 1. lower bound for leader election on a complete graph shmuel zaks...

54
Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks [email protected] ©

Upload: armani-bourne

Post on 14-Dec-2015

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Distributed Computing

1. Lower bound for leader election on a complete graph

Shmuel [email protected]

©

Page 2: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Model

Asynchronous network G(V,E) |V| = n processorsG is complete : every two

processors are connectedDistinct ID’sEach processor knows only its ID

Page 3: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©
Page 4: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

The algorithm

The same algorithm to all processors

The algorithm includes three types of actions (events):Sending a massageReceiving a massageProcessing information

Page 5: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Theorem: The message complexity

of the leader election problem

on a complete network is (n log n). W

KMZ

Page 6: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

f(n) –

maximal number of messages for a complete network of size n

We show that

f (2n+1) 2f (n) + O(n)³

Informal proof

Page 7: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

This implies that f or infi nitely many

n's f (n) c nlogn f or some c>0³

hence

f (n) = (n log n)W

Page 8: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

n n

1

Page 9: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

n n

1f(n)

f (2n+1) f (n) ³

Page 10: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

n n

1 f(n)

f (2n+1) f (n) + f (n)³

Page 11: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

n n

1

O(n)

f (2n+1) f (n) + f (n) + O(n)³

Page 12: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

A send event is identified with the triple (v,e,m) , where v is the node sending message m on edge e.

Formal proof

ve

Given an algorithm, consider only the events of sending messages.

Page 13: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

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

for each algorithm there are usually many different executions, thus many different SEND sequences.

Page 14: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

NEW(SEND)

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

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

(An edge is used if a message has already been sent along it from either end )

Page 15: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

SEND(t) – the prefix of length t of SEND NEW(t) – the prefix in length t of NEWSEND(t’), for t’>t, is an extension of

SEND(t) SEND is a completion of SEND(t)

Page 16: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Example

V = (1,2,3,4)E = (a,b,c,d,e,f)

a

b

cd e f

1

4 3

2a

b

cd f

Page 17: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

1

4 3

21

4 3

2

SEND = {NEW = {

a

m1

(1,a,m1),(1,a,m1),

Page 18: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

1

4 3

21

4 3

2

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

b

m2 (4,b,m2),(4,b,m2),

Page 19: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

1

4 3

21

4 3

2

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

a

m3

(2,a,m3),

Page 20: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

1

4 3

21

4 3

2

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

d m4(4,d,m4)(4,d,m4)

Page 21: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

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

f

m5

(2,f,m5),(2,f,m5),

Page 22: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

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)

d m6

(1,d,m6)

end

Page 23: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

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

Page 24: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

for every possible execution of A on G there is NEW.

EX(A,G) is all the prefixes of all possible NEWs.

Page 25: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Global algorithm

Given G, and an execution,G(NEW(t)) is the graph with same nodes but

contains only edges that were used in NEW(t).

Algorithm A is global if for every execution of A, G(NEW) is connected.

Clearly, algorithm for leader election must be global.

Page 26: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

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 27: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Axioms

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

Page 28: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

For the next axiom :

How do we start?

Page 29: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Axiom 1

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

Page 30: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

For the next axiom :

Asynchrony in the network

Page 31: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Axiom 2

1 2

1 2

1 2

I f and do not

interf ere with each other,

and , EX(A,G),

then EX(A,G).

s s

s s

s s

Î

× Î

Page 32: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

1 2

1 2

and do not

interf ere with each other

if no two edges in and

share any endpoint.

s s

s s

Page 33: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

For the next axiom :

A node cannot distinguish between unused edges

Page 34: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Axiom 3

I f EX(A,G), with a last

element (v,e,m) , and e' is an

used edge adjacent to v,

and ' is obtained f rom

by replacing (v,e,m) by (v,e' ,m),

then ' EX(A,G).

s

s s

s

Î

Î

Page 35: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

v

e

e’

(v,e,m)

(v,e’,m)

Page 36: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

For the next axiom :

So far – EX(A,G) could be empy.

For global algorithms…

Page 37: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Axiom 4

I f EX(A,G) and C a proper

subset of V containing all the

non-isolated nodes in G( ),

then there is an extension '

of in which the fi rst message

(v,e) in ' - satisfi es v C.

s

s

s

s

s s

Î

Î

Page 38: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

v

C

Page 39: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Edge complexity, message complexity

The edge complexity e(A) of an algorithm A (on a graph G) is the maximal length of NEW, over all possible executions of A.

The message complexity m(A) of an algorithm A (on a graph G) is the maximal length of SEND, over all possible executions of A.

( ) ( )m A e A³

Page 40: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Lemma

Let A be a global algorithm f or a complete

graph G(V,E), and let U V .

Then there exists EX(A,G) such that

G( ) has one connected component whose

set of vertices is U , and the vertices in

s

s

¹ ¹ÆÌ Ì

Î

V-U are isolated

Page 41: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

U

V-Us

Page 42: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

start with = .

repeat

extend the execution

by a message f rom a node

in U (by axiom 4)

to a node in U (by axiom 3) .

until G( ) contains one conected

component, whose vertices are U.

Ex

s

s

s

Æ

tend until the execution terminatess

Page 43: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

U

V-Us

Page 44: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

e(U)

By the lemma, for every subset U of V we can find at least one execution of A that will first make U a connected component and leave all other 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).

Page 45: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

I s it possible that U=U'

but e(U) e(U') ?¹

Yes.

Ex: give an example!

Page 46: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

e(k)

e(k)= min(e(U)| U V, |U|=k)Í

e(n) is the lower bound for edge complexity (and therefore for message complexity) of A.

Page 47: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

Claim:

nFor k< :

2

e(2k+1) 2e(k) + k + 1³

Page 48: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

1 2

1 2

Proof :Let U be a disjoint union

U=U U { }

s.t. |U | | U |=k and e(U)=e(2k+1).

vÈ È

=

Page 49: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

So, we got execution that creates one connected component U of size 2k +1, and

( ) (2 1) 2 ( ) 1e U e k e k k³ + ³ + +

With the initial condition of e(1) = 0 we have for n = 2t – 1:

1 1( ) ( 1)log( ) ( log )

2 2n

e n n n n+

³ + = W

( ) ( log )e m n nÞ = W

Page 50: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

hence, fi nding a leader,

or a spanning tree, is (n log n)W

2

Also shown:

fi nding a minimum spanning tree

is (n )W

Page 51: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

n n

1 1

0

Page 52: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

1 1

0

0

0

1

1

0

Page 53: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©
Page 54: Distributed Computing 1. Lower bound for leader election on a complete graph Shmuel Zaks zaks@cs.technion.ac.il ©

References

E. Korach, S. Moran and S. Zaks Optimal lower bounds for some

distributed algorithms for a complete network of processors, 1987