|
|
|
|
|
by acallan
4169 days ago
|
|
The author is incorrect in the section about memory fences. x86 has strong memory ordering [1], which means that writes always appear in program order with respect to other cores. Use a memory fence to guarantee that reads and writes are memory bus visible. The example that the author gives does not apply to x86. [1]There are memory types that do not have strong memory ordering, and if you use non-temporal instructions for streaming SIMD, SFENCE/LFENCE/MFENCE are useful. |
|
http://bartoszmilewski.com/2008/11/05/who-ordered-memory-fen...
http://preshing.com/20120515/memory-reordering-caught-in-the...
This whole area is very touchy and easy to get wrong. Further reading:
https://software.intel.com/en-us/articles/tsx-anti-patterns-...