Can any of you advise a good test case that would demonstrate memory
barriers are needed in a lock-free ring buffer ? I mean: a piece of
code that would fail because memory barriers are missing.
I wrote the following test, and it succeeds on PowerPC SMP (dual IBM
Cell system QS-20), which is supposed to have weak memory ordering:
http://svn.samalyse.com/misc/rbtest/test-int-array.c
It is part of a (4 implementations) ring buffer test suite, that one
can run with:
svn co http://svn.samalyse.com/misc/rbtest
cd rbtest
make test
Best regards,
--
Olivier Guilyardi / Samalyse