vault backup: 2025-04-02 12:41:12
This commit is contained in:
parent
6cb83329cc
commit
7011c59752
2 changed files with 3 additions and 24 deletions
6
.obsidian/workspace.json
vendored
6
.obsidian/workspace.json
vendored
|
@ -28,12 +28,12 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "markdown",
|
"type": "markdown",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Concurrent Systems/notes/3b - Aravind's algorithm and improvements.md",
|
"file": "Concurrent Systems/notes/3a - Hardware primitives & Lamport Bakery algorithm.md",
|
||||||
"mode": "source",
|
"mode": "source",
|
||||||
"source": false
|
"source": false
|
||||||
},
|
},
|
||||||
"icon": "lucide-file",
|
"icon": "lucide-file",
|
||||||
"title": "3b - Aravind's algorithm and improvements"
|
"title": "3a - Hardware primitives & Lamport Bakery algorithm"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -208,8 +208,8 @@
|
||||||
},
|
},
|
||||||
"active": "0b5880764d0a0d29",
|
"active": "0b5880764d0a0d29",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
"Concurrent Systems/notes/3a - Hardware primitives & Lamport Bakery algorithm.md",
|
|
||||||
"Concurrent Systems/notes/3b - Aravind's algorithm and improvements.md",
|
"Concurrent Systems/notes/3b - Aravind's algorithm and improvements.md",
|
||||||
|
"Concurrent Systems/notes/3a - Hardware primitives & Lamport Bakery algorithm.md",
|
||||||
"Concurrent Systems/notes/4 - Semaphores.md",
|
"Concurrent Systems/notes/4 - Semaphores.md",
|
||||||
"Concurrent Systems/notes/5 - Software Transactional Memory.md",
|
"Concurrent Systems/notes/5 - Software Transactional Memory.md",
|
||||||
"Concurrent Systems/notes/4c - Dining Philosophers.md",
|
"Concurrent Systems/notes/4c - Dining Philosophers.md",
|
||||||
|
|
|
@ -141,27 +141,6 @@ lock(i) :=
|
||||||
|
|
||||||
unlock(i) :=
|
unlock(i) :=
|
||||||
MY_TURN[i] <- 0
|
MY_TURN[i] <- 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lock(i) :=
|
|
||||||
FLAG[i] <- up
|
|
||||||
max_turn <- max{MY_TURN[1],...,MY_TURN[n]}
|
|
||||||
if max_turn > 2n then
|
|
||||||
MY_TURN[i] = 1
|
|
||||||
else
|
|
||||||
MY_TURN[i] = max_turn + 1
|
|
||||||
|
|
||||||
|
|
||||||
FLAG[i] <- down
|
|
||||||
forall j != i
|
|
||||||
wait FLAG[j] = down
|
|
||||||
wait (MY_TURN[j] = 0 OR ⟨MY_TURN[i],i⟩ < ⟨MY_TURN[j],j⟩)
|
|
||||||
|
|
||||||
unlock(i) :=
|
|
||||||
MY_TURN[i] <- 0
|
|
||||||
```
|
```
|
||||||
Se il ticket number è minore si ottiene l'accesso, se il ticket number è uguale, allora si vede il process ID minore.
|
Se il ticket number è minore si ottiene l'accesso, se il ticket number è uguale, allora si vede il process ID minore.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue