From 110db2ace3386e6ea865f40b8aa9387e00fdff1d Mon Sep 17 00:00:00 2001 From: Marco Realacci Date: Mon, 17 Mar 2025 21:47:45 +0100 Subject: [PATCH] vault backup: 2025-03-17 21:47:45 --- .obsidian/workspace.json | 6 ++--- .../5 - Software Transactional Memory.md | 22 ++++++++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 9db05b2..7d3ebd9 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -36,7 +36,7 @@ "file": "Concurrent Systems/slides/class 5.pdf", "page": 4, "left": -23, - "top": 240, + "top": 102, "zoom": 0.652019002375297 }, "icon": "lucide-file-text", @@ -215,10 +215,10 @@ "companion:Toggle completion": false } }, - "active": "51157f32453cba69", + "active": "6edd4157a160e462", "lastOpenFiles": [ - "Concurrent Systems/notes/5 - Software Transactional Memory.md", "Concurrent Systems/slides/class 5.pdf", + "Concurrent Systems/notes/5 - Software Transactional Memory.md", "Concurrent Systems/notes/4c - Dining Philosophers.md", "Concurrent Systems/notes/3a - Hardware primitives & Lamport Bakery algorithm.md", "Concurrent Systems/notes/2b - Round Robin algorithm.md", diff --git a/Concurrent Systems/notes/5 - Software Transactional Memory.md b/Concurrent Systems/notes/5 - Software Transactional Memory.md index d8c4f0c..6fd8f81 100644 --- a/Concurrent Systems/notes/5 - Software Transactional Memory.md +++ b/Concurrent Systems/notes/5 - Software Transactional Memory.md @@ -63,7 +63,27 @@ begin_T() := birthdate(T) <- CLOCK + 1 X.read_T() := - if lc?(XX) != + if lc?(XX) != ⊥ then + return lc(XX).val + lc(XX) <- XX + if lc(XX).date >= birthdate(T) then + ABORT + read_set(T) <- read_set(T) U {X} + return lc(XX).val + +X.write_T(v) := + if lc(XX) = ⊥ then + lc(XX) <- newloc + lc(XX).val <- v + write_set(T) <- write_set(T) U {X} + +try_to_commit_T() := + lock all read_set(T) U write_set(T) + ∀ X ∈ read_set(T) + if XX.date >= birthdate(T) then + release all locks + ABORT + ``` ### Virtual World Consistency