From: Andrew J Bromage (ajb_at_[hidden])
Date: 2002-08-08 19:13:19
On Thu, Aug 08, 2002 at 02:31:34PM +0300, Peter Dimov wrote:
> The system call is important - if it prevents inlining. Most of the
> remaining overhead is caused by the memory synchronization, and there is no
> way to avoid it. Even an atomic_counter must synchronize memory in order to
> be useful.
That's true on some platforms but not on others. For example, GCC has
the "volatile asm" construct which prevents code reordering.
Also, on some architectures, all memory accesses are synchronised
(definitely IA-32, and from memory I think 32-bit SPARCs might be too,
but don't sue me if that's not true), so all it would cost is the SMP
lock. Oh, and the cost of optimisations which can't be performed due
to code reordering.
For the record, once again, I don't claim that an operation like this
would be a win everywhere. It is at worst no better and at best an
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk