Wait-Free Consensus CPSC 661 Fall 2003 Supervised by: Lisa Higham Presented by: Wei Wei Zheng Nuha Kamaluddeen.

Slides:



Advertisements
Similar presentations
1 © R. Guerraoui Universal constructions R. Guerraoui Distributed Programming Laboratory.
Advertisements

Impossibility of Distributed Consensus with One Faulty Process
1 © R. Guerraoui The Limitations of Registers R. Guerraoui Distributed Programming Laboratory.
Linked Lists. 2 Merge Sorted Lists Write an algorithm that merges two sorted linked lists The function should return a pointer to a single combined list.
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
Wait-Free Reference Counting and Memory Management Håkan Sundell, Ph.D.
Universality of Consensus The Art of Multiprocessor Programming Spring 2007.
Prof. Jennifer Welch 1. FIFO Queue Example 2  Sequential specification of a FIFO queue:  operation with invocation enq(x) and response ack  operation.
CPSC 668Set 18: Wait-Free Simulations Beyond Registers1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
Distributed Computing 8. Impossibility of consensus Shmuel Zaks ©
Announcements. Midterm Open book, open note, closed neighbor No other external sources No portable electronic devices other than medically necessary medical.
Distributed Computing 8. Impossibility of consensus Shmuel Zaks ©
What is ’’hard’’ in distributed computing? R. Guerraoui EPFL/MIT joint work with. Delporte and H. Fauconnier (Univ of Paris)
Détecteurs de défaillances, mémoire partagée/passages de messages Hugues Fauconnier LIAFA, Université Denis Diderot.
CS510 Advanced OS Seminar Class 10 A Methodology for Implementing Highly Concurrent Data Objects by Maurice Herlihy.
What Can Be Implemented Anonymously ? Paper by Rachid Guerraui and Eric Ruppert Presentation by Amir Anter 1.
Impossibility of Distributed Consensus with One Faulty Process Michael J. Fischer Nancy A. Lynch Michael S. Paterson Presented by: Oren D. Rubin.
Wait-Free Consensus with Infinite Arrivals James Aspnes Gauri Shah Jatin Shah Yale University STOC 2002.
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 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.
The Design and Analysis of Algorithms
Art of Multiprocessor Programming 1 Universality of Consensus Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit.
1 © R. Guerraoui Seth Gilbert Professor: Rachid Guerraoui Assistants: M. Kapalka and A. Dragojevic Distributed Programming Laboratory.
1 Lock-Free Linked Lists Using Compare-and-Swap by John Valois Speaker’s Name: Talk Title: Larry Bush.
Distributed Consensus Reaching agreement is a fundamental problem in distributed computing. Some examples are Leader election / Mutual Exclusion Commit.
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.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 18: Wait-Free Simulations Beyond Registers 1.
Consensus and Its Impossibility in Asynchronous Systems.
1 Chapter 9 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch Set 11: Asynchronous Consensus 1.
1 Chapter 10 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
1 Consensus Hierarchy Part 1. 2 Consensus in Shared Memory Consider processors in shared memory: which try to solve the consensus problem.
Common2 extended to stacks and unbound concurrency By:Yehuda Afek Eli Gafni Adam Morrison May 2007 Presentor: Dima Liahovitsky 1.
CS294, Yelick Consensus revisited, p1 CS Consensus Revisited
Wait-Free Multi-Word Compare- And-Swap using Greedy Helping and Grabbing Håkan Sundell PDPTA 2009.
1 Consensus Hierarchy Part 2. 2 FIFO (Queue) FIFO Object headtail.
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.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
SysRép / 2.5A. SchiperEté The consensus problem.
Agreement in Distributed Systems n definition of agreement problems n impossibility of consensus with a single crash n solvable problems u consensus with.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Distributed Algorithms (22903) Lecturer: Danny Hendler The wait-free hierarchy and the universality of consensus This presentation is based on the book.
Fault-Tolerant Broadcast Terminology: broadcast(m) a process broadcasts a message to the others deliver(m) a process delivers a message to itself 1.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples.
Concurrent Computing Seminar Introductory Lecture Instructor: Danny Hendler
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
1 © R. Guerraoui Set-Agreement (Generalizing Consensus) R. Guerraoui.
Wait-Free Consensus CPSC 661 Fall 2003 Supervised by: Lisa Higham
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Algebraic Topology and Distributed Computing part two
Analysis and design of algorithm
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Alternating Bit Protocol
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Mutable Data (define mylist (list 1 2 3)) (bind ((new (list 4)))
Deterministic Objects: Life Beyond Consensus
Yehuda Afek, Eli Daian, Eli Gafni, Giuliano Losa
Nir Shavit Multiprocessor Synchronization Spring 2003
Presentation transcript:

Wait-Free Consensus CPSC 661 Fall 2003 Supervised by: Lisa Higham Presented by: Wei Wei Zheng Nuha Kamaluddeen

Outline ● Deterministic Wait-Free – Impossibility – Universality ● Randomized Wait-Free – Robust weak shared coin ● Multi Consensus Game – Use randomizes solution – Recycling counter ● Conclusion

Deterministic Wait-Free ● Wait-Free Implementation is the one which guarantees that any process can complete any operation in a finite number of steps of that process ● Given two concurrent objects X and Y ● Q: Does there exist a wait-free implementation of X by Y? ● FLP and Herlihy ’ s papers answered this question

Consensus Problem ● A system of n processes that communicate through m shared objects – Each process starts with an input value from domain D – Communicates with one another by applying operations to the shared objects – Eventually agree on a common input value and halt

Consensus Problem ● Requirements: – Agreement: all processes decide on one common value if they do decide – Validity: the common decision value is the input of some process – Wait-Freedom: each process decides after a finite number of steps

Consensus Number ● Consensus Number for an object X is the largest n for which X solves consensus problem for n processes ● If no largest n exists, then the consensus number is said to be infinite

FLP vs. Herlihy ● FLP answered the question for a specific object, i.e., R/W register. ● FLP provided a stronger result for this special case: no implementation of consensus problem of n>=2 processes using R/W registers, even for at most 1 stopping faulty process, and even for binary inputs ● Herlihy gave a more generalized answer: Impossibility and Universality Hierarchy for wait-free implementation of any type of object

Impossibility and Universality Hierarchy Memory-to-memory move and swap, augmented queue, compare&swap, fetch&cons, sticky byte Infinity n-register assignment 2n - 2 Test&set, swap, fetch&add, queue, stack 2 R/W registers 1 Consensus Number … … Object

Impossibility and Universality ● Impossibility – It is impossible to construct a wait-free implementation of an object with consensus number n from any number of objects with a strictly smaller consensus number

Impossibility and Universality ● Universality: an object is universal in a system of n (or fewer) processes if it can implement any object of consensus number n ● The n-consensus object is universal in a system of n (or fewer) processes

FIFO Queue ● Supports two operations: – enq(queue, val): appends a new element to the end of queue with the value val – deq(queue): reads and removes the first element of queue

FIFO Queue has n >= 2 P: decide(input: value) returns(value) prefer[P] := input if deq(A) = 0 then return prefer[P] else return prefer[Q] endif end decide Prefer ┴ ┴ A 1 0 Initially

FIFO Queue has n = 2 ● Impossible for n > 2 ● Proof: – Initially: ● Three processes P, Q and R ● Each about to make decision step ● P's operation x-valent ● Q's operation y-valent – Cover all possible combinations of operations

FIFO Queue has n = 2 (cont.) ● Case 1: P and Q deq(A) 1 v 2 C: bi-valent T' T S' S S' ~ T' R Q deq(A) P deq(A) Q deq(A) P deq(A) 3 A 1 v 2 3 A x-valenty-valent

FIFO Queue has n = 2 (cont.) ● Case 2: P enq(A, p) and Q deq(A) Non-Empty Queue C: bi-valent T' S' S Q deq(A) P enq(A, p) Q deq(A) P enq(A, p) T S' ~ T' R 1 p 2 3 A 1 p 2 3 A x-valent y-valent

FIFO Queue has n = 2 (cont.) ● Case 2: P enq(A, p) and Q deq(A) Empty Queue C bi-valent S P enq(A, p) T S ~ T’ R p A p A T' Q deq(A) P enq(A, p) x-valent y-valent

FIFO Queue has n = 2 (cont.) ● Case 3: P and Q enq() 1 2 Q’s P’s p q 1 2 Q’s P’s q p C: bi-valent T'S' S Q enq(A, q) P enq(A, p) Q enq(A, q)P enq(A, p) T S’’’ ~ T’’’ R x-valenty-valent P-only until it deq p Q-only until it deq q S’’’ S’’ T’’’ T’’ P-only until it deq q Q-only until it deq p AA

Augmented Queue ● Add one more operation to the FIFO queue: – Peek(): returns but does not remove the first item in the queue ● See how the queue becomes POWERFULL

Augmented Queue has n = infinity decide(input: value) enq(A, input) Return peek(q) end decide

Universality ● An object is UNIVERSAL if it implements any other object ● Example: Object R implements object A Front-EndObject R PiPi Object A Invoke Respond Invoke

Universality Algorithm: Idea Input: invoke Output: respond Consensus Object Input: (var, pref_val) Output: decides val to var Universal Algorithm invoke respond

Universality Algorithm: Idea ● A linked list to represent the object ● Each cell represents an invocation ● Sequence of cells represent the sequence of applied operations ● Sequence: unbounded integer size

Universality Algorithm: Idea ● When a process P makes an invocation 1. P creates a node with sequence = 0 and fill in its invocation 2. P tries to attach its node to the linked list 3. Attaching the node means performing its invocation 4. Once the node is attached, it will have a sequence and all of its entries will be filled

Universality Algorithm: Idea ● Apply (invoke, state, state, result) – May be non-deterministic – Apply (invoke, state) represents (new_state, result)

Universality Algorithm: Node Seq: integer Inv: INVOKE Before: * cell After: * cell New state result New: consensus object After: consensus object

Universality Algorithm: Linked-List Seq = 1 State: S1 Seq = 2 Inv2 State: S2 Res: R2 Seq = 3 State: S3 Seq = 4 Inv4 State: S4 Res: R4 Inv3 Res: R3 Anchor before after Example: Apply(Inv2, S1)  (S2, R2) Similarly: Apply(Inv3, S2)  (S3, R3) …… etc.

Universality Algorithm P0 Anchor P4 P3P2P1 Announce Head Seq = 1 State: S1 Initially decide(var, val) Assigns a val to var before after NULL

Universality Algorithm P0 Anchor P4 P3P2P1 Announce Head Seq = 1 State: S1 before after NULL 0 Inv decide(var, val) Assigns a val to var 3 3 3

Universality Algorithm P0 Anchor P4 P3P2P1 Announce Head Seq = 1 State: S1 before after NULL decide(var, val) Assigns a val to var before (S1, Inv) (S2, R2) 0 Inv after NULL State: S2 Res: R2 Seq = 2

Universality Algorithm P0 Anchor P4 P3P2P1 Announce Head Seq = 1 State: S1 before after NULL Decide(var, val) Assignes a val to var Seq = 2 Inv State: S2 Res: R2 before after NULL

Universality Algorithm P0 Anchor P4 P3P2P1 Announce Head Seq = 1 State: S1 before after NULL decide(var, val) Assigns a val to var Seq = 2 Inv State: S2 Res: R2 before 0 Inv3 0 Inv1 0 Inv after NULL S2, Inv1 S3, R3

Universality Algorithm P0 Anchor P4 P3P2P1 Announce Head Seq = 1 State: S1 before after NULL decide(var, val) Assigns a val to var Seq = 2 Inv State: S2 Res: R2 before 0 Inv3 0 Inv4 Seq = 3 Inv1 State: S3 Res: R3 NULL after before

Universality Algorithm: Why Help ● Beyond being nice ● With help  wait-free ● Without help  non-blocking

Universal Algorithm universal(what: INVOC) returns(RESULT) my_cell: cell := [seq:0, inv: what new: create(consensus_object) before: create(consensus_object) after: null] announce[P] := my_cell for each process Q do head[P] := max(head[P], head[Q]) while (announce[P].seq = 0]) c: *cell := head[P] help: *cell := announce[(c.seq mod n) + 1] if help.seq = 0 then prefer := help else prefer := announce[P] d := decide(c.after, prefer) decide(d.new, apply(d.inv, c.new.state)) d.before := c d.seq := c.seq + 1 head[P] := d head[P] := announce[P] return (announce[P].new.result) end universal create my_cell (use INV = INVOKE) Announce my_cell While my_cell is not attached to the linked-list Consult head to point to some process: help, and see if it needs help if yes prefer (help) else prefer (my_cell) send my prefer to decide send my apply preference to decide fill fields of the attached cell return my new RESULT

Impossibility/Universality: Importance ● Research done before was focusing on constructing complex objects from atomic R/W registers ● Atomic registers have few applications in constructing wait-free implementation of more complex data structure – Examples: ● Sets, queues, stacks, priority queues, lists ● Classical synchronization primitives: test&set, compare&swap, fetch&add ● Simple memory-to-memory operation: move and swap

Research Turning Points ● Pay attention to other primitives: stronger than R/W registers ● Give up wait-free ● Use randomized wait-free

Conclusion ● Deterministic Wait-Free Consensus – Impossibility and universality Hierarchy – Universality algorithm

References  M. Herlihy. Wait-Free Synchronization. ACM Transactions on Programming Languages and Systems, 13(1): January 1991.

Questions?