From af2d7f19c7182013844188a068936d3f0c72e2df Mon Sep 17 00:00:00 2001 From: Marco Realacci Date: Wed, 2 Apr 2025 23:20:03 +0200 Subject: [PATCH] vault backup: 2025-04-02 23:20:03 --- .obsidian/workspace.json | 36 ++++++++++++++--------------- Concurrent Systems/test/Untitled.md | 25 +++++++++++++++++++- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 20f023b..c5dd9da 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -13,30 +13,29 @@ "state": { "type": "markdown", "state": { - "file": "Concurrent Systems/notes/1 - CS Basics.md", + "file": "Concurrent Systems/test/Untitled.md", "mode": "source", "source": false }, "icon": "lucide-file", - "title": "1 - CS Basics" + "title": "Untitled" } }, { - "id": "ae1e669229aa09dc", + "id": "e453bba00fdc57d6", "type": "leaf", "state": { "type": "markdown", "state": { - "file": "Concurrent Systems/notes/1 - CS Basics.md", + "file": "Concurrent Systems/notes/4 - Semaphores.md", "mode": "source", "source": false }, "icon": "lucide-file", - "title": "1 - CS Basics" + "title": "4 - Semaphores" } } - ], - "currentTab": 1 + ] } ], "direction": "vertical" @@ -205,31 +204,31 @@ "companion:Toggle completion": false } }, - "active": "2b2245f56092006e", + "active": "7c5b0ca6f7687800", "lastOpenFiles": [ - "Concurrent Systems/notes/4b - Monitors.md", - "Concurrent Systems/notes/1 - CS Basics.md", - "Concurrent Systems/test/Untitled.md", "Concurrent Systems/notes/4 - Semaphores.md", + "Concurrent Systems/test/Untitled.md", + "Concurrent Systems/notes/4b - Monitors.md", + "Concurrent Systems/notes/4c - Dining Philosophers.md", + "Concurrent Systems/notes/5 - Software Transactional Memory.md", + "Concurrent Systems/notes/6 - Atomicity.md", + "Concurrent Systems/notes/7- MUTEX-free concurrency.md", + "Concurrent Systems/notes/9 - Consensus.md", + "Concurrent Systems/slides/class 9.pdf", + "Concurrent Systems/slides/class 10.pdf", + "Concurrent Systems/notes/1 - CS Basics.md", "Concurrent Systems/test", "Concurrent Systems/notes/3a - Hardware primitives & Lamport Bakery algorithm.md", - "Concurrent Systems/notes/9 - Consensus.md", - "Concurrent Systems/notes/6 - Atomicity.md", - "Concurrent Systems/notes/5 - Software Transactional Memory.md", "Concurrent Systems/notes/10 - Implementing Consensus.md", "HCIW/slides/Tangible User Interfaces.pdf", "Concurrent Systems/notes/images/Pasted image 20250401083747.png", "Concurrent Systems/notes/images/Pasted image 20250401092557.png", "Concurrent Systems/notes/3b - Aravind's algorithm and improvements.md", - "Concurrent Systems/notes/4c - Dining Philosophers.md", "Concurrent Systems/notes/1b - Peterson algorithm.md", "Concurrent Systems/notes/2 - Fast mutex by Lamport.md", - "Concurrent Systems/notes/7- MUTEX-free concurrency.md", - "Concurrent Systems/slides/class 10.pdf", "Concurrent Systems/notes/2b - Round Robin algorithm.md", "Concurrent Systems/notes/6a - Alternatives to Atomicity.md", "Concurrent Systems/notes/8 - Enhancing Liveness Properties.md", - "Concurrent Systems/slides/class 9.pdf", "Concurrent Systems/slides/class 6.pdf", "Concurrent Systems/slides/class 5.pdf", "Concurrent Systems/notes/images/Pasted image 20250325090735.png", @@ -252,7 +251,6 @@ "HCIW/exercises/Exercise.md", "Foundation of data science/notes/1 CV Basics.md", "Foundation of data science/notes/7 Autoencoders.md", - "Foundation of data science/notes/6 PCA.md", "Senza nome.canvas" ] } \ No newline at end of file diff --git a/Concurrent Systems/test/Untitled.md b/Concurrent Systems/test/Untitled.md index 8a0bf5c..d28100e 100644 --- a/Concurrent Systems/test/Untitled.md +++ b/Concurrent Systems/test/Untitled.md @@ -1,3 +1,26 @@ ``` -barrier() := +GLOB_MUTEX and R_MUTEX semaphores init. at 1 +R a shared register init. at 0 + +begin_read() := + R_MUTEX.down() + R++ # currently active readers + if R = 1 then GLOB_MUTEX.down() + R_MUTEX.up() + return + +end_read() := + R_MUTEX.down() + R-- + if R = 0 then GLOB_MUTEX.up() + R_MUTEX.up() + return + +begin_write() := + GLOB_MUTEX.down() + return + +end_write() := + GLOB_MUTEX.up() + return ``` \ No newline at end of file