xv6: sh.c
it would panic on the same cpu or block on another cpu
double acquired lock
it relates to frequency
Why does release()
clear lk->pcs[0]
and lk->cpu
before clearing lk->locked
? Why not wait until after?
Ans: if lk->locked
reset first in cpu A, at the same time if another cpu call acquire
and get the lock in cpu B, then value of lk->pcs; lk->cpu;
may be overrided by in A