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
|
@ -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
|
||||
|
@ -123,4 +123,10 @@ B.consume() :=
|
|||
EMPTY[o] <- tt
|
||||
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…
Add table
Add a link
Reference in a new issue