1 / 13

Distributed Algorithms

Distributed Algorithms. Lecture 10b – by Ali Ghodsi Fault-Tolerance in Asynchronous Networks – Probabilistic Consensus. Impossibility of Consensus. We know there exists an infinite execution in any consensus algorithm for asynchronous networks that tolerates  1 failure

shayla
Download Presentation

Distributed Algorithms

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. Distributed Algorithms Lecture 10b – by Ali Ghodsi Fault-Tolerance in Asynchronous Networks – Probabilistic Consensus

  2. Impossibility of Consensus • We know there exists an infinite execution in any consensus algorithm for asynchronous networks that tolerates  1 failure • Why exactly is such an algorithm not a consensus algorithm?

  3. Definition: T-crash fair executions • A t-crash-robust algorithm is a consensus algorithm if it satisfies: • Termination • All correct processes eventually decide • Agreement • In any configuration, the decided processes should have decided for the same value (0 or 1) • Non-triviality • There exists at least one possible input configuration where the decision is 0 • There exists at least one possible input configuration where the decision is 1 • Example, maybe input “0,0,1”->0 while “0,1,1”->1

  4. Definition: T-crash fair executions • A t-crash-robust algorithm is a consensus algorithm if it satisfies: • Termination • All correct processes eventually decide • Agreement • In any configuration, the decided processes should have decided for the same value (0 or 1) • Non-triviality • There exists at least one possible input configuration where the decision is 0 • There exists at least one possible input configuration where the decision is 1 • Example, maybe input “0,0,1”->0 while “0,1,1”->1

  5. How to make it possible • Lets make an algorithm that makes such infinite executions unlikely! • Even if such infinite executions would be unlikely, this would not formally be a consensus algorithm • How to change the definition? • What do we require for “probabilistic consensus” algorithms?

  6. Probabilistic Consensus • A probabilistic t-crash-robust algorithm is a consensus algorithm if it satisfies: • Termination/Convergence • lim P[a correct process has not decided after k steps] = 0 k→ • Agreement • In any configuration, the decided processes should have decided for the same value (0 or 1) • Non-triviality • There exists at least one possible input configuration where the decision is 0 • There exists at least one possible input configuration where the decision is 1 • Example, maybe input “0,0,1”->0 while “0,1,1”->1

  7. Keep looping until decision Reset both counters to 0 Broadcast my value and my round number Count and receive N-t votes Choose majority Bracha & Tuoeg Probabilistic Consensus • Can tolerate t < N/2 crash-failures • N=10 t=4, N=11 t=5 • Cannot wait on more than N-t receives var valuep : (0,1) init xp msgsp[0..1] : int init 0 begin while yp=b do begin msgsp[0]:=msgsp[1]:=0; shout <vote, valuep>; while msgsp[0]+msgsp[1] < N-t do begin receive <vote, v>; msgsp[v]++; end if msgsp[0]>msgsp[1] then valuep:=0 else valuep:=1; end end My initial value Two counters (vector), both initially 0

  8. Also receive round number Postpone future messages If in the right round Proceed as before! Move into next round Bracha & Tuoeg Probabilistic Consensus • Asynchronism: • Shout and receives should go in rounds • Avoid messages being consumed in the wrong round var valuep : (0,1) init xp roundp : int init 0 msgsp[0..1] : int init 0 begin while yp=b do begin msgsp[0]:=msgsp[1]:=0; shout <vote, roundp, valuep>; while msgsp[0]+msgsp[1] < N-t do begin receive <vote, r, v>; if r>roundpthen send<vote, r, v> to p; elseif r=roundpthen begin msgsp[v]++; end end end if msgsp[0]>msgsp[1] then valuep:=0 else valuep:=1; roundp++; end end Keep track of rounds (initally 0) Also send round number

  9. Absolute Majority • Idea: • If any node sees more than N/2 similar values, it has witnessed an absolute majority • Each time you vote V, announce the number of V’s you have seen • I.e. attach the weight of your vote • Other nodes can tell from your weight if you are a witness or not • The vote of a witness overrides any other votes • If more than t witnesses are seen in one round, finally decide!

  10. Weight is initially 1 Counter for number of witnesses for 0 and 1 Reset number if witnesses in each round Also send the weight of the vote Also receive the weight of the vote Someone’s weight is more than N/2, then it has seen half of the votes in one round! Increment the witness counter for that value Witnesses override your next vote Before voting, calculate the weight of the vote If more than t witnesses, decide, and we are DONE Before terminating, give a witness vote in the two following rounds • Idea: If any node sees more than N/2 similar values, it has witnessed an absolute majority var valuep : (0,1) init xp roundp : int init 0 weightp : int init 1 msgsp[0..1] : int init 0 witnessp[0..1] : int init 0 begin while yp=b do beginwitnessp[0]:=withnessp[1]:=msgsp[0]:=msgsp[1]:=0; shout <vote, roundp, valuep, weightp>; while msgsp[0]+msgsp[1]<N-t do begin receive <vote, r, v, w>; if r>roundpthen send<vote, r, v, w> to p; else if r=roundpthen begin msgsp[v]++; if w > N/2 then witnessp[v]++; end end end if witnessp[0]>0 then valuep:=0 elseif witnessp[1]>0 then valuep:=1 elseif msgsp[0]>msgsp[1] then valuep:=0 else valuep:=1; weightp:=msgsp[valuep]; if witnessp[valuep]>t then yp=valuep; roundp++; end shout <vote, roundp, valuep, N-t> shout <vote, roundp+1, valuep, N-t> end

  11. Proving Probabilistic Consensus • Agreement • If any process decides, then all processes decide in the next two rounds • Proof: • First notice that in one round, no two processes can witness for different values (0/1) • I.e, for two witnesses p and q: p receives >N/2 ones, and q receives >N/2 zeroes • We know processes decide if they see t witnesses • If p decides 1 in round k, there were >t witnesses in the round • So everyone in round k has seen at least one witness for 1 • Everyone will therefore vote 1 in round k+1 • In round k+2, everyone will have seen t witnesses, and hence will decide!

  12. Convergence? • How do we know we will ever see a first decide? • Termination/Convergence • lim P[a correct process has not decided after k steps] = 0 k→ • Assume fair scheduling • In any round, for any two nodes p and q, p will receive a message from q with positive probability • For a subset S of correct processes N-t, there exists some positive probability p (maybe very small) that every process in S receives the votes of the processes in S in some round K • With probability p3 this happens in the next two rounds also • Hence in round K, processes in S receive the same vote and vote similarly in round K+1 • In round K+1, there will exist N-t similar votes, hence someone in S have seen a witness in the next round (decide)

  13. Summary • We have shown that probabilistic consensus algorithms exist for the asynchronous networks • It can tolerate up to approx. half of the processes failing!

More Related