On Wed, 21 Jan 2009 02:29:01 -0000, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:
"Rhodri James" <rho...@wildebst.demon.co.uk> writes:
> What cpu's do you know of that can atomically increment and decrement
> integers without locking?
x86 (and pretty much any 8080 derivative, come to think of it).
It would not have occurred to me that "lock inc" increments "without
locking". I understand that's different from a lock value sitting in
the data object but I thought that "lock-free algorithm" meant one
that didn't assert any of these hardware locks either. Maybe I'm
wrong.
I tend to live in single-core worlds, so "inc" on its lonesome works
just fine.
Just do the locking properly and worry about optimisations later.
That has already been tried, and found to be unacceptably slow for the
purpose at hand. Now we're looking for the optimizations.
In that case I'd second the suggestion of taking a long, hard look
at the Linux core locking and synchronisation primatives.
--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list