diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 7c911f6..3cf84b5 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -36,7 +36,7 @@ "file": "Concurrent Systems/slides/class 3.pdf", "page": 7, "left": -27, - "top": 562, + "top": 250, "zoom": 0.5754156769596199 }, "icon": "lucide-file-text", diff --git a/Concurrent Systems/notes/3.md b/Concurrent Systems/notes/3.md index 50990ad..de19a4d 100644 --- a/Concurrent Systems/notes/3.md +++ b/Concurrent Systems/notes/3.md @@ -115,5 +115,22 @@ A **MRSW Safe register** is a register that provides READ and WRITE such that: 2. a READ that overlaps with a WRITE can return **any possible value** (of the register domain). A **MRMW Safe register** behaves like a MRSW safe register, when WRITE operations do not overlap. Otherwise, in case of overlapping WRITEs, the register can contain any value (of the register domain). +*(Ci sta comunque lo stesso problema)* -This is the weakest type of register that is useful in concurrency. \ No newline at end of file +> Si chiama safe nel senso che se ci sono letture overlapping siamo safe. Ma รจ letteralmente l'unica cosa safe che abbiamo! + +This is the weakest type of register that is useful in concurrency. + +### Bakery Algorithm +**The idea is that** +- every process gets a ticket +- because we don't have atomicity, tickets may be not unique +- tickets can be made unique by pairing them with the process ID +- the smallest ticket (seen as a pair) grants the access to the CS + +``` +Initialize FLAG[i] to down and MY_TURN[i] to 0, for all i + +lock(i) := + FLAG[i] <- up + MY_TURN[i] <- M \ No newline at end of file