One case where I use a lock-free data structure is with high performance network communications in which the client app receives tremendous amounts of data. The app has a thread dedicated to receiving data and another thread dedicated to processing the data. It uses a fixed size lock-free circular buffer to hold the data. In terms of boost::lockfree, this would be akin to the fifo queue. Using a circular queue prevents memory allocations, but does limit the amount of stored data making it critical that the processing thread reasonably keep up. Having a lock-free data structure definitely helps with performance.
well, the performance characteristics really depend on the performance of the atomic operations, which is pretty hardware dependent. on some architectures, they are pretty slow and using blocking data structures can actually be faster. however the question is, what is `fast' and what is `slow': if when optimizing for latency, lock-free data structures will be better than their blocking equivalents.
I haven't looked at boost::lockfree yet, but I'm very curious to know how the fifo queue compares. Perhaps adding a circular queue version to lockfree would be beneficial. The implementation is fairly trivial. I don't even use atomic operations for it (at least on Windows). Although perhaps they may be needed for other platforms.
boost.lockfree provides a wait-free spsc ringbuffer [1], which is probably similar to the circular buffer, that you are using. however the implementation is not correct without memory barriers, if the cpu reorders stores. cheers, tim [1] http://tim.klingt.org/boost_lockfree/boost/lockfree/ringbuffer.html