diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 192a8a8..356ff48 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -215,6 +215,7 @@ "lastOpenFiles": [ "Concurrent Systems/slides/class 10.pdf", "Concurrent Systems/notes/10 - Consensus Implementation.md", + "Pasted image 20250401092557.png", "Pasted image 20250401083747.png", "Concurrent Systems/notes/3a - Hardware primitives & Lamport Bakery algorithm.md", "Concurrent Systems/notes/3b - Aravind's algorithm and improvements.md", @@ -249,7 +250,6 @@ "Concurrent Systems/notes/Untitled.pdf", "Concurrent Systems/notes/images/Pasted image 20250318090909.png", "Concurrent Systems/notes/images/Pasted image 20250318090733.png", - "Pasted image 20250318090909.png", "HCIW/notes/2 - Interface and Interaction for IoT.md", "HCIW/notes/3 - Beacons.md", "Concurrent Systems/notes/1 - CS Basics2.md", diff --git a/Concurrent Systems/notes/10 - Consensus Implementation.md b/Concurrent Systems/notes/10 - Consensus Implementation.md index 04e5346..1963ff4 100644 --- a/Concurrent Systems/notes/10 - Consensus Implementation.md +++ b/Concurrent Systems/notes/10 - Consensus Implementation.md @@ -106,3 +106,26 @@ Let S’ be a schedule of operations only from r that leads p(q(C’)) to a deci - Since r cannot see any difference between p(q(C’)) and q(p(C’)), if we run S’ from q(p(C’)) we must decide 1 as well - in contradiction with q(p(C')) be 0-val +### CN(Swap) = CN(Fetch&add) = 2 +``` +... +``` + +### CN(Compare&swap) = ∞ + +Let us consider a verison of the compare&swap where, instead of returning a boolean, it always returns the previous value of the object, i.e.: + +![[Pasted image 20250401092557.png]] + +``` +CS a compare&swap object init at ⊥ + +propose(v) := + tmp <- CS.compare&swap(⊥, v) + if tmp = ⊥ then + return v + else + return tmp +``` + +Exercise: devise a consensus object with `CN = ∞` by using the compare&swap \ No newline at end of file diff --git a/Pasted image 20250401092557.png b/Pasted image 20250401092557.png new file mode 100644 index 0000000..63aa10f Binary files /dev/null and b/Pasted image 20250401092557.png differ