From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-03-26 10:07:21
Yuval Ronen wrote:
> One overhead I can think of is the need to call CloseHandle after the
> WaitForSingleObject, which means another OS call (kernel?). This
> doesn't exist on pthreads where calling pthread_join is enough.
The overhead in this case is not measured in cycles or kernel transitions
(remember that you called a blocking function because you have nothing
better to do with the CPU). It's measured in kernel objects; these come from
the nonpaged pool and are a (relatively) limited resource. Since (today) a
cv under Windows is usually ~3 kernel objects, a mutex one more, adding a
mutex+cv to every thread increases its kernel footprint five times.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk