Download presentation
Presentation is loading. Please wait.
Published byEustacia Pope Modified over 9 years ago
1
1 Consensus Hierarchy Part 2
2
2 FIFO (Queue) FIFO Object headtail
3
3 Special case: empty queue tailhead
4
4 Theorem: A FIFO object has consensus number 2 Proof: 1.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
5 A Wait-Free Consensus algorithm for 2 processors using a FIFO object (and read/write objects) Initially: tailhead Proof-Part 1
6
6 Shared Memory Queue Other Variables tail head
7
7 Local variables :initial values for the consensus problem :resulting values for the consensus problem
8
8 Shared Memory Queue Other Variables tail head Initial values
9
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
10 Example execution: Shared Memory Queue tail head
11
11 Suppose that accesses first the queue Shared Memory Queue tail head decides on its own value
12
12 Suppose that accesses second Shared Memory Queue tail head decides on the other processor’s value Consensus Reached
13
13 There is no wait-free consensus algorithm using only FIFO (and read-write) objects for Consider three processors (the same proof generalizes to more) Proof-Part 2 We will prove:
14
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
15 Assume for contradiction that all processors are critical bivalent univalent Possible executions
16
16 bivalent valent It cannot be that all have the same valence valent Contradiction
17
17 There must exist two processors with different valences bivalent univalent
18
18 Shared Memory Queue Read/Write Objects
19
19 Shared Memory Queue Read/Write Objects bivalent Case: the processors access different objects Note: if an object was read/write the analysis is the similar univalent
20
20 bivalent op Q1 op Q2 op Q1 Impossible since Two possible executions univalent
21
21 Shared Memory Queue Read/Write Objects bivalent Case: the processors access same object Note: if the object was read/write the analysis is the same as in the case with read/write objects univalent
22
22 bivalent univalent deq(Q) Subcase: deq/deq
23
23 bivalent univalent deq(Q) Impossible since Queue Q before operations:
24
24 bivalent univalent deq(Q) enq(Q,x) Subcase: deq/enq
25
25 bivalent univalent deq(Q) enq(Q,x) deq(Q) Impossible since Suppose Q was not empty
26
26 bivalent univalent deq(Q) enq(Q,x) Impossible since Suppose Q was empty
27
27 bivalent univalent enq(Q,a) enq(Q,b) Subcase: enq/enq
28
28 bivalent univalent enq(Q,a) enq(Q,b) enq(Q,a) Suppose Q was not empty
29
29 bivalent univalent enq(Q,a) enq(Q,b) enq(Q,a) enq(Q,b) Dequeue aDequeue b Dequeue a Impossible since
30
30 bivalent enq(Q,a) enq(Q,b) decides Suppose does not dequeue a A decision will be reached since the consensus algorithm is wait-free Explanation
31
31 bivalent enq(Q,a) enq(Q,b) enq(Q,a) enq(Q,b) The same value will be decided by, since sees the same shared memory values in both executions decides contradiction
32
32 In all cases we obtained contradiction; Therefore, there exists a processor which is not critical bivalent univalent bivalent (not critical)
33
33 Therefore, we can construct an execution Initial configuration Never ends bivalent Consensus can never be reached End of Theorem Proof
34
34 Compare&Swap Compare&Swap(X,A,B) { Temp X; If X==A then X B; Return Temp; } Shared Memory X
35
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
36 A Wait-Free Consensus algorithm for n processors using a compare&swap object Shared Memory First Local Memory (compare&swap object) Initial value Final value
37
37 Code for processor If then else //am I the first? //yes, choose my value Note: the algorithm uses a compare&swap and read/write objects //no, choose the value of the first process which is stored in First
38
38 Shared Memory First Local Memory Example execution:
39
39 Local Memory Suppose executes first Compare&Swap(First,,0) Shared Memory First
40
40 Local Memory Suppose executes first Shared Memory First Realizes it is first, decides on its own value
41
41 Local Memory Suppose executes second Compare&Swap(First,,1) Shared Memory First
42
42 Local Memory Shared Memory First Realizes is not first, decides on value of First Suppose executes second
43
43 Local Memory Shared Memory First Realizes is not first, decides on value of First Similarly for Consensus has been reached
44
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
45 Consensus Hierarchy Part 3
46
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
47 Object TypeConsensus Number Read/Write 1 FIFO 2 Compare&Swap (infinity)
48
48 Simulation: Object Type B Object Type A Read/Write Object Object of type A simulates object of Type B
49
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
50 Universality can simulate in a wait-free manner any other arbitrary object Universal object:
51
51 Objects with consensus number can simulate in a wait-free manner any other arbitrary object of up to processors We can show:
52
52 new-state Compare&Swap inv response before new-state inv response before initial head anchor Non-Blocking Simulation
53
53 new-state Consensus Object inv response after new-state inv response after initial Head anchor Non-Blocking Simulation seq 1
54
54 new-state inv response after Announce seq Wait-free Simulation
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.