Boost logo

Boost :

From: Tim Blechmann (tim_at_[hidden])
Date: 2008-04-18 04:58:08


> Thanks.. Although, it seems as though I still don't totally understand
> the algorithm correctly myself... This was my first attempt at lock-free
> programming, so all of this is still quite new to me. I had thought
> that the use of CAS operations is all that was required. Do you have a
> suggestion for how I could add this missing piece, or perhaps some
> references for me to read?

well, most publication of algorithms assume a sequential memory model ...
if the machine is using another memory model, memory barriers have to be
placed ...

on the x86/x86_64 architectures the cmpxchg instructions act as a memory
barrier, but depending on the algorithm, some additional barriers need to
be placed ...

in my implementation of the ms-queue, i am using several barriers
(possibly more than required by the algorithm), however it is working
pretty well on multi-processor machines ...
http://tim.klingt.org/git?p=nova.git;a=blob;f=libs/lockfree/fifo.hpp

cheers, tim

-- 
tim_at_[hidden]
http://tim.klingt.org
Just what the hell is the experimental tradition?
  Morton Feldman

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk