Ch11 Distributed Agreement. Outline Distributed Agreement Adversaries Byzantine Agreement Impossibility of Consensus Randomized Distributed Agreement.

Slides:



Advertisements
Similar presentations
ON THE COMPLEXITY OF ASYNCHRONOUS GOSSIP Presented by: Tamar Aizikowitz, Spring 2009 C. Georgiou, S. Gilbert, R. Guerraoui, D. R. Kowalski.
Advertisements

Fault Tolerance. Basic System Concept Basic Definitions Failure: deviation of a system from behaviour described in its specification. Error: part of.
Impossibility of Distributed Consensus with One Faulty Process
Byzantine Generals. Outline r Byzantine generals problem.
BASIC BUILDING BLOCKS -Harit Desai. Byzantine Generals Problem If a computer fails, –it behaves in a well defined manner A component always shows a zero.
6.852: Distributed Algorithms Spring, 2008 Class 7.
Distributed Computing 8. Impossibility of consensus Shmuel Zaks ©
Sliding window protocol The sender continues the send action without receiving the acknowledgements of at most w messages (w > 0), w is called the window.
Computer Science 425 Distributed Systems CS 425 / ECE 428 Consensus
The Byzantine Generals Problem Boon Thau Loo CS294-4.
The Byzantine Generals Problem Leslie Lamport, Robert Shostak, Marshall Pease Distributed Algorithms A1 Presented by: Anna Bendersky.
Prepared by Ilya Kolchinsky.  n generals, communicating through messengers  some of the generals (up to m) might be traitors  all loyal generals should.
DISTRIBUTED SYSTEMS II FAULT-TOLERANT AGREEMENT Prof Philippas Tsigas Distributed Computing and Systems Research Group.
Consensus problem Agreement. All processes that decide choose the same value. Termination. All non-faulty processes eventually decide. Validity. The common.
Byzantine Generals Problem: Solution using signed messages.
CPSC 668Set 10: Consensus with Byzantine Failures1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Byzantine Generals Problem Anthony Soo Kaim Ryan Chu Stephen Wu.
CPSC 668Set 9: Fault Tolerant Consensus1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
CPSC 668Set 9: Fault Tolerant Consensus1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
CPSC 668Set 10: Consensus with Byzantine Failures1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
1 Fault-Tolerant Consensus. 2 Failures in Distributed Systems Link failure: A link fails and remains inactive; the network may get partitioned Crash:
Impossibility of Distributed Consensus with One Faulty Process Michael J. Fischer Nancy A. Lynch Michael S. Paterson Presented by: Oren D. Rubin.
Distributed systems Module 2 -Distributed algorithms Teaching unit 1 – Basic techniques Ernesto Damiani University of Bozen Lesson 4 – Consensus and reliable.
CPSC 668Set 11: Asynchronous Consensus1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
CPSC 668Set 11: Asynchronous Consensus1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Distributed Algorithms: Agreement Protocols. Problems of Agreement l A set of processes need to agree on a value (decision), after one or more processes.
Distributed Systems Tutorial 4 – Solving Consensus using Chandra-Toueg’s unreliable failure detector: A general Quorum-Based Approach.
On the Cost of Fault-Tolerant Consensus When There are no Faults Idit Keidar & Sergio Rajsbaum Appears in SIGACT News; MIT Tech. Report.
Consensus and Related Problems Béat Hirsbrunner References G. Coulouris, J. Dollimore and T. Kindberg "Distributed Systems: Concepts and Design", Ed. 4,
Distributed Consensus Reaching agreement is a fundamental problem in distributed computing. Some examples are Leader election / Mutual Exclusion Commit.
Lecture 8-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2010 Indranil Gupta (Indy) September 16, 2010 Lecture 8 The Consensus.
Lecture #12 Distributed Algorithms (I) CS492 Special Topics in Computer Science: Distributed Algorithms and Systems.
Distributed Algorithms – 2g1513 Lecture 9 – by Ali Ghodsi Fault-Tolerance in Distributed Systems.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 11: Asynchronous Consensus 1.
Consensus and Its Impossibility in Asynchronous Systems.
1 Lectures on Parallel and Distributed Algorithms COMP 523: Advanced Algorithmic Techniques Lecturer: Dariusz Kowalski Lectures on Parallel and Distributed.
DISTRIBUTED SYSTEMS II FAULT-TOLERANT AGREEMENT Prof Philippas Tsigas Distributed Computing and Systems Research Group.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 8 Instructor: Haifeng YU.
1 Resilience by Distributed Consensus : Byzantine Generals Problem Adapted from various sources by: T. K. Prasad, Professor Kno.e.sis : Ohio Center of.
CS294, Yelick Consensus revisited, p1 CS Consensus Revisited
CS 425/ECE 428/CSE424 Distributed Systems (Fall 2009) Lecture 9 Consensus I Section Klara Nahrstedt.
Distributed systems Consensus Prof R. Guerraoui Distributed Programming Laboratory.
Sliding window protocol The sender continues the send action without receiving the acknowledgements of at most w messages (w > 0), w is called the window.
Hwajung Lee. Reaching agreement is a fundamental problem in distributed computing. Some examples are Leader election / Mutual Exclusion Commit or Abort.
Chap 15. Agreement. Problem Processes need to agree on a single bit No link failures A process can fail by crashing (no malicious behavior) Messages take.
UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department
Reaching Agreement in the Presence of Faults M. Pease, R. Shotak and L. Lamport Sanjana Patel Dec 3, 2003.
SysRép / 2.5A. SchiperEté The consensus problem.
Chapter 21 Asynchronous Network Computing with Process Failures By Sindhu Karthikeyan.
Alternating Bit Protocol S R ABP is a link layer protocol. Works on FIFO channels only. Guarantees reliable message delivery with a 1-bit sequence number.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
DISTRIBUTED ALGORITHMS Spring 2014 Prof. Jennifer Welch Set 9: Fault Tolerant Consensus 1.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 9 Instructor: Haifeng YU.
1 Fault-Tolerant Consensus. 2 Communication Model Complete graph Synchronous, network.
Distributed Agreement. Agreement Problems High-level goal: Processes in a distributed system reach agreement on a value Numerous problems can be cast.
Randomized Algorithms for Distributed Agreement Problems Peter Robinson.
1 AGREEMENT PROTOCOLS. 2 Introduction Processes/Sites in distributed systems often compete as well as cooperate to achieve a common goal. Mutual Trust/agreement.
reaching agreement in the presence of faults
Synchronizing Processes
Coordination and Agreement
The consensus problem in distributed systems
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Distributed Consensus
Agreement Protocols CS60002: Distributed Systems
Distributed Consensus
Consensus in Synchronous Systems: Byzantine Generals Problem
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Byzantine Generals Problem
Distributed systems Consensus
Presentation transcript:

Ch11 Distributed Agreement

Outline Distributed Agreement Adversaries Byzantine Agreement Impossibility of Consensus Randomized Distributed Agreement Exponential Time Shared Memory Consensus

Outline Distributed Agreement Adversaries Byzantine Agreement Impossibility of Consensus Randomized Distributed Agreement Exponential Time Shared Memory Consensus

Distributed Agreement Adversaries When proving correctness or analyzing an algorithm, it is convenient to assume that: the inputs, the failure times, failure behaviors any system variables are under the control of an adversary who, intuitively, makes as much difficulty for the algorithm as possible Worst case analysis: worst case choices of the adversary

Outline Distributed Agreement Adversaries Byzantine Agreement Impossibility of Consensus Randomized Distributed Agreement Exponential Time Shared Memory Consensus

Distributed Agreement The Agreement or the Consensus Problem: Assume P = {p 1,…,p M } is the set of all the processors in the system Some processors in P are faulty Let F be the set of all faulty processors in P Every processor p in P has a value p.Val The requirement: devise a distributed algorithm that lets each processor p computes a value p.A such that when the execution of this distributed algorithm terminates, the following two conditions hold: 1. (agreement value) For every pair of processors p and q, q.A = p.A 2. The agreement value is a function of the initial values {p.Val} of non-faulty processors

Outline Why Distributed Agreement is an interesting problem? Processor p is the leader Processor p has the right to enter the critical section Processor p has failed

Distributed Agreement Byzantine Agreement: Assumptions A failed processor can send arbitrary messages A non-failed processor always responds to a message within T seconds When a processor receives a message, it can reliably determine the sender of that message

Distributed Agreement Byzantine Agreement: The Byzantine Generals Problem: “ENEMY” the Sultan’s army Byz_A1 Byz_A3 Byz_A2 G2 G1G3 Some byzantine generals are “corrupted” “Non-corrupted” generals knew that they will be victorious only if they attack simultaneously Loyal generals must find a consensus to attack or to retreat Byz_A4 G4

Distributed Agreement Byzantine Agreement: The Byzantine Generals Problem (basic idea) Each general has to make a decision based on the opinions it gets from the other generals All loyal generals must make the same decision If all loyal generals get the same set of opinions for making the decision, then all loyal generals can achieve a consensus using the same procedure to decide How can we ensure that all loyal generals get the same set of opinions ?

Distributed Agreement Byzantine Agreement: The Byzantine Generals Problem (basic idea) To ensure that each loyal general gets the same set of values, it is sufficient that each loyal general uses the same value V j for every other general G j in order to decide The Byzantine Generals Problem is then reduced to agreement by generals on the value sent by a particular general: a commanding general Formally, we must have: 1. If the sender p s is loyal and sends the value V s, the loyal generals will decide that the value sent is V s 2. If the sender p s is treacherous, the loyal general will agree on the same value This problem is known as the interactive consistency problem

Distributed Agreement Byzantine Agreement: The Byzantine Generals Problem (continued) Assuming that each general can reliably broadcast its opinion, the loyal generals can reach an agreement! How and under which conditions?

Distributed Agreement The Byzantine Generals Problem (continued) Question 1 assuming that there is a reliable protocol for broadcast, is it possible to reach an agreement with three generals with one disloyal ? The answer is NO! Why? L1 C L2L1 C L2 disloyal retreat attack retreat attack retreat attack

Distributed Agreement The Byzantine Generals Problem (continued) Question 2 assuming that there is a reliable protocol for broadcast, is it possible to reach an agreement with four generals with one disloyal ? The answer is Yes! Why? Two cases are in order: The commanding general is disloyal The commanding general is loyal

Distributed Agreement The Byzantine Generals Problem (continued) Justification of the answer to Question 2 CL1L2L3 attack retreat By the end of the second round, L1 has 2 attack and 1 retreat L2 has 2 attack and 1 retreat L3 has 2 attack and 1 retreat Disloyal commanding General:C Each Lieutenant obeys the majority Round 1 Round 2

Distributed Agreement The Byzantine Generals Problem (continued) Justification of the answer to Question 2 CL1L2L3 attack retreat By the end of the second round, L1 has 2 attack and 1 retreat L2 has 2 attack and 1 retreat L3 has 3 attack and 1 retreat Disloyal Lieutenant: L3 Each Lieutenant obeys the majority: Each Loyal General decides “attack” Round 1 Round 2

Distributed Agreement The Byzantine Generals Problem (continued) Theorem: Assuming a synchronous system with M processors,of which up to t can be faulty, the loyal generals can reach a consensus only if M  3t+1 The algorithm to solve the Byzantine Generals Problem is parameterized by k the maximum number of disloyal generals This algorithm is BG(k)

Distributed Agreement The Byzantine Generals Problem (continued) The BG(k) idea: The algorithm works in rounds of messages exchange. C L1L2L M-1 L(C)=the set of Lieutenants for C; size of L(C) = M-1 Round 1 If no message is sent to a Lieutenant that Lieutenant takes “retreat” as the default value L(C)

Distributed Agreement The Byzantine Generals Problem (continued) The BG(k) idea: p1p1 L1L2L M-2 L(p 1 :C)=the set of Lieutenants for p 1 with respect to C’s opinion; size of L(p 1 :C) = M-2 Round 2 Every processor p 1 in L(C) acts as the commanding General p 1 sends M-2 messages p 1 receives M-2 messages p 1.v(2) := majority(V) where V = {p 1.v(1)}  {p 1.R q (2) : q in L(p 1 :C)} L(p 1 )

Distributed Agreement The Byzantine Generals Problem (continued) The BG(k) idea: p2p2 L1L2L M-3 L(p 2 :p 1 )=the set of Lieutenants for p 2 with respect to p1’s opinion; size of L(p 2 :p 1 ) = M-3 Round 3 Every processor p 2 in L(p 1 ), for each p 1 in L(C), acts as the commanding General p 2 sends M-3 messages p 2 receives M-3 messages p 2.vr(3,p 1 ) := majority(V) where V = {p 2.vr(2,p 1 )}  {p 2.R q (3,p 1 ) : q in L(p 2 :p 1 )} L(p 2 )

Distributed Agreement The Byzantine Generals Problem (continued) The BG(k) idea: p3p3 L1L2L M-3 L(p 3 :p 2 )=the set of Lieutenants for p 3 with respect to p 2 ’s opinion on...; size of L(p 3 ) = M-4 Round 4 Every processor p 3 in L(p 2 ), for each p 2 in L(p 1 ), p 1 in L(C), acts as the commanding General p 3 sends M-4 messages p 3 receives M-4 messages p 3.vr(4,p 2 ) := majority(V) where V = {p 3.vr(3,p 2 )}  {p 2.R q (4,p 2 ) : q in L(p 3 :p 2 )} L(p 3 )

Distributed Agreement The Byzantine Generals Problem (continued) The BG(k) idea: p i-1 L1L2L M-i L(p i-1 :p i-2 )=the set of Lieutenants for p i-1 with respect to p i-2 ’s opinion on...; size of L(p i-1 :p i-2 ) = M-i Round i Every processor p i-1 in L(p i-2 ), for each p i-2 in L(p i-3 ), …, p 2 in L(p 1 ), p 1 in L(C), acts as the commanding General p i-1 sends M-i messages p i-1 receives M-i messages p i-1.vr(i,p i-2 ) := majority(V) where V = {p i-1.vr(i-1,p i-2 )}  {p i-1.R q (i,p i-2 ) : q in L(p i-1 :p i-2 )} L(p i-1 )

Distributed Agreement The Byzantine Generals Problem (continued) The BG(k) idea: pkpk L1L2L M-k-1 L(p k :p k-1 )=the set of Lieutenants for p k with respect to p k-1 ’s opinion on...; size of L(p k ) = M-k-1 Round k+1, BG(0) Every processor p k in L(p k-1 ), for each p k-1 in L(p k-2 ), …, p 2 in L(p 1 ), p 1 in L(C), acts as the commanding General P k sends M-k-1 messages p k receives M-k-1 messages p k.vr(k+1,p k-1 ) := majority(V) where V = {p k.vr(k,p k-1 )}  {p k.R q (k+1,p k-1 ) : q in L(p k )} L(p k ) For each p k-1, p k decides p k.vr(k+1,p k-1 )

Distributed Agreement The Byzantine Generals Problem (continued) The BG(k) idea: pkpk L1L2L M-k-1 Round k+1 L(p k ) p k decides p k.vr(k+1,p k-1 ) Processor p k decides using (1+M-k-1) opinions So, if M=3k+1, then we have that p k decides using 2k+1 opinions Since at most k processors can be faulty, it follows that all non faulty processors make the same decision

Distributed Agreement The Byzantine Generals Problem (continued) The BG(k): BG(0): 1. The commanding sends its value to all the other n-1 processors 2. Each processor uses the value it receives from the commanding or uses the default value

Distributed Agreement The Byzantine Generals Problem (continued) The BG(k): BG(k), k>0: 1. The commanding sends its value to all the other n-1 processors 2. Let v p be the value the processor p receives from the commanding general, or the default value if no value is received. Processor p acts as the commanding in BG(k-1) to send the value v p to each of the other M-2 processors. 3. For each processor p, let v q be the value received from processor q (q  p). Processor p uses the majority({v}  {v q : q in L(C)}) where v is the value processor p received from the commanding general

Distributed Agreement The Byzantine Generals Problem (continued) The BG(k): number of messages sent Following the presentation gave above, one can see that the number of messages sent is proportional to (M-1)(M-2)(M-3)…(M-k-1) Since k can be (M-1)/3, it follows that the number of messages is O(M k )

Outline Distributed Agreement Adversaries Byzantine Agreement Impossibility of Consensus Randomized Distributed Agreement Exponential Time Shared Memory Consensus

Distributed Agreement The Byzantine Generals Problem (continued) Impossibility result If the system is asynchronous (no bound on the relative speeds of processors or the communication delays), then it can be shown (Fisher, Lynch, Paterson 1985) that agreement is impossible if even one processor can fail, and even if the failure is a crash failure

Outline Distributed Agreement Adversaries Byzantine Agreement Impossibility of Consensus Randomized Distributed Agreement Exponential Time Shared Memory Consensus

Distributed Agreement The Randomized Distributed Agreement Randomization: processors can flip coin Assumptions: The system consists of N processors, of which up to t can be faulty Processors communicate by using shared registers The shared registers are non-faulty The accesses to the shared register are sequentially consistent Atomic reads and writes of the contents of the registers The system is asynchronous

Outline Distributed Agreement Adversaries Byzantine Agreement Impossibility of Consensus Randomized Distributed Agreement Exponential Time Shared Memory Consensus

Distributed Agreement The Randomized Distributed Agreement The Exponential Time Shared Memory Consensus: The Naïve algorithm: Assume : the system is synchronous each processor p has a initial value V p to prefer The idea (algorithm for processor p): while I have not yet decided do 1. Read the set {V i } of values of every other processors 2. If for all i, V i = V p then decide V p else V p := coin_flip() end

Distributed Agreement The Randomized Distributed Agreement The Exponential Time Shared Memory Consensus: Transformation of the Naïve synchronous algorithm into an asynchronous algorithm Idea 1: “simulate” the synchronous algorithm: add a round variable at each processor The naïve algorithm becomes

Distributed Agreement The Randomized Distributed Agreement The Exponential Time Shared Memory Consensus: Idea 1 continue (algorithm for processor p): while I have not yet decided do 1. Read the set {V i } of values of every other processors 2. If for all i, V i = V p and p.round = I.round then decide V p else V p := coin_flip(); p.round := pround+1 end Problem : some processors can fail; a fail processor may not increment its round variable when it executed

Distributed Agreement The Randomized Distributed Agreement The Exponential Time Shared Memory Consensus: Idea 2: At any moment, the set of processors can be regarded as consisting of FP: the set of the largest round value; LP: the other processors If (  p,q in FP: V p = V q ) and eventually (  s in LP: V s = V q, q in FP ) then one can decides on V q, q in FP How can we achieve the eventually part ?

Distributed Agreement The Randomized Distributed Agreement The Exponential Time Shared Memory Consensus: Idea 2(continued): How can we achieve the eventually part ? Intuitively, the idea is to make the slower processors prefer to accept the value of faster processors.

Distributed Agreement The Randomized Distributed Agreement The Exponential Time Shared Memory Consensus: The algorithm :Variable used V[1..M] shared array of records, one per each processor V[i].value : the preferred decision of processor i; V[i].round : execution round of processor i; Local_V[1..M] local copy of V[1..M] Leaders : the processors that have the largest round values in round Local_V

Distributed Agreement The Randomized Distributed Agreement The Exponential Time Shared Memory Consensus: The algorithm :Functions used leader_set(Local_V) : returns the set of leaders Flip() : randomly returns either 0 or 1.

Distributed Agreement The Randomized Distributed Agreement The Exponential Time Shared Memory Consensus: The algorithm :Initially V[i].value := NIL; V[i].round :=0; /* not necessary */ Local_V[i].value := NIL; Local_V[i].round := 0; leaders := empty

Distributed Agreement The Randomized Distributed Agreement The Exponential Time Shared Memory Consensus: The algorithm : SM_Consensus(self, preference) (V[self].value, V[self].round) := (preference,1) while I have not made a decision do read V into Local_V; leaders := leader_set(Local_V); if (self  leaders) and (  i : Local_V[i].value  Local_V[self] : Local_V[i].round < Local_V[self].round -1) then decide(V[self].value) elseif (  i,j in leaders: Local_V[i].value = Local_V[j].value) then (V[self].value, V[self].round) := (V[i].value, V[i].round) for a i in leaders elseif V[self].value  NIL then (V[self].value, V[self].round):=(NIL, V[self].round) else (V[self].value, V[self].round) := (Flip(), round+1)

Distributed Agreement The Randomized Distributed Agreement The Exponential Time Shared Memory Consensus: The probability that all leaders choose the same value: O(2 -N ) The expected number of rounds: O(2 N )