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

This commit is contained in:
Marco Realacci 2025-03-12 11:14:27 +01:00
parent 6bd7ddb752
commit 19763a4483
2 changed files with 10 additions and 4 deletions

View file

@ -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",

View file

@ -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