CPSC 668 Distributed Algorithms and Systems

19
CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch

description

CPSC 668 Distributed Algorithms and Systems. Fall 2009 Prof. Jennifer Welch. Asynchronous Lower Bound on Messages.  ( n log n ) lower bound for any leader election algorithm A that (1) works in an asynchronous ring (2) is uniform (doesn't use ring size) (3) elects maximum id - PowerPoint PPT Presentation

Transcript of CPSC 668 Distributed Algorithms and Systems

Page 1: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 1

CPSC 668Distributed Algorithms and Systems

Fall 2009

Prof. Jennifer Welch

Page 2: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 2

Asynchronous Lower Bound on Messages(n log n) lower bound for any leader

election algorithm A that(1) works in an asynchronous ring

(2) is uniform (doesn't use ring size)

(3) elects maximum id

(4) guarantees everyone learns id of winner

necessary for result to hold

necessary for this proof to work

no loss of generality

no loss of generality

Page 3: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 3

Statement of Key Result

• Theorem (3.5): For every n that is a power of 2 and every set of n ids, there is a ring using those ids on which any asynchronous leader election has a schedule in which at least M(n) messages are sent, where– M(2) = 1 and– M(n) = 2M(n/2) + (n/2 - 1)/2, n > 2.

• Why does this give (n log n) result?– because M(n) = (n log n)

(cf. how to solve recurrences)

Page 4: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 4

Discussion of Statement

• power of 2: can be adapted for other case• "schedule": the sequence of events (and

events only) extracted from an execution, i.e., discard the configurations– configuration gives away number of processors

but we will want to use the same sequence of events in different size rings

Page 5: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 5

Idea of Asynchronous Lower Bound• The number of messages, M(n), is described

by a recurrence:– M(n) = 2 M(n/2) + (n/2 - 1)/2

• Prove the bound by induction• Double the ring size at each step

– so induction is on the exponent of 2

• Show how to construct an expensive execution on a larger ring by starting with two expensive executions on smaller rings (2*M(n/2)) and then causing about n/4 extra messages to be sent

Page 6: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 6

Open Schedules

• To make the induction go through, the expensive executions must have schedules that are "open".

• Definition of open schedule: There is an edge over which no message is delivered.

• An edge over which no message is delivered is called an open edge.

Page 7: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 7

• Suppose n = 2.

• Suppose x > y. Then p0 wins and p1 must learn that the leader id is x. So p0 must send a message to p1. Truncate immediately after the message is sent (before it is delivered) to get desired open schedule.

Proof of Base Case

p0 p1p1x y

Page 8: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 8

Proof of Inductive Step• Suppose n ≥ 4.

• Split S (set of ids) into two halves, S1 and S2.

• By inductive hypothesis, there are two rings, R1 and R2:

Page 9: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 9

Apply Inductive Hypothesis

R1 has an open schedule 1 in which at least M(n/2) messages are sent and e1 = (p1,q1) is an open edge.

R2 has an open schedule 2 in which at least M(n/2) messages are sent and e2 = (p2,q2) is an open edge.

Page 10: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 10

Paste Together Two Rings

• Paste R1 and R2 together over their open edges to make big ring R.

• Next, build an execution of R with M(n) messages…

Page 11: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 11

Paste Together Two Executions

• Execute 1: procs. on left cannot tell difference between being in R1 and being in R. So they behave the same and send M(n/2) msgs in R.

• Execute 2: procs. on right cannot tell difference between being in R2 and being in R. So they behave the same and send M(n/2) msgs in R.

Page 12: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 12

Generating Additional Messages

• Now we have 2*M(n/2) msgs.• How to get the extra (n/2 - 1)/2 msgs?

• Case 1: Without unblocking (delivering a msg on) ep or eq, there is an extension of 1 2 on R in which (n/2 - 1)/2 more msgs are sent.

• Then this is the desired open schedule.

Page 13: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 13

Generating Additional Messages

• Case 2: Without unblocking (delivering a msg on) ep or eq, every extension of

1 2 on R leads to quiescence: – no proc. will send another msg. unless it

receives one– no msgs are in transit except on ep and eq

• Let 3 be any extension of 1 2 that leads to quiescence.

Page 14: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 14

Getting n/2 More Messages

• Let 4'' be an extension of 1 2 3 that leads to termination.

• Claim: At least n/2 messages are sent in 4''. Why?– Each of the n/2 procs. in the half of R not

containing the leader must receive a msg to learn the leader's id.

– Until 4'' there has been no communication between the two halves of R (remember the open edges)

Page 15: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 15

Getting an Open Schedule

• Remember we want to use this ring R and this expensive execution as building blocks for the next larger power of 2, in which we will paste together two open executions

• So we have to find an expensive open execution (with at least one edge over which no msg is delivered).

1 2 3 4'' might not be open• A little more work is needed…

Page 16: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 16

Getting an Open Schedule• As msgs in ep and eq are delivered in

4'', procs. "wake up" from quiescent state and send more msgs.

• Sets of awakened procs.(P and Q) expand outward around ep and eq :

Page 17: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 17

Getting an Open Schedule

• Let 4' be the prefix of 4'' when n/2 - 1 msgs have been sent

• P and Q cannot meet in 4', since less than n/2 msgs are sent in 4'

• W.l.o.g., suppose the majority of these msgs are sent by procs in P (at least (n/2 - 1)/2 msgs)

• Let 4 be the subsequence of 4' consisting of just the events involving procs. in P

Page 18: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 18

Getting an Open Schedule

• When executing 1234, processors in P behave the same as when executing 1234'. Why?

• The only difference between 4 and 4' is that 4 is missing the events by procs. in Q.

• But since there is no communication in 4 between procs. in P and procs. in Q, procs. in P cannot tell the difference.

Page 19: CPSC 668 Distributed Algorithms and Systems

CPSC 668 Set 4: Asynchronous Lower Bound for LE in Rings 19

Wrap Up

• Consider schedule 1234 .• During 1, M(n/2) msgs are sent, none

delivered over ep or eq

• During 2, M(n/2) msgs are sent, none delivered over ep or eq

• During 3, all msgs are delivered except those over ep or eq; possibly some more msgs are sent

• During 4, (n/2 - 1)/2 msgs are sent, none delivered over eq (why??)

• This is our desired schedule for the induction!