Consensus #4 The Consensus Hierarchy Synchronous Systems • In real systems, one can sometimes 1 Read/Write Registers, … tell if a processor had crashed 2 T&S, F&I, Swap, … – Timeouts – Broken TCP connections . . . • Can one solve consensus at least in synchronous systems? ∞ CAS, … Distributed Computing Group Roger Wattenhofer 113 Distributed Computing Group Roger Wattenhofer 114 Send a message to all processors Communication Model in one round: Broadcast p p • Complete graph 2 2 a • Synchronous a p p p p 1 1 3 3 a a p p p p 5 4 5 4 Distributed Computing Group Roger Wattenhofer 115 Distributed Computing Group Roger Wattenhofer 116
At the end of the round: Broadcast: Two or more processes everybody receives a can broadcast in the same round p p 2 2 a a b a p p p p 1 1 3 3 a b a a b b p p p p 5 a 4 5 4 a Distributed Computing Group Roger Wattenhofer 117 Distributed Computing Group Roger Wattenhofer 118 At end of round... Crash Failures a,b p p 2 2 a b Faulty a a,b p p p p 1 1 3 3 processor a a p p a,b p p 5 4 5 4 a Distributed Computing Group Roger Wattenhofer 119 Distributed Computing Group Roger Wattenhofer 120
Some of the messages are lost, Effect they are never received a p p 2 2 a Faulty Faulty p p p p 1 1 3 3 processor processor a p p p p a 5 4 5 4 Distributed Computing Group Roger Wattenhofer 121 Distributed Computing Group Roger Wattenhofer 122 Consensus: After a failure, the process disappears from the network Everybody has an initial value Round Round Round Round Round 0 Start 1 2 3 4 5 p p p p p 1 1 1 1 1 1 p p p p p 4 2 2 2 2 2 Failure p p p p p 3 3 3 3 3 p p p p p 3 4 4 4 4 4 2 p p p p p 5 5 5 5 5 Distributed Computing Group Roger Wattenhofer 123 Distributed Computing Group Roger Wattenhofer 124
Validity condition: Everybody must decide on the If everybody starts with the same value same value they must decide on that value 3 Finish Finish Start 1 1 3 3 1 1 1 1 3 3 1 1 1 1 Distributed Computing Group Roger Wattenhofer 125 Distributed Computing Group Roger Wattenhofer 126 A simple algorithm Start Each processor: 0 1. Broadcasts value to all processors 1 4 2. Decides on the minimum 3 2 (only one round is needed) Distributed Computing Group Roger Wattenhofer 127 Distributed Computing Group Roger Wattenhofer 128
Broadcast values Decide on minimum 0,1,2,3,4 0,1,2,3,4 0 0 0,1,2,3,4 0,1,2,3,4 0,1,2,3,4 0,1,2,3,4 1 0 4 0 0,1,2,3,4 0,1,2,3,4 3 0 2 0 0,1,2,3,4 0,1,2,3,4 Distributed Computing Group Roger Wattenhofer 129 Distributed Computing Group Roger Wattenhofer 130 This algorithm satisfies the validity condition Finish Finish Start 1 1 0 1 1 1 1 0 0 1 1 1 1 If everybody starts with the same initial value, 0 0 everybody sticks to that value (minimum) Distributed Computing Group Roger Wattenhofer 131 Distributed Computing Group Roger Wattenhofer 132
Start The failed processor doesn’t Consensus with Crash Failures broadcast its value to all processors The simple algorithm doesn’t work fail 0 0 Each processor: 1 0 4 1. Broadcasts value to all processors 2. Decides on the minimum 3 2 Distributed Computing Group Roger Wattenhofer 133 Distributed Computing Group Roger Wattenhofer 134 Broadcasted values Decide on minimum fail fail 0 0 0,1,2,3,4 0,1,2,3,4 1,2,3,4 1,2,3,4 1 0 4 1 0,1,2,3,4 0,1,2,3,4 1,2,3,4 1,2,3,4 3 0 2 1 Distributed Computing Group Roger Wattenhofer 135 Distributed Computing Group Roger Wattenhofer 136
If an algorithm solves consensus for Finish - No Consensus! f failed processes we say it is 0 fail an f-resilient consensus algorithm 0 1 0 1 Distributed Computing Group Roger Wattenhofer 137 Distributed Computing Group Roger Wattenhofer 138 New validity condition: Example: The input and output of a all non-faulty processes decide on a value 3-resilient consensus algorithm that is available initially. Finish Start 0 1 Finish Start 1 1 1 2 1 1 3 4 1 1 1 1 Distributed Computing Group Roger Wattenhofer 139 Distributed Computing Group Roger Wattenhofer 140
An f-resilient algorithm Example: f=1 failures, f+1=2 rounds needed Round 1: Broadcast my value 0 Start Round 2 to round f+1: 1 4 Broadcast any new received values End of round f+1: Decide on the minimum value received 3 2 Distributed Computing Group Roger Wattenhofer 141 Distributed Computing Group Roger Wattenhofer 142 Example: f=1 failures, f+1 = 2 rounds needed Example: f=1 failures, f+1 = 2 rounds needed Round 1 Broadcast all values to everybody Round 2 Broadcast all new values to everybody 0 fail 0 0,1,2,3,4 0,1,2,3,4 1,2,3,4 0,1,2,3,4 1 1 0 4 4 (new values) 0,1,2,3,4 0,1,2,3,4 1,2,3,4 0,1,2,3,4 3 3 2 2 Distributed Computing Group Roger Wattenhofer 143 Distributed Computing Group Roger Wattenhofer 144
Example: f=1 failures, f+1 = 2 rounds needed Example: f=2 failures, f+1 = 3 rounds needed Finish Decide on minimum value Start Example of execution with 2 failures 0 0,1,2,3,4 0,1,2,3,4 0 1 0 4 0,1,2,3,4 0,1,2,3,4 0 3 0 2 Distributed Computing Group Roger Wattenhofer 145 Distributed Computing Group Roger Wattenhofer 146 Example: f=2 failures, f+1 = 3 rounds needed Example: f=2 failures, f+1 = 3 rounds needed Round 1 Broadcast all values to everybody Round 2 Broadcast new values to everybody 0 0 Failure 1 Failure 1 1,2,3,4 0,1,2,3,4 1,2,3,4 1,2,3,4 1 1 0 4 4 0,1,2,3,4 0,1,2,3,4 1,2,3,4 1,2,3,4 3 3 2 2 Failure 2 Distributed Computing Group Roger Wattenhofer 147 Distributed Computing Group Roger Wattenhofer 148
Example: f=2 failures, f+1 = 3 rounds needed Example: f=2 failures, f+1 = 3 rounds needed Round 3 Broadcast new values to everybody Finish Decide on the minimum value 0 0 Failure 1 Failure 1 0,1,2,3,4 0,1,2,3,4 O,1,2,3,4 O,1,2,3,4 1 0 4 0 0,1,2,3,4 0,1,2,3,4 0,1,2,3,4 0,1,2,3,4 3 3 2 0 Failure 2 Failure 2 Distributed Computing Group Roger Wattenhofer 149 Distributed Computing Group Roger Wattenhofer 150 If there are f failures and f+1 rounds then At the end of the there is a round with no failed process round with no failure: Round 2 3 4 5 6 1 • Every (non faulty) process knows Example: about all the values of all the other 5 failures, participating processes 6 rounds •This knowledge doesn’t change until the end of the algorithm No failure Distributed Computing Group Roger Wattenhofer 151 Distributed Computing Group Roger Wattenhofer 152
Therefore, at the end of the Validity of algorithm: round with no failure: Everybody would decide on the same value when all processes start with the same input value then the consensus is that value However, as we don’t know the exact position of this round, This holds, since the value decided from we have to let the algorithm execute each process is some input value for f+1 rounds Distributed Computing Group Roger Wattenhofer 153 Distributed Computing Group Roger Wattenhofer 154 Proof sketch: A Lower Bound Assume for contradiction that f or less rounds are enough Theorem: Any f-resilient consensus algorithm requires at least f+1 rounds Worst case scenario: There is a process that fails in each round Distributed Computing Group Roger Wattenhofer 155 Distributed Computing Group Roger Wattenhofer 156
Worst case scenario Worst case scenario 2 Round 1 Round 1 p before process p k before process i fails, it sends p a fails, it sends its m value a to only one p a value a to only one i p p k process p process m k p k Distributed Computing Group Roger Wattenhofer 157 Distributed Computing Group Roger Wattenhofer 158 Worst case scenario Worst case scenario Round 1 2 3 f Round 1 2 3 f decide p Process n At the end may decide b of round f on a , and all only one ……… ……… other p process n processes a p p knows n n a may decide about p on another f value a value (b) Distributed Computing Group Roger Wattenhofer 159 Distributed Computing Group Roger Wattenhofer 160
Recommend
More recommend