vault backup: 2025-03-17 09:34:23

This commit is contained in:
Marco Realacci 2025-03-17 09:34:23 +01:00
parent a2c08659c9
commit b0a4184681
2 changed files with 15 additions and 5 deletions

View file

@ -25,5 +25,15 @@ monitor RNDV :=
B.signal()
return
```
The last process wakes up one of the others... Then he wakes up another one etc...
The last process wakes up one of the others, then he wakes up another one etc...
Of course, `signal()` will have no effect on the last process who calls it.
#### Monitor implementation through semaphores
*Hoare semantics*
- A semaphore MUTEX init at 1 (to guarantee mutex in the monitor)
- 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)
1. Every monitor operation starts with `MUTEX.down()` and ends with `if NPR > 0 then PRIO.up() else MUTEX.up()`
2.