Lock-Free Algorithms For Ultimate Performance
infoq.com
infoq.com
1) Keep head and tail pointers local to the consumer and producer.
2) Associate a bit with each entry in the queue which denotes whether the entry is full or not. The bit must live within the same cache line as the entry itself.
3) Block on this bit, rather than head & tail pointers.
4) Set an entry's bit after filling the entry; clear it before.
5) You can now elide the memory fence (implicit in the .lazySet() method of the atomic objects). Performance will skyrocket.
4.9 TRB Ring: http://www.intel.com/content/www/us/en/io/universal-serial-b...
What was most interesting to me was the actual performance figures and the small optimizations that yield big improvements.