Consensus Hierarchy Part 2 - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Consensus Hierarchy Part 2

Description:

Therefore, we can construct an infinite. execution with bivalent configurations where ... op Q1. op Q2. op Q2. op Q1. Impossible since. Two possible executions ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 43
Provided by: costas
Category:

less

Transcript and Presenter's Notes

Title: Consensus Hierarchy Part 2


1
Consensus HierarchyPart 2
2
FIFO (Queue)
head
tail
FIFO Object
3
Special case empty queue
tail
head
4
A Wait-Free Consensus algorithm for 2 processors
using a FIFO object
tail
head
Initially
5
Shared Memory
Queue
tail
head
Other Variables
6
Local variables
initial values for the consensus problem
resulting values for the consensus problem
7
Shared Memory
Queue
tail
head
Other Variables
Initial values
8
Code for processor
//am I the first?
If then else
//yes, choose my value
//no, choose the other processors value
Note the algorithm uses a FIFO object
and read/write objects
9
Example execution
Shared Memory
Queue
tail
head
10
Suppose that accesses first the queue
Shared Memory
decides on its own value
Queue
tail
head
11
Suppose that accesses second
Shared Memory
Queue
Consensus Reached
tail
head
decides on the other processors value
12
Theorem
There is no wait-free consensus algorithm using
only FIFO objects and read-write objects for
Proof of Theorem
Consider three processors (the same proof
generalizes to more)
13
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
14
Assume for contradiction that all processors are
critical
univalent
bivalent
Possible executions
univalent
univalent
15
It cannot be that all have the same valence
Contradiction
valent
bivalent
valent
valent
valent
16
There must exist two processors with different
valences
bivalent
univalent
17
Shared Memory
Queue
Queue
Queue
Read/Write Objects
18
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
19
Two possible executions
op Q2
op Q1
bivalent
op Q2
op Q1
Impossible since
univalent
20
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
21
Subcase deq/deq
deq(Q)
bivalent
deq(Q)
univalent
22
Queue Q before operations
deq(Q)
deq(Q)
bivalent
deq(Q)
deq(Q)
Impossible since
univalent
23
Subcase deq/enq
deq(Q)
bivalent
enq(Q,x)
univalent
24
Suppose Q was not empty
enq(Q,x)
deq(Q)
bivalent
enq(Q,x)
deq(Q)
Impossible since
univalent
25
Suppose Q was empty
enq(Q,x)
deq(Q)
bivalent
enq(Q,x)
Impossible since
univalent
26
Subcase enq/enq
enq(Q,a)
bivalent
enq(Q,b)
univalent
27
Suppose Q was not empty
enq(Q,b)
enq(Q,a)
bivalent
enq(Q,b)
enq(Q,a)
univalent
28
enq(Q,b)
Dequeue a
Dequeue b
enq(Q,a)
bivalent
enq(Q,b)
enq(Q,a)
Dequeue b
Dequeue a
univalent
Impossible since
29
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
30
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
31
In all cases we obtained contradiction
Therefore, there exists a processor which is not
critical
univalent
bivalent
univalent
bivalent
(not critical)
univalent
32
Therefore, we can construct an execution
bivalent
bivalent
bivalent
Never ends
Initial configuration
Consensus can never be reached
End of Theorem Proof
33
CompareSwap
Shared Memory
CompareSwap(X,A,B)
Temp X If XA then X B Return Temp
X
34
A Wait-Free Consensus algorithm for n processors
using a compareswap object
Local Memory
Shared Memory
First
Initial value
compareswap object
Final value
35
Code for processor
If then else
//am I the first?
//yes, choose my value
//no, choose the value of the first which
is stored in First
Note the algorithm uses a compareswap
and read/write objects
36
Example execution
Local Memory
Shared Memory
First
37
Suppose executes first
Local Memory
Shared Memory
First
CompareSwap(First, ,0)
38
Suppose executes first
Local Memory
Shared Memory
First
Realizes it is first, decides on its own value
39
Suppose executes second
Local Memory
Shared Memory
CompareSwap(First, ,1)
First
40
Suppose executes second
Local Memory
Shared Memory
First
Realizes is not first, decides on value of First
41
Similarly for
Consensus has been reached
Local Memory
Shared Memory
First
Realizes is not first, decides on value of First
42
The algorithm is wait-free, since after the
completion of the CompareSwap operation, every
processor decides (without considering whether
the other processors decide)
Write a Comment
User Comments (0)
About PowerShow.com