vault backup: 2025-03-10 23:32:52

This commit is contained in:
Marco Realacci 2025-03-10 23:32:52 +01:00
parent 668da058ec
commit 367d22ad37
3 changed files with 20 additions and 13 deletions

3
.obsidian/app.json vendored
View file

@ -0,0 +1,3 @@
{
"alwaysUpdateLinks": true
}

View file

@ -42,16 +42,17 @@
"type": "pdf",
"state": {
"file": "Concurrent Systems/slides/class 3.pdf",
"page": 17,
"page": 16,
"left": -16,
"top": 596,
"top": 11,
"zoom": 0.9236935866983375
},
"icon": "lucide-file-text",
"title": "class 3"
}
}
]
],
"currentTab": 1
}
],
"direction": "vertical"
@ -223,11 +224,11 @@
"companion:Toggle completion": false
}
},
"active": "6edd4157a160e462",
"active": "dd6c003f9d17b0e9",
"lastOpenFiles": [
"Concurrent Systems/notes/3b - Aravind's algorithm and improvements.md",
"Concurrent Systems/slides/class 3.pdf",
"Concurrent Systems/notes/3a - Hardware primitives & Lamport Bakery algorithm.md",
"Concurrent Systems/notes/3b - Aravind's algorithm and improvements.md",
"Concurrent Systems/notes/1 - CS Basics.md",
"Concurrent Systems/notes/2b - Round Robin algorithm.md",
"Concurrent Systems/notes/2 - Fast mutex by Lamport.md",

View file

@ -91,11 +91,14 @@ lock(i) :=
until foreach j != i, STAGE[j] = 0
```
- $p_n$ invokes lock alone, completes its CS and so `DATE[n] = n`
- then as DATE is either set to n or decreased, for each i, `DATE[i] < n`
- *scenario 1*: every other $p_i$ keep invoking lock again immediately after the unlock
- every time some process exits the CS, `DATE[n]` is decreased
- after $n-1$ turns, `DATE[n]` will have `DATE[n] = 1`, with every other `DATE[i] > 1, i!=n` -> ️✅
- *scenario 2*: not every process invokes the lock
- eventually, more than one process will have its DATE set to 0
- but there will still be at most $n-1$ processes $p_i$ with `DATE[i] < DATE[n]`, this ensures that after $n-1$ steps, every other process $p_i$ will have `DATE[i] > DATE[n]` -> ✅
(a causa di un bug di Obsidian, se non vedi la dimostrazione)
>[!question]- mostra mia soluzione
>- $p_n$ invokes lock alone, completes its CS and so `DATE[n] = n`
>- then as DATE is either set to n or decreased, for each i, `DATE[i] < n`
>- *scenario 1*: every other $p_i$ keep invoking lock again immediately after the unlock
> - every time some process exits the CS, `DATE[n]` is decreased
> - after $n-1$ turns, `DATE[n]` will have `DATE[n] = 1`, with every other `DATE[i] > 1, i!=n` -> ️✅
>- *scenario 2*: not every process invokes the lock
> - eventually, more than one process will have its DATE set to 0
> - but there will still be at most $n-1$ processes $p_i$ with `DATE[i] < DATE[n]`
> - this ensures that after $n-1$ steps, every other process $p_i$ will have `DATE[i] > DATE[n]` -> ✅