vault backup: 2025-03-17 09:29:23
This commit is contained in:
parent
ff8c0d0409
commit
a2c08659c9
2 changed files with 23 additions and 4 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 4.pdf",
|
"file": "Concurrent Systems/slides/class 4.pdf",
|
||||||
"page": 11,
|
"page": 12,
|
||||||
"left": -27,
|
"left": -27,
|
||||||
"top": 7,
|
"top": 16,
|
||||||
"zoom": 0.5754156769596199
|
"zoom": 0.5754156769596199
|
||||||
},
|
},
|
||||||
"icon": "lucide-file-text",
|
"icon": "lucide-file-text",
|
||||||
|
|
|
@ -6,5 +6,24 @@ It guarantees mutual exclusion.
|
||||||
Inter-process synchronization is done through *conditions*, which are objects that provide the following operations:
|
Inter-process synchronization is done through *conditions*, which are objects that provide the following operations:
|
||||||
- ***wait*:** the invoking process suspends, enters into the condition's queue, and releases the mutex on the monitor
|
- ***wait*:** the invoking process suspends, enters into the condition's queue, and releases the mutex on the monitor
|
||||||
- ***signal*:** if no process is in the condition's queue, the nothing happens. Otherwise
|
- ***signal*:** if no process is in the condition's queue, the nothing happens. Otherwise
|
||||||
- it reactivates the first suspended process, suspends the signaling process that however has a priority to re-enter the monitor (*Hoare semantics*)
|
- reactivates the first suspended process, suspends the signaling process that however has a priority to re-enter the monitor (*Hoare semantics*)
|
||||||
-
|
- completes its task and the first process in the condition's queue has the priority to enter the monitor (after that the signaling one terminates or suspends) (*Mesa semantics*).
|
||||||
|
|
||||||
|
#### A very typical use: Rendez-vous
|
||||||
|
A soon as a process arrives at a barrier it needs to suspend and wait for every other process to reach the barrier.
|
||||||
|
|
||||||
|
```
|
||||||
|
monitor RNDV :=
|
||||||
|
cnt ∈ {0,…,m} init at 0
|
||||||
|
condition B
|
||||||
|
operation barrier() :=
|
||||||
|
cnt++
|
||||||
|
if cnt < m then
|
||||||
|
B.wait()
|
||||||
|
else
|
||||||
|
cnt <- 0
|
||||||
|
B.signal()
|
||||||
|
return
|
||||||
|
```
|
||||||
|
The last process wakes up one of the others... Then he wakes up another one etc...
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue