Some light reading on lock-free programming


Today is a holiday in the United States, so I'm going to celebrate by referring you to other things to read.

I'm going to start with a presentation by Bruce Dawson at GDC 2009, which is basically multiple instances of the question "Is this code correct?", and the answer is always "No!" Although the title of the talk is Lockless Programming in Games, the information is relevant to pretty much everybody. I can't find a recording of the presentation, but you can download the PowerPoint slides or view them in your browser. But I recommend downloading the PowerPoint slides and reading the notes, because the notes explain the slides. [Update: Ah, you can see the notes in the browser by clicking the Notes button at the bottom. So download whichever you prefer. Just make sure you read the notes.]

A more game-focused presentation by Bruce Dawson has the more general title Coding for Multiple Cores. Download the PowerPoint sides or view them in your browser.

Then there is the MSDN white paper that he authored, Lockless Programming Considerations for Xbox 360 and Microsoft Windows.

Finally, there's Herb Sutter's two-part talk atomic<> Weapons, part 1 and part 2.

That should keep you busy for a while.

Comments (8)
  1. Damien says:

    I'm being blocked by my works firewall from downloading the first PPT - which you advise because it has the notes. Are those notes more comprehensive than the ones you obtain by using the second link and clicking "notes" in the bottom status bar (most of the way towards the right hand side)?

  2. Oradim says:

    @Damien I've just downloaded the presentation from the first link and, at least for the initial slides, the notes are the same as those presented in the second link.

  3. Darkstar says:

    There's a cool patent by NetApp (US8578386) that describes lockless programming using so-called "domains" to distribute the workload. It's a simple yet effective way of doing lockless programming. Too bad it's patented

  4. Bob says:

    I like Cliff Click's technique of modelling lock free algorithms as a state machine which makes reasoning and proofs significantly easier (but still difficult). Here is a presentation of him describing a lock free hash table:

    http://www.youtube.com/watch

  5. Mark VY says:

    Is it possible to read the notes if you have only Powerpoint Viewer, as opposed to the full thing?

  6. Bruce Dawson says:

    Author here. Thanks for the shout out for those talks. I enjoyed creating them. At the time there was the genuine complexity of lock-free programming, combined with the (significant) accidental complexity created by the lack of portable support for lock-free programming, together with some messy decisions made in the Xbox 360 software.

    But, things have improved. For more up-to-date discussions of lock-free strategies, including the C++ 11 constructs that support it, I strongly recommend visiting this site:

    http://preshing.com/

    If you use C++ 11 atomics then you only have the genuine complexity of lock-free programming. This is still significant enough that most people should never write lock-free code.

  7. cheong00 says:

    @Darkstar: I think what is described in the first point of that patent is the same as basic concept of functional programming... why would such a patent be granted?

  8. Frank Boyne says:

    More recent Herb Sutter sessions on lock-free programming from CppCon 2014:

    Lock-Free Programming (or, Juggling Razor Blades), Part I

    search.channel9.msdn.com/.../result

    Lock-Free Programming (or, Juggling Razor Blades), Part II

    search.channel9.msdn.com/.../result

    The CppCon 2014 sessions are also available on YouTube - which is handy for viewing on e.g. TiVo

Comments are closed.

Skip to main content