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

This commit is contained in:
Marco Realacci 2025-03-12 11:59:27 +01:00
parent 71114f1630
commit e2bee099da

View file

@ -101,7 +101,7 @@ B.consume() :=
B.produce(v) :=
FREE.down()
SP.down()
while not EMPTY[in] do
while not EMPTY[in] do
IN <- (IN+1) mod k
i <- IN
EMPTY[IN] <- ff
@ -153,6 +153,14 @@ B.consume() :=
FREE.up()
return tmp
```
okay, so the difference seems to be just the fact that there are no while loops to find the first free location, or the first location with data.
Let's imagine to have quick producers and a slow consumer:
producer A:
- writes at BUF[0], so IN becomes 1
consumer A:
- reads
#### The Readers/Writers problem
- Several processes want to access a file