Boost logo

Boost :

Subject: Re: [boost] [fiber] new version in vault
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2009-12-01 06:38:22

Helge Bahmann <hcb_at_[hidden]> writes:

> On Mon, 30 Nov 2009, Phil Endecott wrote:
>> My work on this was backed up with extensive benchmarking,
>> disassembly of the generated code, and other evaluation. You can
>> find some of the results in the list archive from about two years
>> ago. There are many different types of system with different
>> characteristics (uniprocessor vs multiprocessor, two threads vs
>> 10000 threads, etc etc). Two particular cases that I'll mention
>> are:
> I guess this is the code you used for testing?
> I would say that your conclusions are valid for ARM only (I don't know
> the architecture or libc peculiarities), for x86 there are some
> subtleties which IMHO invalidate the comparison.
> Your spinlock implementation defers to __sync_lock_test_and_set, which
> in turn generates an "xchgl" instruction, and NOT an "lock xchgl"
> instruction (yes, these gcc primitives are tricky which is why I avoid
> them).

On x86 these are equivalent --- the LOCK prefix is automatically
asserted for XCHG. See the XCHG instruction docs in the Intel manual
volumne 2B.


Author of C++ Concurrency in Action
just::thread C++0x thread library   
Just Software Solutions Ltd
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

Boost list run by bdawes at, gregod at, cpdaniel at, john at