vault backup: 2025-03-10 10:10:13
This commit is contained in:
parent
6c34cb80f2
commit
146d246cc5
2 changed files with 27 additions and 3 deletions
4
.obsidian/workspace.json
vendored
4
.obsidian/workspace.json
vendored
|
@ -34,9 +34,9 @@
|
||||||
"type": "pdf",
|
"type": "pdf",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Concurrent Systems/slides/class 3.pdf",
|
"file": "Concurrent Systems/slides/class 3.pdf",
|
||||||
"page": 11,
|
"page": 12,
|
||||||
"left": -26,
|
"left": -26,
|
||||||
"top": 49,
|
"top": 15,
|
||||||
"zoom": 0.57541567695962
|
"zoom": 0.57541567695962
|
||||||
},
|
},
|
||||||
"icon": "lucide-file-text",
|
"icon": "lucide-file-text",
|
||||||
|
|
|
@ -195,3 +195,27 @@ Then, pj enters its CS, completes it, unlocks and then invokes lock again
|
||||||
- Otherwise, by Lemma1, MY_TURN[i] < MY_TURN[j], then pj cannot bypass pi again!
|
- Otherwise, by Lemma1, MY_TURN[i] < MY_TURN[j], then pj cannot bypass pi again!
|
||||||
- At worse, pi has to wait all other proceeses before entering its CS
|
- At worse, pi has to wait all other proceeses before entering its CS
|
||||||
- (indeed, since there is no deadlock, when pi is waiting somebody enters the CS)
|
- (indeed, since there is no deadlock, when pi is waiting somebody enters the CS)
|
||||||
|
|
||||||
|
### Aravind’s algorithm
|
||||||
|
Problem with Lamport's algorithm: registers must be unbounded (every invocation of lock potentially increases the counter by 1 -> domain of the registers is all natural numbers!)
|
||||||
|
|
||||||
|
For all processes, we have a FLAG and a STAGE (both binary MRSW) and a DATE (MRMW) register that ranges from 1 to 2n.
|
||||||
|
|
||||||
|
```
|
||||||
|
For all i, initialize
|
||||||
|
FLAG[i] to down
|
||||||
|
STAGE[i] to 0
|
||||||
|
DATE[i] to i
|
||||||
|
|
||||||
|
lock(i) :=
|
||||||
|
FLAG[i] <- up
|
||||||
|
repeat
|
||||||
|
STAGE[i] <- 0
|
||||||
|
wait (foreach j != i, FLAG[j] = down OR DATE[i] < DATE[j])
|
||||||
|
STAGE[i] <- 1
|
||||||
|
until foreach j != i, STAGE[J] = 0
|
||||||
|
|
||||||
|
unlock(i) :=
|
||||||
|
tmp <-
|
||||||
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue