Tweeted twitter.com/StackCompSci/status/887088421822316544
4 removing tags
| link
3 added 16 characters in body
source | link

I read this answer below and got into another question.

Why is the consensus number for test-and-set, 2?

I also read that read/write registers have consensus number 1.

But I see that in test&set (also in compare&swap) by using read write registers alone, we still arrive at consensus.

I think I am missing something very fundamental here. Need help.

The protocol in the accepted answer of the link is as mentioned below

Suppose that we have two threads 0 and 1 that need to reach consensus. We could do this by letting each thread follow the consensus protocol below:

  1. Write your proposed value to A[t], where t is the thread id and A is an array of size 2
  2. Perform the test-and-set instruction on some register R, with R initialised to 0.
  3. If the return value is 0, you were first: return A[t]. Otherwise, you were second: return A[|t−1|].

Suppose that we have two threads 0 and 1 that need to reach consensus. We could do this by letting each thread follow the consensus protocol below:

  1. Write your proposed value to A[t], where t is the thread id and A is an array of size 2
  2. Perform the test-and-set instruction on some register R, with R initialised to 0.
  3. If the return value is 0, you were first: return A[t]. Otherwise, you were second: return A[|t−1|].

I read this answer below and got into another question.

Why is the consensus number for test-and-set, 2?

I also read that read/write registers have consensus number 1.

But I see that in test&set (also in compare&swap) by using read write registers alone, we still arrive at consensus.

I think I am missing something very fundamental here. Need help.

The protocol in the accepted answer of the link is as mentioned below

Suppose that we have two threads 0 and 1 that need to reach consensus. We could do this by letting each thread follow the consensus protocol below:

  1. Write your proposed value to A[t], where t is the thread id and A is an array of size 2
  2. Perform the test-and-set instruction on some register R, with R initialised to 0.
  3. If the return value is 0, you were first: return A[t]. Otherwise, you were second: return A[|t−1|].

I read this answer below and got into another question.

Why is the consensus number for test-and-set, 2?

I also read that read/write registers have consensus number 1.

But I see that in test&set (also in compare&swap) by using read write registers alone, we still arrive at consensus.

I think I am missing something very fundamental here. Need help.

The protocol in the accepted answer of the link is as mentioned below

Suppose that we have two threads 0 and 1 that need to reach consensus. We could do this by letting each thread follow the consensus protocol below:

  1. Write your proposed value to A[t], where t is the thread id and A is an array of size 2
  2. Perform the test-and-set instruction on some register R, with R initialised to 0.
  3. If the return value is 0, you were first: return A[t]. Otherwise, you were second: return A[|t−1|].
2 added 509 characters in body
source | link

I read this answer below and got into another question.

Why is the consensus number for test-and-set, 2?

I also read that read/write registers have consensus number 1.

But I see that in test&set (also in compare&swap) by using read write registers alone, we still arrive at consensus.

I think I am missing something very fundamental here. Need help.

The protocol in the accepted answer of the link is as mentioned below

Suppose that we have two threads 0 and 1 that need to reach consensus. We could do this by letting each thread follow the consensus protocol below:

  1. Write your proposed value to A[t], where t is the thread id and A is an array of size 2
  2. Perform the test-and-set instruction on some register R, with R initialised to 0.
  3. If the return value is 0, you were first: return A[t]. Otherwise, you were second: return A[|t−1|].

I read this answer below and got into another question.

Why is the consensus number for test-and-set, 2?

I also read that read/write registers have consensus number 1.

But I see that in test&set (also in compare&swap) by using read write registers alone, we still arrive at consensus.

I think I am missing something very fundamental here. Need help.

I read this answer below and got into another question.

Why is the consensus number for test-and-set, 2?

I also read that read/write registers have consensus number 1.

But I see that in test&set (also in compare&swap) by using read write registers alone, we still arrive at consensus.

I think I am missing something very fundamental here. Need help.

The protocol in the accepted answer of the link is as mentioned below

Suppose that we have two threads 0 and 1 that need to reach consensus. We could do this by letting each thread follow the consensus protocol below:

  1. Write your proposed value to A[t], where t is the thread id and A is an array of size 2
  2. Perform the test-and-set instruction on some register R, with R initialised to 0.
  3. If the return value is 0, you were first: return A[t]. Otherwise, you were second: return A[|t−1|].
1
source | link