|
Boost : |
From: William Kempf (sirwillard_at_[hidden])
Date: 2000-09-14 09:57:39
--- In boost_at_[hidden], Levente Farkas <lfarkas_at_m...> wrote:
> mesaure on a 733Mhz PIII win2000 the result:
> Testing Boost mutex...
> 731
> Testing Win32 critical section...
> 70
> Testing Win32 mutex...
> 15762
Thanks for the timings.
> so in win2000 it's realy faster than mutex, although I not realy
belive
> that we can (or have to) reimplement OS specific code if it's slow
than
> it's the os implementor's task to make it better.
> I know it's just a reference implementation:-)
The OS can't "fix the problem" in this case, because a mutex is a
Kernel level object. This is why so many Win32 developers resort to
using critical sections instead of mutexes when ever they possibly
can. However, critical sections don't support try or timed locks, so
are poor choices for the sample library implementation. So I made a
concerted effort to find a compromise in speed/functionality that
would give the library the best of both worlds. It's either that or
provid yet another Mutex variation on Win32 that's got limited
functionality but is fast, based on the critical section. With out a
fast mutex, Win32 programmers are unlikely to use the Boost library.
Since the faster semaphore/mutex were trivial to implement using well
known techniques (there are 2 MSDN articles using this techique) I
think it's more than appropriate that we do so for our Win32
implementation.
Bill Kempf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk