San Francisco: Mutex from Scratch


Details
In this excerpt from Arthur's recent CppCon class (https://cppcon.org/the-standard-library-from-scratch/), we'll explore the implementation of concurrency primitives. We'll cover topics from the one proper use of "volatile" (yes, there is one!), to atomic compare-and-swap, to the difference between a spinlock and a mutex, to the three concurrency-primitive objects provided by Standard C++, to how the standard library is able to execute user-defined code "on thread exit."
On the practical side, we'll introduce Linux futexes (https://www.akkadia.org/drepper/futex.pdf) and use them to implement std::mutex. On the theoretical side, we'll discuss what it means to "sleep" (and what happens if two components of the same program disagree about its meaning!).
Arthur O'Dwyer worked for many years at Green Hills Software, making the world's most optimizing C and C++ compilers. Now he works at Nominum in San Francisco. Regular attendees will know him as the showrunner of this very meetup! His book "Mastering the C++17 STL (https://www.packtpub.com/application-development/mastering-c17-stl)" was published in September.

Sponsors
San Francisco: Mutex from Scratch