Loading…
This event has ended. View the official site or create your own event → Check it out
This event has ended. Create your own
View analytic
Wednesday, September 21 • 3:15pm - 4:15pm
Using weakly ordered C++ atomics correctly

Log in to save this to your schedule and see who's attending!

Most programmers should usually avoid C++ atomics altogether and use mutexes instead. If that's not possible, perhaps because the code must be usable in interrupt handlers, I recommend that you consider limiting yourself to sequentially consistent atomics, which provide a more subtle, but still reasonably unsurprising programming model. This talk will target those who choose to ignore both of those pieces of advice, for either good or bad reasons.

I will start by trying to distinguish the good and bad reasons for using weakly ordered atomics, and then follow with guidelines for using them correctly.

I will discuss why it is often incorrect to think of atomics in terms of fence-based implementations, and about some common errors I've seen, including some really convincing looking, but still incorrect, code. I will also try to go through some of the common idioms for which weakly ordered atomics are actually safe. In my experience, the latter are also reasonably common, but not always easy to distinguish from the subtly erroneous examples.

Speakers
avatar for Hans Boehm

Hans Boehm

Google
Hans is the WG21 SG1 (Concurrency) Chair, and co-led the design of the C++ memory model and atomic operations. He now mostly works on concurrency-related issues in Android, and occasionally on teaching calculators to calculate correctly. In the past, he mostly focused on garbage collection. He is the original primary author of bdwgc, a conservative garbage collector for C and C++. http://hboehm.info



Wednesday September 21, 2016 3:15pm - 4:15pm
Bowie Hall (1st Floor Hall) Meydenbauer Center