From a3859a8e9c466f027e2646680e2974d0ea1e0fa6 Mon Sep 17 00:00:00 2001 From: Marco Realacci Date: Mon, 24 Mar 2025 10:03:11 +0100 Subject: [PATCH] vault backup: 2025-03-24 10:03:11 --- Concurrent Systems/notes/7- MUTEX-free concurrency.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Concurrent Systems/notes/7- MUTEX-free concurrency.md b/Concurrent Systems/notes/7- MUTEX-free concurrency.md index 6ec93e1..07f7a62 100644 --- a/Concurrent Systems/notes/7- MUTEX-free concurrency.md +++ b/Concurrent Systems/notes/7- MUTEX-free concurrency.md @@ -138,4 +138,13 @@ 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 - ```stm``` \ No newline at end of file +``` + stmp <- X + ... + if X.compare&set(tmp, v) then ... +``` +- this is to ensure that the value of X has not changed in the computation +- the problem is that X can be changed twice before compare&set +- solution: X is a pair ⟨val , seq_numb⟩, with the constraint that each modification of X increases its sequence_number + - with the compare&set you mainly test that the sequence_number has not changed +