vault backup: 2025-03-12 11:19:27
This commit is contained in:
parent
19763a4483
commit
7ffffd2d0f
2 changed files with 26 additions and 2 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": 7,
|
"page": 8,
|
||||||
"left": -23,
|
"left": -23,
|
||||||
"top": 248,
|
"top": 421,
|
||||||
"zoom": 0.652019002375297
|
"zoom": 0.652019002375297
|
||||||
},
|
},
|
||||||
"icon": "lucide-file-text",
|
"icon": "lucide-file-text",
|
||||||
|
|
|
@ -130,3 +130,27 @@ Thanks to the semaphores, we are sure that while loops will not go on forever! T
|
||||||
EXERCISE - will do later
|
EXERCISE - will do later
|
||||||
|
|
||||||
#### The Readers/Writers problem
|
#### The Readers/Writers problem
|
||||||
|
- Several processes want to access a file
|
||||||
|
- Readers may simultaneously access the file
|
||||||
|
- At most one writer at a time
|
||||||
|
- Reads and writes are mutually exclusive
|
||||||
|
|
||||||
|
>[!note] Remark
|
||||||
|
>this generalizes the MUTEX problem (MUTEX = RW with only writers)
|
||||||
|
|
||||||
|
The read/write operations on the file will all have the following shape:
|
||||||
|
```
|
||||||
|
conc_read() :=
|
||||||
|
begin_read()
|
||||||
|
read()
|
||||||
|
end_read()
|
||||||
|
|
||||||
|
conc_write() :=
|
||||||
|
begin_write()
|
||||||
|
write()
|
||||||
|
end_write()
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Weak priority to Readers
|
||||||
|
- If a reader arrives during a read, it can surpass possible writers already suspended (risk of starvation for the writes)
|
||||||
|
- When a writer terminates, it activates the first suspended process, irrispectively of whether it is a reader or a writer (so, the priority to readers is said «weak»)
|
Loading…
Reference in a new issue