vault backup: 2025-04-02 23:35:03

This commit is contained in:
Marco Realacci 2025-04-02 23:35:03 +02:00
parent d936a07908
commit 7fe9332a40
2 changed files with 9 additions and 5 deletions

View file

@ -35,8 +35,7 @@
"title": "4 - Semaphores"
}
}
],
"currentTab": 1
]
}
],
"direction": "vertical"
@ -205,10 +204,10 @@
"companion:Toggle completion": false
}
},
"active": "e453bba00fdc57d6",
"active": "7c5b0ca6f7687800",
"lastOpenFiles": [
"Concurrent Systems/test/Untitled.md",
"Concurrent Systems/notes/4 - Semaphores.md",
"Concurrent Systems/test/Untitled.md",
"Concurrent Systems/notes/4b - Monitors.md",
"Concurrent Systems/notes/4c - Dining Philosophers.md",
"Concurrent Systems/notes/5 - Software Transactional Memory.md",

View file

@ -6,7 +6,9 @@ begin_read() :=
PR_MUTEX.down()
R_MUTEX.down()
R++ # currently active readers
if R = 1 then GLOB_MUTEX.down()
if R = 1 then
W_MUTEX.down()
GLOB_MUTEX.down()
R_MUTEX.up()
PR_MUTEX.up()
return
@ -19,11 +21,14 @@ end_read() :=
return
begin_write() :=
W_MUTEX.down()
W_MUTEX.up()
PR_MUTEX.down()
GLOB_MUTEX.down()
return
end_write() :=
PR_MUTEX.up()
GLOB_MUTEX.up()
return
```