Com S 611
Advanced Topics on Distributed and Concurrent Algorithms
Spring Semester 2015
Lecture 23: Thursday, April 9, 2015
Instructor: Soma Chaudhuri
1
Scribe: Haritha Gorijavolu
Proof of theorem 6 continued
Theorem 6 There is no n-processor wait-free consensus algorithm using only FIFO queues and
read/write objects if n ≥ 3.
Proof: Consider 3 processors P , Q and R. Previously we have discussed 5 of the cases in
which the statement of the theorem holds true. The sixth case is the one where P and Q both
enqueue to the queue, F . Let the number of items in F be k − 1. Let the present configuration
be called C. Let P enqueue a and Q enqueues b. If P enqueues a in C, the resulting configuration will have a as kth item of F . If Q enqueues b in C, the resulting configuration will have
b as kth item of F . Consider the following scenario:
In the following figure C1 is 0-valent due to the step taken by P in C. C2 is 1-valent because of the step taken by Q in C. But C1 and C2 appear similar to R. Whichever steps R
takes in C1 can be taken by R in C2 . If R takes steps in C1 and finds out the decision to be
0, it can take the same steps in C1 and find the decision to be 0. This violates the rules of
consensus protocol because no processor can see the decision value as 0 once the configuration
of the system becomes 1-valent. So, we can say that there is no n-processor wait-free consensus
algorithm using only FIFO queues and read/write objects if n ≥ 3.
1
2
Wait-free Hierarchy
Object of type X solves wait-free n-processor consensus if there exists an asynchronous consensus algorithm for n-processors, up to n − 1 of which might crash-fail, using only shared objects
of type X and read/write objects.
CN (X) - Consensus number of X, is the largest number of processors for which X solves
n-processor wait-free consensus.
CN (X) = ∞ if X solves n-processor consensus for all n ∈ N
Read/write registers have consensus number 1
FIFO queues, test and set, swap, stacks, fetch and add have consensus number 2
2
Compare and Swap has consensus number ∞.
Theorem 7 If the consensus number of X is m and CN (Y ) = n > m then there is no
wait-free simulation of Y with X and read/write objects in a system of more than m processors.
Proof: Suppose for contradiction there is a wait free simulation of Y with X and read/write
objects in a system with k > m processors. Let l = min{k, n} and note that l > m. We must
argue that there exists a wait-free l-processor consensus algorithm using objects of type X and
read/write objects, giving the contradiction.
Since l ≤ n, there is a wait-free l-processor consensus algorithm, A, using objects of type
Y and read/write objects. By assumption, we can construct objects of type Y using objects of
type X in a system with k processors. Consider a k processor system. In that we can construct
0
a wait-free l processor consensus algorithm A , where every object of type Y is replaced by
its wait-free implementation constructed from objects of type X and read/write objects. This
simulation can be made to work by letting k − l processors to run in empty loop and let only l
processors take steps (note that l ≤ k). Following this argument, we can say that X has consensus number of at least l. But l > m. This contradicts the assumption that X has consensus
number m.
Corollary 1 There is no wait-free simulation of any object with consensus number > 1 using
read/write objects
Corollary 2 There is no wait-free simulation of any object with consensus number > 2 using FIFO queues and read/write objects
3
Universality
An object is universal if it, together with read/write objects simulates any other object in a
wait-free manner.
Theorem 8 Any object X whose consensus number is n is universal in a system of ≤ n
processors.
X may not be universal in a system of m > n processors. In this section we present and
universal algorithm to simulate any object in a system of n processors using consensus objects
and read/write objects. This algorithm is non-blocking but not wait-free and uses compare and
swap. We represent the object we are trying to simulate as a shared linked list, the nodes of
which contain the sequence of operations applied to the object. The following figure illustrates
the idea (insertion is done at Head):
3
The bigger rectangle is called an op-record.
inv = operation invoked on the object
new state = state after the “inv” is applied to the object
response = response of the “inv” operation
before = pointer to op-record corresponding to previous operation
Algorithm for each processor Pi , 0 ≤ i ≤ n − 1:
1. When invocation inv occurs
2. Allocate a new op-record pointed to by point and point.inv := inv
3. repeat
4.
h:=Head
5.
point.new state, point.response := apply(inv,h.new state)
6.
point.before := h
7. until compare and swap(Head,h,point)=h
8. enable output indicated by point.response
Note: On both success and failure, compare and swap operation returns the value that is
present in Head at the time of invocation of the compare and swap by that particular processor.
Each processor uses the head it reads to compute next state and response of the next oprecord. Then it uses compare and swap to thread it’s record to the linked list. The threading
becomes successful only when the value in actual head matches with the head value read by
that processor.
4
© Copyright 2026 Paperzz