Presentation is loading. Please wait.

Presentation is loading. Please wait.

Distributed Algorithms Lecture 10b – by Ali Ghodsi Fault-Tolerance in Asynchronous Networks – Probabilistic Consensus.

Similar presentations


Presentation on theme: "Distributed Algorithms Lecture 10b – by Ali Ghodsi Fault-Tolerance in Asynchronous Networks – Probabilistic Consensus."— Presentation transcript:

1 Distributed Algorithms Lecture 10b – by Ali Ghodsi Fault-Tolerance in Asynchronous Networks – Probabilistic Consensus

2 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 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 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 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 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 7 Count and receive N-t votes 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 varvalue p : (0,1)init x p msgs p [0..1] : intinit 0 begin while y p =b do begin msgs p [0]:=msgs p [1]:=0; shout ; while msgs p [0]+msgs p [1] < N-t do begin receive ; msgs p [v]++; end if msgs p [0]>msgs p [1] then value p :=0 else value p :=1; end Two counters (vector), both initially 0 My initial value Keep looping until decisionBroadcast my value and my round numberReset both counters to 0Choose majority

8 8 If in the right round Proceed as before! Bracha & Tuoeg Probabilistic Consensus Asynchronism:  Shout and receives should go in rounds  Avoid messages being consumed in the wrong round varvalue p : (0,1)init x p round p : intinit 0 msgs p [0..1] : intinit 0 begin while y p =b do begin msgs p [0]:=msgs p [1]:=0; shout ; while msgs p [0]+msgs p [1] < N-t do begin receive ; if r>round p then send to p; else if r=round p then begin msgs p [v]++; end if msgs p [0]>msgs p [1] then value p :=0 else value p :=1; round p ++; end Also send round number Keep track of rounds (initally 0) Postpone future messagesAlso receive round numberMove into next round

9 9 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! Absolute Majority

10 varvalue p : (0,1)init x p round p : intinit 0 weight p : intinit 1 msgs p [0..1] : intinit 0 witness p [0..1]: intinit 0 begin while y p =b do begin witness p [0]:=withness p [1]:=msgs p [0]:=msgs p [1]:=0; shout ; while msgs p [0]+msgs p [1]<N-t do begin receive ; if r>round p then send to p; else if r=round p then begin msgs p [v]++; if w > N/2 then witness p [v]++; end if witness p [0]>0 then value p :=0 else if witness p [1]>0 then value p :=1 else if msgs p [0]>msgs p [1] then value p :=0 else value p :=1; weight p :=msgs p [value p ]; if witness p [value p ]>t then y p =value p ; round p ++; end shout end Idea: If any node sees more than N/2 similar values, it has witnessed an absolute majority Weight is initially 1Counter for number of witnesses for 0 and 1Reset number if witnesses in each roundAlso send the weight of the voteAlso receive the weight of the voteSomeone’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 voteBefore 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

11 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 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 p 3 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 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!


Download ppt "Distributed Algorithms Lecture 10b – by Ali Ghodsi Fault-Tolerance in Asynchronous Networks – Probabilistic Consensus."

Similar presentations


Ads by Google