vault backup: 2025-03-03 10:21:24

This commit is contained in:
Marco Realacci 2025-03-03 10:21:24 +01:00
parent 8a1b6e749c
commit 8fa222cf5f

View file

@ -181,4 +181,15 @@ b) `AFTER_YOU = 1`, this is possible only with the following interleaving:
- It is possible tho that p1 locks again: - It is possible tho that p1 locks again:
- if p0 reads `F[1]` before p1 locks, then p0 wins (waiting 1) - if p0 reads `F[1]` before p1 locks, then p0 wins (waiting 1)
- otherwise p1 sets A_Y to 1 and suspends in its wait (`F[0] = up AND A_Y = 1`), p0 will eventually rea - otherwise p1 sets A_Y to 1 and suspends in its wait (`F[0] = up AND A_Y = 1`), p0 will eventually read `F[1]` and win (waiting 1).
### Peterson algorithm ($n$ processes)
- FLAG now has $n$ levels (from 0 to n-1)
- level 0 means down
- level >0 means inv
- Every level has its own AFTER_YOU
```
Initialize FLAG[i] to 0, for all i
lock