From acfc662f8b7d2da66e8a8369f44d1845702cb436 Mon Sep 17 00:00:00 2001 From: Marco Realacci Date: Tue, 25 Mar 2025 12:47:48 +0100 Subject: [PATCH] vault backup: 2025-03-25 12:47:48 --- .obsidian/workspace.json | 16 ++++++++++++++-- .../notes/7- MUTEX-free concurrency.md | 17 +++++++++-------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index d99f304..3a1cf36 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -43,6 +43,18 @@ "type": "tabs", "dimension": 57.23495702005731, "children": [ + { + "id": "b307be81cd26d1cb", + "type": "leaf", + "state": { + "type": "pdf", + "state": { + "file": "Concurrent Systems/slides/class 7.pdf" + }, + "icon": "lucide-file-text", + "title": "class 7" + } + }, { "id": "879210c00db77468", "type": "leaf", @@ -230,12 +242,12 @@ }, "active": "43416c0d533d9ab4", "lastOpenFiles": [ - "Concurrent Systems/slides/class 8.pdf", + "Concurrent Systems/slides/class 7.pdf", "Concurrent Systems/notes/7- MUTEX-free concurrency.md", + "Concurrent Systems/slides/class 8.pdf", "Concurrent Systems/notes/8 - Enhancing Liveness Properties.md", "Pasted image 20250325090735.png", "Concurrent Systems/notes/images/Pasted image 20250324091452.png", - "Concurrent Systems/slides/class 7.pdf", "Concurrent Systems/notes/6 - Atomicity.md", "Concurrent Systems/notes/5 - Software Transactional Memory.md", "Concurrent Systems/notes/4c - Dining Philosophers.md", diff --git a/Concurrent Systems/notes/7- MUTEX-free concurrency.md b/Concurrent Systems/notes/7- MUTEX-free concurrency.md index 4f7bcea..1e60845 100644 --- a/Concurrent Systems/notes/7- MUTEX-free concurrency.md +++ b/Concurrent Systems/notes/7- MUTEX-free concurrency.md @@ -139,7 +139,7 @@ Idea: every operation is started by the invoking process and finalized by the ne This is needed for the so called ABA problem with compare&set: - A typical use of compare&set is ``` - stmp <- X + tmp <- X ... if X.compare&set(tmp, v) then ... ``` @@ -153,13 +153,14 @@ TOP : a register that can be read or compare&setted ``` push(w) := - while true do ⟨i,v,s⟩ <- TOP - conclude(i,v,s) - if i=k then - return FULL - newtop <- ⟨i+1,w,STACK[i+1].seq_num+1⟩ - if TOP.compare&set(⟨i,v,s⟩,newtop) then - return OK + while true do + ⟨i,v,s⟩ <- TOP + conclude(i,v,s) + if i=k then + return FULL + newtop <- ⟨i+1,w,STACK[i+1].seq_num+1⟩ + if TOP.compare&set(⟨i,v,s⟩,newtop) then + return OK conclude(i, v, s) := tmp <- STACK[i].val