Check out the new USENIX Web site. next up previous
Next: Modifications to the unlock Up: Improved Thin Locks Previous: Improved Thin Locks

Modifications to the lock operation

The lock operation is only modified in the case of contention on a thin lock.

When a thread $x_t$ fails to acquire a thin lock on object $z_o$ due to contention (because thread $y_t$ already owns the thin lock), then (1) thread $x_t$ acquires the contention lock of the owning thread ($y_t$), and (2) sets the contention bit of thread $y_t$, then (3) checks that the lock of object $z_o$ is still thin and owned by thread $y_t$. If the check fails, (4a) the contention bit is restored to its initial value, the contention lock is released and the lock operation is repeated. If the check succeeds, (4b) the tuple ($x_t$, $z_o$) is added to the linked list of thread $y_t$, then thread $x_t$ is put in the waiting state (temporarily releasing the contention lock of thread $y_t$, while it sleeps). Later, when thread $x_t$ wakes up (because it was signaled), it releases the re-acquired contention lock and repeats the lock operation.



2001-02-27