1 / 54

Consensus Hierarchy Part 2

Consensus Hierarchy Part 2. FIFO (Queue). tail. head. FIFO Object. Special case: empty queue. tail. head. Theorem:. A FIFO object has consensus number 2. Proof:. We can solve wait-free consensus using FIFO (and read/write) objects for 2 processes.

genica
Download Presentation

Consensus Hierarchy Part 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Consensus HierarchyPart 2

  2. FIFO (Queue) tail head FIFO Object

  3. Special case: empty queue tail head

  4. Theorem: A FIFO object has consensus number 2 Proof: • We can solve wait-free consensus • using FIFO (and read/write) objects • for 2 processes 2. We cannot solve wait-free consensus using FIFO (and read/write) variables for 3 or more processes

  5. Proof-Part 1 A Wait-Free Consensus algorithm for 2 processors using a FIFO object (and read/write objects) tail head Initially:

  6. Shared Memory Queue tail head Other Variables

  7. Local variables :initial values for the consensus problem :resulting values for the consensus problem

  8. Shared Memory Queue tail head Other Variables Initial values

  9. Code for processor If then else //am I the first? //yes, choose my value //no, choose the other processor’s value Note: the algorithm uses a FIFO object and read/write objects

  10. Example execution: Shared Memory Queue tail head

  11. Suppose that accesses first the queue Shared Memory decides on its own value Queue tail head

  12. Suppose that accesses second Shared Memory Queue Consensus Reached tail head decides on the other processor’s value

  13. Proof-Part 2 We will prove: There is no wait-free consensus algorithm using only FIFO (and read-write) objects for Consider three processors (the same proof generalizes to more)

  14. There is a bivalent initial configuration (we proved it before) We will show that every bivalent configuration has a processor which is not critical Therefore, we can construct an infinite execution with bivalent configurations where consensus is never reached

  15. Assume for contradiction that all processors are critical univalent bivalent Possible executions univalent univalent

  16. It cannot be that all have the same valence Contradiction valent bivalent valent valent valent

  17. There must exist two processors with different valences bivalent univalent

  18. Shared Memory Queue Queue Queue Read/Write Objects

  19. Shared Memory Case: the processors access different objects Queue Queue bivalent Queue Read/Write Objects univalent Note: if an object was read/write the analysis is the similar

  20. Two possible executions op Q2 op Q1 bivalent op Q2 op Q1 Impossible since univalent

  21. Shared Memory Case: the processors access same object Queue Queue bivalent Queue Read/Write Objects univalent Note: if the object was read/write the analysis is the same as in the case with read/write objects

  22. Subcase: deq/deq deq(Q) bivalent deq(Q) univalent

  23. Queue Q before operations: deq(Q) deq(Q) bivalent deq(Q) deq(Q) Impossible since univalent

  24. Subcase: deq/enq deq(Q) bivalent enq(Q,x) univalent

  25. Suppose Q was not empty enq(Q,x) deq(Q) bivalent enq(Q,x) deq(Q) Impossible since univalent

  26. Suppose Q was empty enq(Q,x) deq(Q) bivalent enq(Q,x) Impossible since univalent

  27. Subcase: enq/enq enq(Q,a) bivalent enq(Q,b) univalent

  28. Suppose Q was not empty enq(Q,b) enq(Q,a) bivalent enq(Q,b) enq(Q,a) univalent

  29. enq(Q,b) Dequeue a Dequeue b enq(Q,a) bivalent enq(Q,b) enq(Q,a) Dequeue b Dequeue a univalent Impossible since

  30. Explanation decides enq(Q,b) enq(Q,a) Suppose does not dequeue a bivalent A decision will be reached since the consensus algorithm is wait-free

  31. decides enq(Q,b) enq(Q,a) contradiction bivalent decides enq(Q,b) enq(Q,a) The same value will be decided by , since sees the same shared memory values in both executions

  32. In all cases we obtained contradiction; Therefore, there exists a processor which is not critical univalent bivalent univalent bivalent (not critical) univalent

  33. Therefore, we can construct an execution bivalent bivalent bivalent Never ends Initial configuration Consensus can never be reached End of Theorem Proof

  34. Compare&Swap Shared Memory Compare&Swap(X,A,B) { Temp X; If X==A then X B; Return Temp; } X

  35. Theorem: The consensus number of the Compare&Swap object is Proof: Given processes, for any , we can solve wait-free consensus using a Compare&Swap object (and read/write objects)

  36. A Wait-Free Consensus algorithm for n processors using a compare&swap object Local Memory Shared Memory First Initial value (compare&swap object) Final value

  37. Code for processor If then else //am I the first? //yes, choose my value //no, choose the value of the first process which is stored in First Note: the algorithm uses a compare&swap and read/write objects

  38. Example execution: Local Memory Shared Memory First

  39. Suppose executes first Local Memory Shared Memory First Compare&Swap(First, ,0)

  40. Suppose executes first Local Memory Shared Memory First Realizes it is first, decides on its own value

  41. Suppose executes second Local Memory Shared Memory Compare&Swap(First, ,1) First

  42. Suppose executes second Local Memory Shared Memory First Realizes is not first, decides on value of First

  43. Similarly for Consensus has been reached Local Memory Shared Memory First Realizes is not first, decides on value of First

  44. The algorithm is wait-free, since after the completion of the Compare&Swap operation, every processor decides (without considering what the other processors do)

  45. Consensus HierarchyPart 3

  46. Consensus Number Consensus Number of an object type: The maximum number of processes for which the object can be used to solve the wait-free consensus problem (together with read/write objects)

  47. Object Type Consensus Number 1 Read/Write 2 FIFO Compare&Swap (infinity)

  48. Simulation: Object Type B Object Type A Object Type A Read/Write Object Object of type A simulates object of Type B

  49. Theorem: Objects of type A with consensus number cannot simulate another object of type B with consensus number Proof: Since otherwise, object A would have consensus number End of Proof

  50. Universality Universal object: can simulate in a wait-free manner any other arbitrary object

More Related