From 14ed464948f28566c855847ef671b91e4b667c2d Mon Sep 17 00:00:00 2001 From: Marco Realacci Date: Wed, 12 Mar 2025 12:04:27 +0100 Subject: [PATCH] vault backup: 2025-03-12 12:04:27 --- Concurrent Systems/notes/4 - Semaphores.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Concurrent Systems/notes/4 - Semaphores.md b/Concurrent Systems/notes/4 - Semaphores.md index 9802c82..6f30c0c 100644 --- a/Concurrent Systems/notes/4 - Semaphores.md +++ b/Concurrent Systems/notes/4 - Semaphores.md @@ -159,8 +159,19 @@ Let's imagine to have quick producers and a slow consumer: producer A: - writes at BUF[0], so IN becomes 1 +producer B: +- writes at BUF[1], so IN becomes 2 + consumer A: -- reads +- starts reading BUF[0], now OUT is 1 + +consumer B: +- finds OUT at 1 +- sets out at 2 and starts reading +- finishes reading +- + + #### The Readers/Writers problem - Several processes want to access a file