vault backup: 2025-03-24 10:13:11
This commit is contained in:
parent
b99aea1134
commit
9774fc006c
2 changed files with 23 additions and 3 deletions
2
.obsidian/workspace.json
vendored
2
.obsidian/workspace.json
vendored
|
@ -53,7 +53,7 @@
|
||||||
"file": "Concurrent Systems/slides/class 7.pdf",
|
"file": "Concurrent Systems/slides/class 7.pdf",
|
||||||
"page": 10,
|
"page": 10,
|
||||||
"left": -23,
|
"left": -23,
|
||||||
"top": 175,
|
"top": 90,
|
||||||
"zoom": 0.680522565320665
|
"zoom": 0.680522565320665
|
||||||
},
|
},
|
||||||
"icon": "lucide-file-text",
|
"icon": "lucide-file-text",
|
||||||
|
|
|
@ -154,5 +154,25 @@ TOP : a register that can be read or compare&setted
|
||||||
```
|
```
|
||||||
push(w) :=
|
push(w) :=
|
||||||
while true do ⟨i,v,s⟩ <- TOP
|
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)
|
||||||
```
|
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
|
||||||
|
STACK[i].compare&set(⟨tmp,s-1⟩,⟨v,s⟩)
|
||||||
|
|
||||||
|
pop() :=
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue