vault backup: 2025-03-25 12:47:48
This commit is contained in:
parent
be5f1b39af
commit
acfc662f8b
2 changed files with 23 additions and 10 deletions
|
@ -139,7 +139,7 @@ Idea: every operation is started by the invoking process and finalized by the ne
|
|||
This is needed for the so called ABA problem with compare&set:
|
||||
- A typical use of compare&set is
|
||||
```
|
||||
stmp <- X
|
||||
tmp <- X
|
||||
...
|
||||
if X.compare&set(tmp, v) then ...
|
||||
```
|
||||
|
@ -153,13 +153,14 @@ TOP : a register that can be read or compare&setted
|
|||
|
||||
```
|
||||
push(w) :=
|
||||
while true do ⟨i,v,s⟩ <- TOP
|
||||
conclude(i,v,s)
|
||||
if i=k then
|
||||
return FULL
|
||||
newtop <- ⟨i+1,w,STACK[i+1].seq_num+1⟩
|
||||
if TOP.compare&set(⟨i,v,s⟩,newtop) then
|
||||
return OK
|
||||
while true do
|
||||
⟨i,v,s⟩ <- TOP
|
||||
conclude(i,v,s)
|
||||
if i=k then
|
||||
return FULL
|
||||
newtop <- ⟨i+1,w,STACK[i+1].seq_num+1⟩
|
||||
if TOP.compare&set(⟨i,v,s⟩,newtop) then
|
||||
return OK
|
||||
|
||||
conclude(i, v, s) :=
|
||||
tmp <- STACK[i].val
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue