diff --git a/Concurrent Systems/notes/4 - Semaphores.md b/Concurrent Systems/notes/4 - Semaphores.md index 7a465ab..9802c82 100644 --- a/Concurrent Systems/notes/4 - Semaphores.md +++ b/Concurrent Systems/notes/4 - Semaphores.md @@ -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