From b0a41846813be1a4248e717539efc20acadd1719 Mon Sep 17 00:00:00 2001 From: Marco Realacci Date: Mon, 17 Mar 2025 09:34:23 +0100 Subject: [PATCH] vault backup: 2025-03-17 09:34:23 --- .obsidian/workspace.json | 8 ++++---- Concurrent Systems/notes/4b -.md | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 611348c..e6a430b 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -34,9 +34,9 @@ "type": "pdf", "state": { "file": "Concurrent Systems/slides/class 4.pdf", - "page": 12, + "page": 13, "left": -27, - "top": 16, + "top": 96, "zoom": 0.5754156769596199 }, "icon": "lucide-file-text", @@ -216,10 +216,10 @@ "companion:Toggle completion": false } }, - "active": "6edd4157a160e462", + "active": "071b6cd23e4b1e9d", "lastOpenFiles": [ - "Concurrent Systems/slides/class 4.pdf", "Concurrent Systems/notes/4b -.md", + "Concurrent Systems/slides/class 4.pdf", "Concurrent Systems/slides/class 5.pdf", "HCIW/slides/4 HUI2016-6-forcefeedback.pdf", "HCIW/slides/3b Haptic slides.pdf", diff --git a/Concurrent Systems/notes/4b -.md b/Concurrent Systems/notes/4b -.md index 0909ae3..6c99f96 100644 --- a/Concurrent Systems/notes/4b -.md +++ b/Concurrent Systems/notes/4b -.md @@ -25,5 +25,15 @@ monitor RNDV := B.signal() return ``` -The last process wakes up one of the others... Then he wakes up another one etc... +The last process wakes up one of the others, then he wakes up another one etc... +Of course, `signal()` will have no effect on the last process who calls it. +#### Monitor implementation through semaphores +*Hoare semantics* + +- A semaphore MUTEX init at 1 (to guarantee mutex in the monitor) +- For every condition C, a semaphore SEMC init at 0 and an integer $N_{C}$ init at 0 (to store and count the number of suspended processes on the given condition) +- A semaphore PRIO init at 0 and an integer $N_{PR}$ init at 0 (to store and count the number of processes that have performed a signal, and so have priority to re-enter the monitor) + +1. Every monitor operation starts with `MUTEX.down()` and ends with `if NPR > 0 then PRIO.up() else MUTEX.up()` +2. \ No newline at end of file