|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2008-02-08 17:36:21
On Feb 8, 2008, at 5:31 PM, Howard Hinnant wrote:
> On Feb 8, 2008, at 5:22 PM, Peter Dimov wrote:
>
>>> Howard Hinnant:
>>>
>>>> Here are results (dating around 3 years ago):
>>>>
>>>> In order: 63 seconds.
>>>> try/back off/without yield: 47 seconds.
>>>> try/back off/with yield: 34 seconds.
>>>
>>> With Alexander Terekhov's "swap-based mutex", I'm not seeing a
>>> significant
>>> difference between the versions with and without yield. The penalty
>>> likely
>>> comes from spin-waits in lock() (which is why they're evil).
>>
>> There's no significant difference with critical sections, too. Maybe
>> I'm
>> doing something wrong. :-)
>
> Or this could be a manifestation of the fact that I never really had
> "hands on" tests with Windows. I have observed that if the contention
> isn't high, then the algorithm doesn't matter. Does your test have
> the threads sleeping or otherwise doing independent work? In mine the
> threads did nothing but fight over the locks.
Oh, also note that my single-core results were only 5% apart
(comparing lock in order to try/backoff/yield). Are you running on
single core?
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk