1.23k likes | 1.26k Views
Explore a fault-tolerant consensus communication model and algorithm for achieving agreement in a network despite crash failures. Learn how the algorithm handles faulty processors and lost messages to ensure consensus among all processors. Discover the validity condition and resilience levels for successful decision-making. Includes examples and execution scenarios with failures.
E N D
Communication Model • Complete graph • Synchronous, network
Broadcast a a a a Send a message to all processors in one round
a a a a At the end of round: everybody receives a
Broadcast a b a b a a b b Two or more processes can broadcast at the same round
a,b b a,b a,b a
Crash Failures a Faulty processor a a a
a Faulty processor a Some of the messages are lost, they are never received
a Faulty processor a
Round 1 Round 2 Round 3 Round 4 Round 5 Failure After failure the process disappears from the network
Consensus 0 Start 1 4 3 2 Everybody has an initial value
3 Finish 3 3 3 3 Everybody must decide the same value
1 1 1 1 1 1 1 1 1 1 Validity condition: If everybody starts with the same value they must decide that value Finish Start
A simple algorithm Each processor: • Broadcast value to all processors • Decide on the minimum (only one round is needed)
Start 0 1 4 3 2
Broadcast values 0,1,2,3,4 0 0,1,2,3,4 0,1,2,3,4 1 4 0,1,2,3,4 3 2 0,1,2,3,4
Decide on minimum 0,1,2,3,4 0 0,1,2,3,4 0,1,2,3,4 0 0 0,1,2,3,4 0 0 0,1,2,3,4
Finish 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 This algorithm satisfies the validity condition Finish Start If everybody starts with the same initial value, everybody decides on that value (minimum)
Consensus with Crash Failures The simple algorithm doesn’t work Each processor: • Broadcast value to all processors • Decide on the minimum
Start fail 0 0 1 0 4 3 2 The failed processor doesn’t broadcast Its value to all processors
Broadcasted values fail 0 0,1,2,3,4 1,2,3,4 1 4 0,1,2,3,4 1,2,3,4 3 2
Decide on minimum fail 0 0,1,2,3,4 1,2,3,4 0 1 0,1,2,3,4 1,2,3,4 0 1
Finish fail 0 0 1 0 1 No Consensus!!!
If an alforithm solves consensus for f failed process we say it is: an f-resilient consensus algorithm
0 1 2 Finish Start 1 3 4 1 Example: The input and output of a 3-resilient consensus algorithm
An f-resilient algorithm Round 1: Broadcast my value Round 2 to round f+1: Broadcast any new received values End of round f+1: Decide on the minimum value received
Example: f=1 failures, f+1 = 2 rounds needed Start 0 1 4 3 2
Example: f=1 failures, f+1 = 2 rounds needed Round 1 0 fail 0 0,1,2,3,4 1,2,3,4 1 0 4 (new values) 0,1,2,3,4 1,2,3,4 3 2 Broadcast all values to everybody
Example: f=1 failures, f+1 = 2 rounds needed Round 2 0,1,2,3,4 0,1,2,3,4 1 4 0,1,2,3,4 0,1,2,3,4 3 2 Broadcast all new values to everybody
Example: f=1 failures, f+1 = 2 rounds needed Finish 0,1,2,3,4 0,1,2,3,4 0 0 0,1,2,3,4 0,1,2,3,4 0 0 Decide on minimum value
Example: f=2 failures, f+1 = 3 rounds needed Start 0 1 4 3 2 Another example execution with 3 failures
Example: f=2 failures, f+1 = 3 rounds needed Round 1 0 Failure 1 1,2,3,4 1,2,3,4 1 0 4 0,1,2,3,4 1,2,3,4 3 2 Broadcast all values to everybody
Example: f=2 failures, f+1 = 3 rounds needed Round 2 0 Failure 1 0,1,2,3,4 1,2,3,4 1 4 0,1,2,3,4 1,2,3,4 3 2 Failure 2 Broadcast new values to everybody
Example: f=2 failures, f+1 = 3 rounds needed Round 3 0 Failure 1 0,1,2,3,4 O, 1,2,3,4 1 4 0,1,2,3,4 0,1,2,3,4 3 2 Failure 2 Broadcast new values to everybody
Example: f=2 failures, f+1 = 3 rounds needed Finish 0 Failure 1 0,1,2,3,4 O, 1,2,3,4 0 0 0,1,2,3,4 0,1,2,3,4 3 0 Failure 2 Decide on the minimum value
Example: f=2 failures, f+1 = 3 rounds needed Start 0 1 4 3 2 Another example execution with 3 failures
Example: f=2 failures, f+1 = 3 rounds needed Round 1 0 Failure 1 1,2,3,4 1,2,3,4 1 0 4 0,1,2,3,4 1,2,3,4 3 2 Broadcast all values to everybody
Example: f=2 failures, f+1 = 3 rounds needed Round 2 0 Failure 1 0,1,2,3,4 0,1,2,3,4 1 4 0,1,2,3,4 0,1,2,3,4 3 2 Broadcast new values to everybody Remark: At the end of this round all processes know about all the other values
Example: f=2 failures, f+1 = 3 rounds needed Round 3 0 Failure 1 0,1,2,3,4 0,1,2,3,4 1 4 0,1,2,3,4 0,1,2,3,4 3 2 Failure 2 Broadcast new values to everybody (no new values are learned in this round)
Example: f=2 failures, f+1 = 3 rounds needed Finish 0 Failure 1 0,1,2,3,4 0,1,2,3,4 0 0 0,1,2,3,4 0,1,2,3,4 3 0 Failure 2 Decide on minimum value
If there are f failures and f+1 rounds then there is a round with no failed process 2 3 4 5 6 1 Round Example: 5 failures, 6 rounds No failure
In the algorithm, at the end of the round with no failure: • Every (non faulty) process knows • about all the values of all other • participating processes • This knowledge doesn’t change until • the end of the algorithm
Therefore, at the end of the round with no failure: everybody would decide the same value However, we don’t know the exact position of this round, so we have to let the algorithm execute for f+1 rounds
Validity of algorithm: when all processes start with the same input value then the consensus is that value This holds, since the value decided from each process is some input value
A Lower Bound Theorem: Any f-resilient consensus algorithm requires at least f+1 rounds
Proof sketch: Assume for contradiction that f or less rounds are enough Worst case scenario: There is a process that fails in each round
Worst case scenario Round 1 a before process fails, it sends its value a to only one process
Worst case scenario 2 Round 1 a before process fails, it sends value a to only one process
Worst case scenario 2 3 f Round 1 ……… a At the end of round f only one process knows about value a