1 / 64

Complexity of Distributed Algorithms (Continued…)

Complexity of Distributed Algorithms (Continued…). Seth Gilbert Distributed Programming Laboratory. Complexity. How do we measure the complexity of a distributed algorithm? Three case studies I. Consensus with P (last week) II. Uniform consensus with P III. Consensus with ◊P.

kiaria
Download Presentation

Complexity of Distributed Algorithms (Continued…)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Complexity of Distributed Algorithms (Continued…) Seth Gilbert Distributed Programming Laboratory

  2. Complexity • How do we measure the complexity of a distributed algorithm? • Three case studies • I. Consensus with P (last week) • II. Uniform consensus with P • III. Consensus with ◊P

  3. Complexity (Review) • Problem: Consensus • (Uniform) Agreement • Validity • Termination • Model: • n = 3 • t = 2 (number of failures) • perfect failure detector P OR • eventuallly perfect failure detector <>P OR • synchronous S

  4. Notation (Review) • P : basic model • Pk : no more than k failures • S : synchronous model • At the end of every round, every process knows that all of its messages have been delivered.

  5. Notation (Review) • M1 is a model (e.g., P) • M2 is a sub-model of M1 (e.g., P1) • Algorithm A : • Algorithm is correct for any execution in M1 • Complexity is measured for executions in M2 • I(M1, M2) : local complexity • Maximum number of rounds for some process to decide in any run of M2. • I(M1, M2, *) : global complexity • Maximum number of rounds for all processes to decide in any run of M2

  6. Consensus with P (Review) • For all algorithms A: • l(P,P0)=0 • l(P,P1)=1 • For all k>0, l(P,Pk,*)=2 • For all k>0, I(S,Sk,*)=2 • Consensus Algorithm I achieves these bounds.

  7. II. Uniform Consensus with P • Questions: • How fast can you solve uniform consensus? • Is uniform consensus harder than consensus? • How do the number of failures affect the running time?

  8. Recall Algorithm II… propose(0) decide(0) p1 propose(1) decide(0) p2 propose(0) decide(0) p3

  9. Uniform Consensus with P • In Algorithm II correct processes decide by round 3. Can we do better? • Consider model P1: • Process p1 can decide at the end of round 2: • p1 knows its value was received by p2 in round 1, or p2 fails. • If p2 fails, then everyone decides p1 • If p2 correct, then p2 sends out p1’s value

  10. Algorithm II (v2) propose(0) decide(0) p1 propose(1) decide(0) p2 propose(0) decide(0) p3

  11. Algorithm II (v2) propose(0) decide(0) crash p1 propose(1) decide(0) p2 propose(0) decide(0) p3

  12. Algorithm II (v2) propose(0) decide(0) p1 propose(1) crash p2 propose(0) decide(0) p3

  13. Uniform Consensus with P • Conclusion: I(P1,P1) ≤ 2 • What about I(P, P0)?? • Modify Algorithm 2 to decide after 2 rounds if there are no failures. • Add acknowledgment from p3…

  14. Algorithm II (v3) propose(0) decide(0) p1 0 propose(1) decide(0) 0 p2 propose(0) decide(0) 0 p3 0

  15. Algorithm II (v3) propose(0) crash p1 propose(1) decide(1) (1,1) (1,1) p2 propose(1) p3 (0,1,1) (0,1,1) crash

  16. Uniform Consensus with P • So far: • I(P1,P1) ≤ 2 • I(P,P0,*) ≤ 2 • Next: • l(P,P0) = 2 • l(P,P,*) • I(S,S,*), I(S,S0) • I(P1,P0), I(P1,P1,*)

  17. Show: I(P,P0) = 2 • Assume: • full-information algorithm that ensures: • uniform agreement • termination in one round when there are no failures • We exhibit a contradiction with validity: • indistinguishability argument to go from a run R1 to a run R3 with a contradiction

  18. I(P,P0) : Run R1 : UC propose(0) decide(0) p1 p1 propose(0) decide(0) p2 propose(1) decide(0) p3

  19. I(P,P0) : Run R2 : UC propose(0) decide(0) crash p1 p1 propose(0) crash p2 propose(1) decide(0) p3

  20. I(P,P0) : Run R3 : UC propose(1) crash p1 p1 propose(1) crash p2 propose(1) decide(0) p3

  21. I(P,P0) Conclusion • Algorithm: • I(P,P0) ≤ 2 • Lower bound / indistinguishability: • I(P,P0) > 1 • Conclusion: I(P,P0) = 2

  22. Comparison • Uniform Consensus: I(P,P0) = 2 • NON-Uniform Consensus: I(P,P0) = 0 • Conclusion: • Uniform Consensus is slower than NON-Uniform Consensus.

  23. What about synchronous model? • Assume a synchronous model: • If a process reaches the end of a round k, its round k message was received by all processes that also reache the end of round k. • Claim: l(S,S0) = 1 • Easy to see I(S,S0) > 0… • Algorithm… process p1 decides by the end of round 1 if no failures occur.

  24. Algorithm II (v4) propose(0) decide(0) p1 propose(1) decide(0) p2 decide(0) propose(0) p3

  25. Algorithm II (v4) propose(0) crash p1 propose(1) decide(0) p2 decide(0) propose(0) p3

  26. Algorithm II (v4) propose(0) crash p1 propose(1) crash p2 decide(0) propose(0) p3

  27. What about synchronous model? • Conclusion: • l(S,S0) = 1 • I(S,S*) ≤ 2 (Need to show: I(S,S,*) > 1.) • Implication: S is faster than P • I(S,S0) = 1 • I(P,P0) = 2

  28. 1 vs 2 failures with P • If we assume that only one failure can occur, then a local decision can be reached by round 1: • I(P1,P1) = 1 (see Algorithm II, v2) • In fact, processes can globally decide by round 2: • I(P1,P1,*) = 2 • See Algorithm II (v2)

  29. Algorithm II (v2) propose(0) decide(0) crash p1 propose(1) decide(0) p2 propose(0) decide(0) p3

  30. Algorithm II (v2) propose(0) decide(0) p1 propose(1) crash p2 propose(0) decide(0) p3

  31. Algorithm II (v2) propose(0) decide(0) p1 propose(1) decide(0) p2 propose(0) decide(0) p3

  32. 1 vs 2 failures with P • Conclusion: • l(P1,P1) = 1 • I(P1,P1,*) ≤ 2 (Need to show: I(P1,P1,*) > 1.) • Implication: 1-failure is faster than 2-failures • I(P,P1) ≥ I(P,P0) ≥ 2

  33. Remarks • Uniform consensus is « slower than » consensus • A round-model with P is « slower than » a synchronous system • A model with more failures is « slower than » a model with less failures

  34. Consensus with <>P • Eventually perfect failure detector <>P • n = 3 • Majority correct • Recall: • With <>P, cannot solve consensus if NOT majority correct. • Every consensus algorithm solves UNIFORM consensus.

  35. Consensus with <>P • Recall Algorithm III: • Rotating leader: • Processes take turns being leader. • Leader imposes its estimate on others: • « query/ack » : request estimate from others • « impose/ack » : leader sends estimate to others • « decide » : leader notifies all of decision

  36. Consensus with <>P • Recall Algorithm III: • Rotating leader • Leader « imposes » its estimate on others. • If no process crashes or is suspected, then: • Process p1 can decide after 3 rounds, as soon as it imposes its estimate. • All processes can decide after 4 rounds when they learn that p1 has decided.

  37. Consensus with <>P • Algorithm III (v2): • Decentralized, optimized variant • The leader «query» message is removed in the first phase. • Processes broadcast their ack (nack) to all (instead of just to the leader). • If no process crashes or is suspected to have crashed, then: • All processes decide after 2 rounds (that is, «ack» and «impose/ack»).

  38. Consensus with <>P • Can we do better? • Can some process (all processes) decide after one round, when no process crashes or is suspected to have crashed? • How many rounds are needed for some process (all processes) to decide if there is no false suspicion but the processes can crash?

  39. Consensus with <>P • FLP: We can clearly not bound the number of rounds needed for the processes to decide if there are false suspicions: this would contradict FLP. • We can however bound the number of rounds in synchronous runs. • We say that a run is nice if no process crashes or is suspected to have crashed.

  40. Consensus with <>P • We show that: • A process can decide by round 1 if no process crashes or is suspected: l(<>P1,P0) = 1 • To all decide, the processes need two rounds, even if no process crashes or is suspected: l(<>P1,P0,*) = 2 • Processes need 3 rounds if at least one process crash: l(<>P1,P1,*) = 3

  41. Consensus with <>P • We describe a round-by-round algorithm with <>P that uses another underlying consensus algorithm, e.g., algorithm III • Processes move from a round to another round: a round terminates when a process receives at least a message from a process and receives a message from the other process or suspects it

  42. Consensus with <>P (p2,p3) • In round 1: • If p2/p3 gets p1’s message, it decides and broadcasts the decision to all. Otherwise… • In round 2: • If p2/p3 gets p1’s value (from p1, p2, or p3), it adopts p1’s value and sends it to all. • Otherwise, p2/p3 gets p2’s value, adopts it, and sends it to all. • In round 3: • If p2/p3 never received p1’s msg, then it decides p2’s value. • Otherwise, trigger consensus with value adopted in round 2.

  43. Consensus with <>P (p1) In round 1 and round 2: By default, p1 keeps its value. If p1 receives a decision message, it decides and broadcasts the decision to all. In round 3: If p1 learns that p2 or p3 has never heard from p1, then p1 invokes consensus with p2’s value.

  44. Consensus with <>P • In round 1: • If p2 (or p3) receives p1’s message, it decides and broadcasts the decision to all. • p1 sends again its value in round 2. • Otherwise, if p2 (or p3) fails, then p3 (or p2) might not here the decision, and might not have gotten p1’s message in round 1 (due to false suspicion).

  45. Nice run R propose(0) decide(0) p1 propose(1) decide(0) p2 propose(1) decide(0) p3

  46. Almost nice run R’ propose(0) decide(0) p1 propose(1) decide(0) p2 decide(0) propose(1) p3

  47. Good run R’’ propose(0) crash p1 propose(1) decide(1) p2 propose(1) p3 decide(1)

  48. Not so nice run R’’ propose(0) propose(0) p1 propose(1) decide(0) p2 propose(1) p3 propose(0)

  49. Not so nice run R’’’ propose(0) p1 propose(1) decide(0) p2 propose(1) p3

  50. Bad run R’’’ propose(0) propose(0) p1 propose(1) propose(0) p2 propose(1) propose(1) p3

More Related