diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 3e52276..1df8967 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -4,25 +4,11 @@ "type": "split", "children": [ { - "id": "126da1a2d2b29212", + "id": "754900d6261702e5", "type": "tabs", "children": [ { - "id": "fd57e934213e31db", - "type": "leaf", - "state": { - "type": "markdown", - "state": { - "file": "Concurrent Systems/notes/2b - Round Robin algorithm.md", - "mode": "source", - "source": false - }, - "icon": "lucide-file", - "title": "2b - Round Robin algorithm" - } - }, - { - "id": "7dbc67ca2ef1097d", + "id": "6bd7f2a6f353529e", "type": "leaf", "state": { "type": "markdown", @@ -35,29 +21,6 @@ "title": "3" } } - ], - "currentTab": 1 - }, - { - "id": "754900d6261702e5", - "type": "tabs", - "children": [ - { - "id": "6bd7f2a6f353529e", - "type": "leaf", - "state": { - "type": "pdf", - "state": { - "file": "Concurrent Systems/slides/class 3.pdf", - "page": 5, - "left": -9, - "top": 186, - "zoom": 0.6 - }, - "icon": "lucide-file-text", - "title": "class 3" - } - } ] } ], @@ -115,8 +78,7 @@ } ], "direction": "horizontal", - "width": 307.5, - "collapsed": true + "width": 307.5 }, "right": { "id": "bc4b945ded1926e3", @@ -231,13 +193,13 @@ "companion:Toggle completion": false } }, - "active": "7dbc67ca2ef1097d", + "active": "6bd7f2a6f353529e", "lastOpenFiles": [ "Concurrent Systems/slides/class 3.pdf", - "Concurrent Systems/notes/3.md", - "Concurrent Systems/notes/2b - Round Robin algorithm.md", - "Concurrent Systems/notes/1 - CS Basics.md", "Concurrent Systems/notes/2 - Fast mutex by Lamport.md", + "Concurrent Systems/notes/1 - CS Basics.md", + "Concurrent Systems/notes/2b - Round Robin algorithm.md", + "Concurrent Systems/notes/3.md", "Concurrent Systems/notes/1b - Peterson algorithm.md", "HCIW/slides/Interface and Interaction for IoT.pdf", "Pasted image 20250305182542.png", diff --git a/Concurrent Systems/notes/3.md b/Concurrent Systems/notes/3.md index 3802f7e..45fb2dd 100644 --- a/Concurrent Systems/notes/3.md +++ b/Concurrent Systems/notes/3.md @@ -91,3 +91,19 @@ X.fetch&add(v) := return tmp ``` +###### How do we use it for MUTEX? +``` +Initialize TICKET and NEXT at 0 + +lock() := + my_ticket <- TICKET.fetch&add(1) + wait my_ticket = NEXT + return + +unlock() := + NEXT <- NEXT + 1 + return +``` + +>[!info} It is bounded bypass with bound n-1 +