What is the consensus number for semaphores?

前端 未结 4 1542
灰色年华
灰色年华 2021-02-02 17:36

(I think that) the consensus number for a mutex is 2.

What is the consensus number for semaphores (like in pthread_sem_*)?

What is the consensus number for condi

4条回答
  •  悲&欢浪女
    2021-02-02 17:53

    From this article alone you can conclude that a semaphore must have a consensus number less than or equal to 2. Here's why:

    On the third page of the article they state: "The fetch&add operation is quite flexible: it can be used for semaphores...". Since we know that fetch&add has consensus number equal to 2, Theorem 1 of that paper can then be used to show that a semaphore must have consensus number less than or equal to 2. The proof goes like this:


    Proof

    Assume that a wait-free implementation of semaphores by fetch&add exists. Further assume that a semaphore has consensus number greater than 2. We know that fetch&add has a consensus number of 2. From Theorem 1 we can conclude that there exists no wait-free implementation of a semaphore by fetch&add in a system of more than 2 processes. This contradicts the assumption that an implementation by fetch&add exists. Therefore, a semaphore must have a consensus number less than or equal to 2.

    QED

提交回复
热议问题