[LAD] a *simple* ring buffer, comments pls?

Tim Blechmann tim at klingt.org
Wed Jul 13 09:09:16 UTC 2011


>> no one can write a test case which fails when
>> memory barriers are missing in a ringbuffer implementation.
> 
> That's an interesting assertion.  It's kind of tempting to write some
> buggy circular buffers and test that assumption on common hardware.

in fact, testing is not the best approach for verifying lock-free data 
structures: an implementation may work for years, if a certain condition is 
never triggered. the only reasonable way to ensure the correctness is a formal 
proof. unfortunately, most publications assume a sequencially consistent memory 
model and sometimes even avoid dealing with the ABA problem.

fortunately the atomics of c++0x/c1x will make it much clearer (and more robust 
as the memory order argument to the atomic functions defaults to sequencial 
consistency)

cheers, tim





More information about the Linux-audio-dev mailing list