3 ms·
Herb Sutter is one of the premier C++ experts, and his talk here about Atomics in the C++11 specification really made things "click" for me. In this talk (roug
by dragontamer 9y ago
Herb Sutter is one of the premier C++ experts, and his talk here about Atomics in the C++11 specification really made things "click" for me.
In this talk (roughly 2.5 hours if you include "Part 2" found here: https://channel9.msdn.com/Shows/Going+Deep/Cpp-and-Beyond-2012-Herb-Sutter-atomic-Weapons-2-of-2 https://channel9.msdn.com/Shows/Going+Deep/Cpp-and-Beyond-20...), Herb Sutter discusses the reasons why Atomics exist, and more importantly, why "Relaxed Atomics" are different than "Sequentially Consistent Atomics".
Throughout the talk, there are plenty of simple examples that discuss the necessity of "Sequentially Consistent Atomics" (aka: Volatile in Java / C#). There are also a few examples in "Part 2" which demonstrate a performance boost on Arm V7 / PowerPC when you use "Relaxed" Atomics.
Overall, if anyone wants to understand why the C++11 Memory Model was designed this way, as well as how to use the tools given to us by the C++11 language designers (which happens to be nearly identical to the Java and C# Memory Models to boot), this talk is amazing.