From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-09-20 07:25:37
Anthony Williams wrote:
> Yes, there's overhead in a semaphore wait, but it's not pointless ---
> it allows the OS to schedule the threads appropriately. If you have
> contention, both threads have to do the same thing, otherwise you've
> added an implicit bias.
Bias in favor of the currently running thread is good as it improves
> We could just do a spin-wait if we want
> really-fast locks and unlocks ---
Spin-wait can also be slower; it just burns CPU instead of giving it to a
thread that could have done something with it. The performance of the
individual thread may look like an improvement, but the total time for the
task can still increase.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk