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
|
@ -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»)
|
Loading…
Add table
Add a link
Reference in a new issue