vault backup: 2025-03-17 09:39:23
This commit is contained in:
parent
b0a4184681
commit
cccc568cc5
2 changed files with 23 additions and 4 deletions
4
.obsidian/workspace.json
vendored
4
.obsidian/workspace.json
vendored
|
@ -216,10 +216,10 @@
|
||||||
"companion:Toggle completion": false
|
"companion:Toggle completion": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"active": "071b6cd23e4b1e9d",
|
"active": "6edd4157a160e462",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
"Concurrent Systems/notes/4b -.md",
|
|
||||||
"Concurrent Systems/slides/class 4.pdf",
|
"Concurrent Systems/slides/class 4.pdf",
|
||||||
|
"Concurrent Systems/notes/4b -.md",
|
||||||
"Concurrent Systems/slides/class 5.pdf",
|
"Concurrent Systems/slides/class 5.pdf",
|
||||||
"HCIW/slides/4 HUI2016-6-forcefeedback.pdf",
|
"HCIW/slides/4 HUI2016-6-forcefeedback.pdf",
|
||||||
"HCIW/slides/3b Haptic slides.pdf",
|
"HCIW/slides/3b Haptic slides.pdf",
|
||||||
|
|
|
@ -35,5 +35,24 @@ Of course, `signal()` will have no effect on the last process who calls it.
|
||||||
- For every condition C, a semaphore SEMC init at 0 and an integer $N_{C}$ init at 0 (to store and count the number of suspended processes on the given condition)
|
- For every condition C, a semaphore SEMC init at 0 and an integer $N_{C}$ init at 0 (to store and count the number of suspended processes on the given condition)
|
||||||
- A semaphore PRIO init at 0 and an integer $N_{PR}$ init at 0 (to store and count the number of processes that have performed a signal, and so have priority to re-enter the monitor)
|
- A semaphore PRIO init at 0 and an integer $N_{PR}$ init at 0 (to store and count the number of processes that have performed a signal, and so have priority to re-enter the monitor)
|
||||||
|
|
||||||
1. Every monitor operation starts with `MUTEX.down()` and ends with `if NPR > 0 then PRIO.up() else MUTEX.up()`
|
Every monitor operation starts with `MUTEX.down()` and ends with `if NPR > 0 then PRIO.up() else MUTEX.up()`
|
||||||
2.
|
|
||||||
|
```
|
||||||
|
C.wait() :=
|
||||||
|
NC++
|
||||||
|
if NPR > 0 then
|
||||||
|
PRIO.up()
|
||||||
|
else
|
||||||
|
MUTEX.up()
|
||||||
|
SEMC.down()
|
||||||
|
NC--
|
||||||
|
return
|
||||||
|
|
||||||
|
C.signal() :=
|
||||||
|
if NC > 0 then
|
||||||
|
NPR++
|
||||||
|
SEMC.up()
|
||||||
|
PRIO.down()
|
||||||
|
NPR--
|
||||||
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue