10 Memory Models and Lock Freedom

OVER THE PAST SEVERAL chapters, we’ve seen how threads communicate with one another, often with nothing but reads from (loads) and writes to (stores) shared memory locations. We also saw that synchronization is necessary to prevent data races when doing so. All of this discussion has been oversimplified. There are forms of interthread loads and stores that can be done without heavy-handed, critical-region style synchronization. Doing this right often requires a deep understanding of your compiler and hardware architecture, specifically the atomicity and ordering guarantees made with respect to load and stores. With such an understanding, code can be written to avoid some overhead and to improve scalability ...

Get Concurrent Programming on Windows now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.