Consensus in Distributed Systems Course: Distributed Computing Faculty: Dr. Rajendra Prasath Spring 2019
About this topic This course covers various concepts in Consensus in Distributed Systems. We will also focus on the essential aspects of consensus protocols in distributed systems. 2 Rajendra, IIIT Sri City
RECAP What did you learn so far? What did you learn so far? è Challenges in Message Passing systems è Distributed Sorting è Space-Time Diagram è Partial Ordering / Causal Ordering è Concurrent Events è Local Clocks and Vector Clocks è Distributed Snapshots è Termination Detection è Topology Abstraction and Overlays è Leader Election Problem in Rings è Message Ordering / Group Communications è Distributed Mutual Exclusion Algorithms 3 Rajendra, IIIT Sri City
Topics to focus on opics to focus on … è Distributed Mutual Exclusion è Deadlock Detection è Check Pointing and Rollback Recovery è Self-Stabilization Self-Study: è Distributed Consensus è Peer – to – peer computing and Overlays è Authentication in Distributed Systems 4 Rajendra, IIIT Sri City
Definition Definition A system is self-stabilizing if and only if: è Convergence: Starting from any state, it is guaranteed that the system will eventually reach a correct state è Closure: Given that the system is in a correct state, it is guaranteed to stay in a correct state, provided that no fault happens è A system is said to be randomized self-stabilizing if and only if it is self-stabilizing and the expected number of rounds needed to reach a correct state is bounded by some constant k 5 Rajendra, IIIT Sri City
Dijkstr Dijkstra's a's Algorithm Algorithm è For any machine: è S – State of its own è L – State of the left neighbor and è R - State of the right neighbor on the ring è The exceptional machine: è If L = S then S = (S+1) mod K; è All other machines: è If L = S then S = L; 6 Rajendra, IIIT Sri City
Dijkstr Dijkstra's a's Algorithm Algorithm A Privilege of a machine is able to change its current state on è a Boolean predicate that consists of its current state and the states of its neighbors When a machine has a privilege, it is able to change its è current state, which is referred to as a move. Second solution (K = 3) The bottom machine, machine 0: è If (S+1) mod 3 = R then S = (S − 1) mod 3; è The top machine, machine n − 1: è If L = R and (L+1) mod 3 = S then S = (L+1) mod 3; è The other machines: è If (S+1) mod 3 = L then S = L; è 7 Rajendra, IIIT Sri City
Consensus in Distributed Systems Let us explore distributed consensus algorithms in Distributed Systems 8 Rajendra, IIIT Sri City
Distributed Consensus Distributed Consensus Reaching agr Reaching agreement eement is a fundamental pr is a fundamental problem in oblem in distributed computing distributed computing Examples: Examples: è Leader election / Mutual Exclusion è Commit or Abort in distributed transactions è Reaching agreement about which process has failed è Clock phase synchronization è Air traffic control system: all aircrafts must have the same view 9 Rajendra, IIIT Sri City
Problem oblem Specification Specification output input v p0 u0 v u1 p1 u2 p2 v p3 u3 v Each process p i has an input value u i è These processes exchanges their inputs, so that the è outputs of all non-faulty processes become identical, even if one or more processes fail at any time Output v must be equal to the value of at least one è process 10 Rajendra, IIIT Sri City
Problem Specification oblem Specification Termination ermination Every non-faulty process must eventually decide. Agr Agreement eement The final decision of every non-faulty process must be identical. Validity alidity If every non-faulty process begins with the same initial value v, then their final decision must be v 11 Rajendra, IIIT Sri City
Observation Observation • If there is no failure, then reaching consensus is trivial. All-to-all broadcast followed by a applying a choice function … • Consensus in presence of failures can however be complex. The complexity depends on the system model and the type of failures 12 Rajendra, IIIT Sri City
Asynchr Asynchronous Consensus onous Consensus Seven members of a busy household decided to to hir hire e a a cook cook, since they do not have time to prepare their own food Each member separ separately ately interviewed interviewed every applicant for the cook ’ s position. Depending on how it went, each member voted "yes" (means "yes" (means “ hir hire ” ) or "no" (means "no" (means “ don't hir don't hire ” ). These members will now have to communicate with one another to reach each a a uniform uniform final final decision decision about whether the applicant will be hired The process will be repeated with the next applicant, until someone is hired. Consider various modes of communication like shared memory or message passing Also assume that one process may crash at any time 13 Rajendra, IIIT Sri City
Asynchr Asynchronous Consensus onous Consensus Theor heorem em: In a pur purely asynchr ely asynchronous onous distributed system, the consensus problem is impossible impossible to solve if even a single pr single process cr ocess crashes ashes Fischer ischer, L Lynch, ynch, P Pat atterson terson (commonly known as FLP 85). Received the most influential paper award of ACM PODC in 2001 14 Rajendra, IIIT Sri City
Proof oof Bivalent and Univalent states Bivalent and Univalent states A decision state is bivalent bivalent, if starting from that state, there exist two distinct executions leading to two distinct decision values 0 or 1 1 Otherwise it is univalent univalent An univalent univalent state may be either 0-valent 0-valent or 1- 1- valent. valent. 15 Rajendra, IIIT Sri City
Proof oof Lemma: emma: Every consensus protocol must have a bivalent initial state bivalent initial state. Proof oof by by contr contradiction adiction: Suppose not. Then consider the following input patterns: n-1 2 1 0 s[0] 0 0 0 0 0 0 …0 0 0 {0-valent) There must be a j: 0 0 0 0 0 0 …0 0 1 s[j] is 0-valent 0 0 0 0 0 0 …0 1 1 s[j+1] is 1-valent … … … … s[n] 1 1 1 1 1 1 …1 1 1 {1-valent} What if process j crashes at the first step? 16 Rajendra, IIIT Sri City
Consensus in Synchr Consensus in Synchronous Systems: onous Systems: Byzantine Gener Byzantine Generals P als Problem oblem - Describes and solves the consensus problem on the synchronous Communication model - Processor speeds have lower bounds and communication delays have upper bounds. - The network is completely connected - Processes undergo byzantine failures, the worst possible kind of failure 17 Rajendra, IIIT Sri City
Byzantine Gener Byzantine Generals P als Problem oblem • n generals {0, 1, 2, . . . , n-1} decide about whether to "attack" or to "retreat" during a particular phase of a war. The goal is to agr agree ee upon upon the the same plan of same plan of action action • Some generals may be "tr "traitors" aitors" and therefore send either no input, or send conflicting inputs to prevent the "loyal" "loyal" gener generals als fr from om reaching eaching an an agr agreement eement • Devise a strategy, by which every loyal general eventually agrees upon the same plan, regardless of the action of the traitors 18 Rajendra, IIIT Sri City
Byzantine Gener Byzantine Generals als Attack=1 Attack = 1 {1, 1, 0, 1 } {1, 1, 0, 0 } 0 1 The tr he traitor aitor may send may send out out conflicting conflicting traitor inputs inputs {1, 1, 0, 0 } {1, 1, 0, 0 } 2 3 Retreat = 0 Retreat = 0 Every general will broadcast his judgment to everyone else. These are inputs to the consensus protocol. 19 Rajendra, IIIT Sri City
Byzantine Gener Byzantine Generals als We need to devise a protocol so that every peer (call it a lieutenant lieutenant) receives eceives the same value the same value from any given general (call it a commander commander) Clearly, the lieutenants will have to use secondary secondary information information Note that the roles of the commander and the lieutenants will rotate among the generals 20 Rajendra, IIIT Sri City
Inter Interactive consistency specifications active consistency specifications commander commander IC1: IC1: Every loyal lieutenant receives the same same or order der from the commander IC2: IC2: If the commander is loyal, then every loyal lieutenant receives the lieutenants order that the commander sends 21 Rajendra, IIIT Sri City
The Communication Model he Communication Model Or Oral Messages (OM) al Messages (OM) 1. Messages are not corrupted during the transit 2. Messages can be lost, but the absence of message can be detected 3. When a message is received (or its absence is detected), the receiver knows the identity of the sender (or the defaulter) OM(m) OM(m) represents an interactive consistency protocol in presence of at most m traitors. 22 Rajendra, IIIT Sri City
Recommend
More recommend