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 +