Synchronization hardware is a fundamental requirement for concurrent software. Ultimately, software depends upon strong guarantees for atomicity, which can only be provided by hardware. Fortunately, hardware can provide a simple but powerful programming interface to higher-level software using only a few synchronization primitives. These few primitives can support a surprisingly broad range of capabilities in software. Yet, even with hardware support to ensure functional correctness, there is an unavoidable performance overhead to pay for synchronization. In recent years, hardware designed to replace precise locking with speculative lock avoidance (e.g., lock-free programming) has begun to emerge. This chapter provides an in-depth look at the lowest level hardware/software interface for synchronization, along with explanations of how the underlying hardware ensures atomicity, and considerations related to weakly consistent memory models. This is complemented with a discussion of various lock avoidance techniques.
Jim Holt is a longtime contributor to the New Yorker -- where he has written on string theory, time, infinity, numbers, truth, and bullshit, among other subjects -- and the author of Stop Me If You've Heard This: A History and Philosophy of Jokes. He is also a frequent contributor to the New York Times and the London Review of Books. He lives in Greenwich Village.