vault backup: 2025-03-12 11:19:27

This commit is contained in:
Marco Realacci 2025-03-12 11:19:27 +01:00
parent 19763a4483
commit 7ffffd2d0f
2 changed files with 26 additions and 2 deletions

View file

@ -34,9 +34,9 @@
"type": "pdf",
"state": {
"file": "Concurrent Systems/slides/class 4.pdf",
"page": 7,
"page": 8,
"left": -23,
"top": 248,
"top": 421,
"zoom": 0.652019002375297
},
"icon": "lucide-file-text",

View file

@ -130,3 +130,27 @@ Thanks to the semaphores, we are sure that while loops will not go on forever! T
EXERCISE - will do later
#### 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»)