Consensus Value
Asked Answered
T

1

5

while reading on concurrent programming, I came across the term Consensus Number in Compare-And-Swap & Compare-And-Set operations. I'm having trouble in understanding what is meant by this term, can anyone explain??

Thank You!!

Tagore answered 19/3, 2011 at 18:38 Comment(1)
I think this was discussed here: #773712Bertrambertrand
S
11

Consensus problem is like this... You have N processes. Every thread gets to propose a value, then the threads should decide on one and the same of these proposed values.

Example for two threads: Thread A suggests value A, thread B suggests value B. Then the valid outcomes are that either both threads decide A, or that both threads decide B.

There are different special objects or operations that are useful in solving the consensus problem. Their powerfulness is graded by their consensus number. This equals the maximum number of threads for which they can solve the consensus problem.

  • Consensus number 1: Normal read/write registers. (That is, plain variables.)
  • Consensus number 2: Test & set (a.k.a. compare & set), queue, stack et.c.
  • Consensus number 2n-2: n-register assignment
  • Consensus number ∞: Compare & swap, et.c.
Seka answered 19/3, 2011 at 19:16 Comment(1)
@kotlinski You mentioned that stacks have a consensus number of 2. Why is that?Featherweight

© 2022 - 2024 — McMap. All rights reserved.