vault backup: 2025-03-04 09:14:45

This commit is contained in:
Marco Realacci 2025-03-04 09:14:45 +01:00
parent d49c23ade6
commit 2941b894b0

View file

@ -82,10 +82,9 @@ esercizio: prova che NON soddisfa starvation freedom
#### From deadlock freedom to bounded bypass #### From deadlock freedom to bounded bypass
-> Round Robin algorithm -> Round Robin algorithm
Let DLF be any deadlock free protocol for MUTEX. Let's see how we can make it starvation free: Let DLF be any deadlock free protocol for MUTEX. Let's see how we can make it satisfy bounded bypass:
``` ```
metti algoritmo qui
lock(i) := lock(i) :=
FLAG[i] <- up FLAG[i] <- up
wait (TURN = i OR FLAG[TURN] = down) wait (TURN = i OR FLAG[TURN] = down)
@ -94,7 +93,11 @@ lock(i) :=
unlock(i) := unlock(i) :=
FLAG[i] <- down FLAG[i] <- down
if FLAG if FLAG[TURN] = down then
TURN <- (TURN + 1) mod n
DLF.unlock(i)
return
``` ```