vault backup: 2025-04-01 11:48:48
This commit is contained in:
parent
7890f2ebaf
commit
2c30624851
2 changed files with 26 additions and 6 deletions
|
@ -65,7 +65,7 @@ p(C’) can be R1.read() or R1.write(v) and q(C’) can be R2.read() or R2.write
|
|||
- *Remark:* q(p(C)) = q(C) cannot be distinguished by q since the value written by p is lost after the write of q
|
||||
- Then, work like in case (3).
|
||||
|
||||
### CN(Test&set) = 2
|
||||
### CN(test&set) = 2
|
||||
```
|
||||
TS a test&set object init at 0
|
||||
PROP array of proposals, init at whatever
|
||||
|
@ -106,12 +106,32 @@ Let S’ be a schedule of operations only from r that leads p(q(C’)) to a deci
|
|||
- Since r cannot see any difference between p(q(C’)) and q(p(C’)), if we run S’ from q(p(C’)) we must decide 1 as well
|
||||
- in contradiction with q(p(C')) be 0-val
|
||||
|
||||
### CN(Swap) = CN(Fetch&add) = 2
|
||||
### CN(swap) = CN(fetch&add) = 2
|
||||
```
|
||||
...
|
||||
S a swap object init at ⊥
|
||||
PROP array of proposals, init at whatever
|
||||
|
||||
propose(i, v) :=
|
||||
PROP[i] <- v
|
||||
if S.swap(i) = ⊥ then
|
||||
return PROP[i]
|
||||
else
|
||||
return PROP[1-i]
|
||||
```
|
||||
|
||||
### CN(Compare&swap) = ∞
|
||||
```
|
||||
FA a fetch&add object init at 0
|
||||
PROP array of proposals, init at whatever
|
||||
|
||||
propose(i, v) :=
|
||||
PROP[i] <- v
|
||||
if FA.fetch&add(1) = 0 then
|
||||
return PROP[i]
|
||||
else
|
||||
return PROP[1-i]
|
||||
```
|
||||
|
||||
### CN(compare&swap) = ∞
|
||||
|
||||
Let us consider a verison of the compare&swap where, instead of returning a boolean, it always returns the previous value of the object, i.e.:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue