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

This commit is contained in:
Marco Realacci 2025-03-12 11:39:27 +01:00
parent ec1b4706d8
commit 5df57ffe73
2 changed files with 41 additions and 2 deletions

View file

@ -180,3 +180,42 @@ begin_write() :=
end_write() :=
GLOB_MUTEX.up()
return
```
##### Strong priority to Readers
When a writer terminates, it activates the first reader, if there is any, or the first writer, otherwise.
```
GLOB_MUTEX and R_MUTEX and W_MUTEX semaphores init. at 1
R a shared register init. at 0
begin_read() := end_read() :=
come prima come prima
begin_write() :=
W_MUTEX.down()
GLOB_MUTEX.down()
return
end_write() :=
GLOB_MUTEX.up()
W_MUTEX.up()
return
```
##### Weak priority to Writers
```
GLOB_MUTEX, PRIO_MUTEX, R_MUTEX and W_MUTEX semaphores init. at 1 R and W shared registers init. at 0
begin_read() :=
PRIO_MUTEX.down()
R_MUTEX.down()
R++
if R = 1 then
GLOB_MUTEX.down()
R_MUTEX.up()
PRIO_MUTEX.up()
return
end_read() :=