27
Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks [email protected] ©

Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks [email protected] ©

Embed Size (px)

Citation preview

Page 1: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

Distributed Computing3. Leader Election – lower bound for ring networks

Shmuel [email protected]

©

Page 2: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

Theorem: For every algorithm A for maximum finding in unidirectional rings, and every set I of n identities,

( ) ( log )Aavg I n n

PKR

Page 3: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

Unidirectional ring

Same messages in every execution

Page 4: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

1

3

5

4ring

(4 , 1 , 3 , 5) (1 , 3 , 5 , 4) (3 , 5 , 4 , 1) (5 , 4 , 1 , 3)

Page 5: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

messages)4 (

)4 ,1

()4 , 1 , 3 (

1

3

5

4

Page 6: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

Sequence 1 2( , ,..., )ts s s s

( )length s tPrefix of a sequence

1 2' ( , ,..., ), 1rs s s s r t Concatenation of sequences su subsequence of if s.t. su ,r t s rutC(S) = all cyclic permutations of S

|C(s)| = length (s)

Page 7: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

( {4 , 1 , 3 , 5,)

(1 , 3 , 5 , 4,)

(3 , 5 , 4 , 1,)

(5 , 4 , 1 , 3} )

s = (4 , 1 , 3 , 5 )

C(s)=

length (s) = 4(4,1,3) is a prefix of s(1,3) is a subsequence of s

1

3

5

4

Page 8: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

In every execution of a maximum finding algorithm A, at least one processor must see its own value

In a ring labeled s, at least one message in C)s( is sent by A

)4 (

)4 ,1 ()4,1,3 (

1

3

5

4)4,1,3,5 (

Page 9: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

– set of all finite sequences of distinct integers

1 2{( , ,..., ) | 1, : }k i jD s s s k i j s s For , , | | :s D E D E

( , ) |{ | ( )} |N s E t E t is a prefix of some r C S

( , ) |{ ( , ) ( ) } |kN s E t N s E length t k ( )

1( , ) ( , )

length s

kkN s E N s E

D

Page 10: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

E does not have to be a finite set.

, , | | :s D E D E

Note: though we wrote

Why?

Page 11: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

s = (4 , 1 , 3 , 5 )

1

3

5

4

E={(4,5),(3,5),(5,4,1),(3),(6,2),(5,4) {

N(s,E) = 4

N1(s,E) =

1 N2(s,E) =

2 N3(s,E) =

1 Nk(s,E) = 0 for k ≥ 4

Page 12: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

Definition: A set

is exhaustive if it has the following two properties:

Prefix property: if then for every

prefix s of u.

Cyclic permutation property:

u E s E

: ( )s D C s E

E D

Page 13: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

is exhaustive: Prefix property: if then for every prefix s of u.

Cyclic permutation property:

u E s E

: ( )s D C s E

E D

Example: the set

1 2 1 1 2{( , ,..., ) | max{ , ,..., }}k kE s s s s s s s

Page 14: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

1

3

5

4E contains also the following:

(4), (4,1),(4,1,3),

(1),

(3),

(5),(5,4),(5,4,1),(5,4,1,3)

E is the set of messages sent by the Chang & Roberts’ algorithm!

Page 15: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

Lemma: Let such that is a

prefix of and , and let A be a maximum

finding algorithm.

If in the execution of A on ring a message

is sent, then in the execution of A on ring a message is sent.

, ,s t u D us t

su t

u

s t

uu

Page 16: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

Theorem: For every maximum finding algorithm A for unidirectional rings, there exists an exhaustive set E(A), such that, for every ring s, A sends at least N(s,E(A)) messages on s. Proof: Let

{ |

}

E(A) s D

A

s

s

a message is sent

when executes on ring

Page 17: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

1. E)A( is exhaustive

1a. Prefix property

,

t

message was sent on ring

was sent on ring

by Lemma : was sent on ring

E(A) length(t) 1

E(A)

tu

tu tu

t tu

t t

{ |

}

E(A) s D

A

s

s

a message is sent

when executes on ring

Page 18: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

1. E)A( is exhaustive

1b. Cyclic permutation property

s

for a ring at least one processor must send

a message C(S)

E(A)

t

t

{ |

}

E(A) s D

A

s

s

a message is sent

when executes on ring

Page 19: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

2. At least N(s,E(A)) messages sent by A on s

E(A)

N(s,E(A))

t

t s

t t

t s

s

is a subsequence of

message was sent on ring

by Lemma : message was sent on ring

at least messages were sent on

{ |

}

E(A) s D

A

s

s

a message is sent

when executes on ring

Page 20: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

distinct identities , given algorithm

all the rings equally probable

- the average-case message complexity

of for rings in

- the worst-case message complexity

of

A

A

n I A

n! perm(

avg (I

I

)

)

A perm(I )

worst (I )

for rings in A perm(I )

Page 21: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

Theorem: For every maximum finding algorithm A for unidirectional rings, and a set of n identities I, we have:

Theorem: For every maximum finding algorithm A for unidirectional rings, and a set of n identities I, we have:

( ) ( log )Aave I n n

( )

( )

1( ) ( , ( ))

!( ) max ( , ( ))

A s perm I

A s perm I

ave I N s E An

worst I N s E A

Page 22: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

( )

( ) 1

1 ( )

1

1( ) ( , ( ))

!1

( , ( ))!

1( , ( ))

!1 ! 1 1 1

(1 ... ) 0.69 log! 2 3

A s perm I

n

ks perm I k

n

kk s perm I

n

k

ave I N s E An

N s E An

N s E An

n nn n n

n k n

Page 23: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

!

( )

!

n n k

perm I

n n

kk

There are prefixes of size

among all rings in

group them into groups, with

exactly cyclic permutations in each

Page 24: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

Theorem: In a unidirectional ring whose size n is unknown, the Chang & Roberts algorithm has an optimal message complexity of

1 1 1(1 ... ) 0.69 log

2 3n n n

n

Exercise: What if n is known?

What if synchronous?

Page 25: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

References

J. E. Burns,A formal model for message passing

systems,TR-91, Indiana University, September

1980.

Page 26: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

References

E. Chang and R. Roberts,An improved algorithm for decentralized

extrema-finding incircular configurations of processes,Communications of the ACM},22, 5, 1979, pp. 281-283.

Page 27: Distributed Computing 3. Leader Election – lower bound for ring networks Shmuel Zaks zaks@cs.technion.ac.il ©

References

J. Pachl, E. Korach and D. Rotem Lower bounds for distributed maximum-

finding algorithm. Journal of Association for Computing Machinery, Vol. 31, No. 4, Oct. 1984, pp. 905-918