vault backup: 2025-04-02 23:30:03
This commit is contained in:
parent
6492d433d2
commit
d936a07908
2 changed files with 7 additions and 5 deletions
7
.obsidian/workspace.json
vendored
7
.obsidian/workspace.json
vendored
|
@ -35,7 +35,8 @@
|
|||
"title": "4 - Semaphores"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"currentTab": 1
|
||||
}
|
||||
],
|
||||
"direction": "vertical"
|
||||
|
@ -204,10 +205,10 @@
|
|||
"companion:Toggle completion": false
|
||||
}
|
||||
},
|
||||
"active": "7c5b0ca6f7687800",
|
||||
"active": "e453bba00fdc57d6",
|
||||
"lastOpenFiles": [
|
||||
"Concurrent Systems/notes/4 - Semaphores.md",
|
||||
"Concurrent Systems/test/Untitled.md",
|
||||
"Concurrent Systems/notes/4 - Semaphores.md",
|
||||
"Concurrent Systems/notes/4b - Monitors.md",
|
||||
"Concurrent Systems/notes/4c - Dining Philosophers.md",
|
||||
"Concurrent Systems/notes/5 - Software Transactional Memory.md",
|
||||
|
|
|
@ -3,12 +3,12 @@ GLOB_MUTEX and R_MUTEX semaphores init. at 1
|
|||
R a shared register init. at 0
|
||||
|
||||
begin_read() :=
|
||||
PRIO_MUTEX.down()
|
||||
PR_MUTEX.down()
|
||||
R_MUTEX.down()
|
||||
R++ # currently active readers
|
||||
if R = 1 then GLOB_MUTEX.down()
|
||||
R_MUTEX.up()
|
||||
PRIO_MUTEX.up()
|
||||
PR_MUTEX.up()
|
||||
return
|
||||
|
||||
end_read() :=
|
||||
|
@ -19,6 +19,7 @@ end_read() :=
|
|||
return
|
||||
|
||||
begin_write() :=
|
||||
PR_MUTEX.down()
|
||||
GLOB_MUTEX.down()
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue