3
$\begingroup$

From the book 'the art of multiprocessor programming':

A protocol state is bivalent if the decision value is not yet fixed: there is some execution starting from that state in which the threads decide 0, and one in which they decide 1.

Lemma 5.1.1. Every 2-thread consensus protocol has a bivalent initial state. Proof: Consider the initial state where A has input 0 and B has input 1. If A finishes the protocol before B takes a step, then A must decide 0, because it must decide some thread’s input, and 0 is the only input it has seen (it cannot decide 1 because it has no way of distinguishing this state from the one in which B has input 0).

Symmetrically, if B finishes the protocol before A takes a step, then B must decide 1, because it must decide some thread’s input, and 1 is the only input it has seen. It follows that the initial state where A has input 0 and B has input 1 is bivalent.

I don't understand why it can only output the input it has seen already. And for A why "it cannot decide 1 because it has no way of distinguishing this state from the one in which B has input 0)".

$\endgroup$
1
$\begingroup$

I don't understand why it can only output the input it has seen already.

The reason is simple. Just too simple. Because it cannot output any input that it has not seen deterministically, where the input could take one of two (or more) values randomly.

Let me use an example. Suppose you and I are two travellers (threads) travelling together. Each of us will be given one of two kind of maps to be used for travel, map 0 and map 1 separately. We two might be given the same kind of map. Or each of us might be given a different kind of map. Initially, each of us do not know what kind of map is given to the other one, since we are two separate travellers that have not communicated yet. Now suppose you have to decide which map should be used before you can make a move to know which map is given to me. What can you do deterministically? Since you do not know which map is given to me, the only deterministic decision you can make is to use whichever map given to you.

Had you have a chance to know which map was given to me, you could make a different decision deterministically. However, that is not the current situation.

for A why "it cannot decide 1 because it has no way of distinguishing this state from the one in which B has input 0)".

That is because A does not know whether 1 or 0 is given to B. Even though the collective state of A and B might be observable/known to a third party, it is not known to A since, at the initial state, by definition, A has not made a move to access any shared object, i.e., A does not know the input to B since it might be 0 and it might be 1.


You will realize, sooner or later, wow, this is just too easy and too simple to understand. It might be fair to say that the lemma 5.1.1 is just too obvious or intuitive to use more than one sentence to explain.

On the other hand, there are lot of pitfalls and counterintuitive phenomenons in multiprocessor programming. Be careful and vigilant.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.