vault backup: 2025-03-12 11:14:27
This commit is contained in:
parent
6bd7ddb752
commit
19763a4483
2 changed files with 10 additions and 4 deletions
4
.obsidian/workspace.json
vendored
4
.obsidian/workspace.json
vendored
|
@ -34,9 +34,9 @@
|
|||
"type": "pdf",
|
||||
"state": {
|
||||
"file": "Concurrent Systems/slides/class 4.pdf",
|
||||
"page": 5,
|
||||
"page": 7,
|
||||
"left": -23,
|
||||
"top": 391,
|
||||
"top": 248,
|
||||
"zoom": 0.652019002375297
|
||||
},
|
||||
"icon": "lucide-file-text",
|
||||
|
|
|
@ -101,7 +101,7 @@ B.consume() :=
|
|||
B.produce(v) :=
|
||||
FREE.down()
|
||||
SP.down()
|
||||
while not EMPTY[in] do # there is at least an EMPTY cell, otherwise it would have been blocked
|
||||
while not EMPTY[in] do
|
||||
IN <- (IN+1) mod k
|
||||
i <- IN
|
||||
EMPTY[IN] <- ff
|
||||
|
@ -124,3 +124,9 @@ B.consume() :=
|
|||
FREE.up()
|
||||
return tmp
|
||||
```
|
||||
Thanks to the semaphores, we are sure that while loops will not go on forever! The loops starts only if there is at least a FREE / BUSY cell.
|
||||
|
||||
#### (Multiple) Producers/Consumers - Wrong solution
|
||||
EXERCISE - will do later
|
||||
|
||||
#### The Readers/Writers problem
|
||||
|
|
Loading…
Reference in a new issue