vault backup: 2025-03-10 08:49:43

This commit is contained in:
Marco Realacci 2025-03-10 08:49:43 +01:00
parent 4979a0eed2
commit 09bce1d93b
2 changed files with 23 additions and 45 deletions

View file

@ -4,25 +4,11 @@
"type": "split", "type": "split",
"children": [ "children": [
{ {
"id": "126da1a2d2b29212", "id": "754900d6261702e5",
"type": "tabs", "type": "tabs",
"children": [ "children": [
{ {
"id": "fd57e934213e31db", "id": "6bd7f2a6f353529e",
"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",
"type": "leaf", "type": "leaf",
"state": { "state": {
"type": "markdown", "type": "markdown",
@ -35,29 +21,6 @@
"title": "3" "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", "direction": "horizontal",
"width": 307.5, "width": 307.5
"collapsed": true
}, },
"right": { "right": {
"id": "bc4b945ded1926e3", "id": "bc4b945ded1926e3",
@ -231,13 +193,13 @@
"companion:Toggle completion": false "companion:Toggle completion": false
} }
}, },
"active": "7dbc67ca2ef1097d", "active": "6bd7f2a6f353529e",
"lastOpenFiles": [ "lastOpenFiles": [
"Concurrent Systems/slides/class 3.pdf", "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/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", "Concurrent Systems/notes/1b - Peterson algorithm.md",
"HCIW/slides/Interface and Interaction for IoT.pdf", "HCIW/slides/Interface and Interaction for IoT.pdf",
"Pasted image 20250305182542.png", "Pasted image 20250305182542.png",

View file

@ -91,3 +91,19 @@ X.fetch&add(v) :=
return tmp 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