
20 Sep
2006
20 Sep
'06
11:16 a.m.
Anthony Williams wrote: [...]
bias. We could just do a spin-wait if we want really-fast locks and unlocks --- except that for long-lasting locks, a waiting thread would consume CPU time spinning, and hence hinder the progress of other threads.
Right. So we need to block/unblock. But there's no need for ownership handoff. So let unblocked thread compete just like in the case of a spinlock. Or rather think of block/unblock logic in efficient lock as just a spinlock with "usleep(magic());" resulting in exact right time to sleep until the lock is released by the owner. Okay? ;-) regards, alexander.