master-degree-notes/Concurrent Systems/notes/10 - Consensus Implementation.md

2.8 KiB
Raw Blame History

Which objects allow for a wait free implementation of (binary) consensus? The answer depends on the number of participants

The consensus number of an object of type T is the greatest number n such that it is possible to wait free implement a consensus object in a system of n processes by only using objects of type T and atomic R/W registers.

For all T, CN(T) > 0; if there is no sup, we let CN(T) := +∞

Thm: let CN(T1) < CN(T2), then there exists no wait free implementation of T2 that only uses objects of type T1 and atomic R/W registers, for all n s.t. CN(T1) < n <= CN(T2).

Proof:

  • Fix such an n; by contr., there exists a wait free implementation of objects of type T2 in a system of n processes that only uses objects of type T1 and atomic RW reg.s.
  • Since n ≤ CN(T2), by def. of CN, there exists a wait free implementation of consensus in a system of n processes that only uses objects of type T2 and atomic RW reg.s.
  • Hence, there exists a wait free implementation of consensus in a system of n processes that only uses objects of type T1 and atomic RW reg.s.
    • contradiction with CN(T1) < n

Schedules and Configurations

Schedule: sequence of operation invocations issued by processes.

Configuration: the global state of a system at a given execution time (values of the shared memory + local state of every process).

Given a configuration C and a schedule S, we denote with S(C) the configuration obtained starting from C and applying S.

Let's consider binary consensus implemented by an algorithm A by using base objects and atomic R/W registers; let us call S_A a schedule induced by A.

A configuration C obtained during the execution of all A is called:

  • v-valent if S_A(C) decides v, for every S_A
  • monovalent, if there exists v \in \{0,1\} s.t. C is v-valent
  • bivalent, otherwise.

Fundamental theorem

If A wait-free implements binary consensus for n processes, then there exists a bivalent initial configuration.

Proof: !

CN(Atomic R/W registers) = 1

Thm: There exists no wait-free implementation of binary consensus for 2 processes that uses atomic R/W registers.

Proof: Assume by contradiction A wait-free, with processes p and q.

By the previous result, it has an initial bivalent configuration C

  • let S be a sequence of operations s.t. C = S(C) is maximally bivalent (i.e., p(C') is 0-valent and q(C') is 1-valent, or viceversa)
    • partendo da C' posso ancora avere due possibili computazioni dove una decide 0 e una decide 1, ma è l'ultima configurazione in cui è possibile. Quelle successive sono monovalenti.

p(C) can be R1.read() or R1.write(v) and q(C) can be R2.read() or R2.write(v)

  1. if R1 != R2
    • Whatever operations p and q issue, we have that q(p(C)) = p(q(C)) But q(p(C)) is 0-val (because p(C) is) whereas p(q(C)) is 1-val