vault backup: 2025-03-12 12:19:27

This commit is contained in:
Marco Realacci 2025-03-12 12:19:27 +01:00
parent 5dffa6402e
commit a6939cfeb2
3 changed files with 17 additions and 8 deletions

View file

@ -162,18 +162,26 @@ producer A:
- ...
- writes at BUF[n], so IN becomes 0
**Now there are no free slots.**
consumer A:
- starts reading BUF[0], now OUT is 1
- it is a sloooooooooow consumer
consumer B:
- finds OUT at 1
- sets OUT at 2 and starts reading
- finishes reading
- finds OUT at 1, sets OUT at 2 and starts reading
- finishes reading (before consumer A)
- sets EMPTY[1] <- tt
- calls `FREE.up()`
consumer A:
- finishes reading (finally)
- sets EMPTY[0] <- tt
producer A:
- as consumer B called `FREE.up()`, the producer can finally produce
- remember, IN is set to 0!
- so producer A will write at `BUF[0]`
- but wait! Consumer B is still reading there
- **Producer A doesn't give a fuck.**
![[Pasted image 20250312121828.png|200]]
*don't be like Producer A, be more like Bob*

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 KiB