Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-09-07 08:00:12


--- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
> From: "William Kempf" <williamkempf_at_h...>
> > From: "Peter Dimov" <pdimov_at_m...>
> > >BTW why doesn't boost::mutex use a critical section on win32?
> >
> > To avoid having to either include the windows headers in
mutex.hpp or
> > require dynamic allocation internally. During development I was
provided
> > with research that showed that critical sections often actually
result in
> > worse performance than mutexes (surprised me), so it was easier
just to
> > implement using a Win32 mutex.
>
> Yes, I see the point now. However this will be, I think,
unacceptable to the
> performance freak types, who will gladly pay the price of #include
> <windows.h> (because they are likely to need it anyway) in return
for the
> increased performance.

Actually, there's other alternatives that will give us the best of
both worlds (check out the OPTEX example in the MSDN). This
implementation is much more difficult, though, so I've initially
avoided it.

> I'll be interested in your research. MS people that know the
details claim
> that a critical section is incredibly optimized and should beat a
mutex in
> any reasonable scenario.

It wasn't my research. It was research that Alexander Terekhov
(spelled from memory, sorry if I buthered it) found on the net. At
some point I'll find the time to find the link and post it here for
everyone to check out. The findings surprised me greatly, because
I've read the MS claims and seen several instances where the
performance boost of critical sections was easily observable.
 
Bill Kempf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk