I. Eraser
lock(a)
y := x + 1
lock(b)
z := y + 1
y := x + 1
unlock(a)
unlock(b)
lock(b)
lock(a)
y := x - 1
unlock(b)
z := z + 1
unlock(a)
What will the lockset algorithm conclude about how x, y and z are protected? Will it report one or more races? If not, explain why not. If so, explain what they will be and why they will be reported.
"One issue we have not yet addressed is that a user-level thread could be executing in a critical section at the instant when it is blocked or preempted...[a] possible ill effect ... [is] deadlock (e.g., the preempted thread could be holding a lock on the user-level thread ready list; if so, deadlock would occur if the upcall attempted to place the preempted thread onto the ready list)." (p. 102)
III. LFS
(For the purposes of the following questions, NVRAM is persistent
storage (i.e., will survive the loss of power) and has access times
and throughput similar to DRAM.)