Get the latest tech news

Making Sense of Acquire-Release Semantics


February 2023 Multiprocessor Synchronization was one of my favorite classes during my undergrad — it had a clear progression from theory to practice, starting at the theory of consensus numbers and moving onto atomic operations and then synchronization primitives and lock-free data structures, all from first principles. With careful thought and a little intuition-bending, every problem could be stated clearly and solved in a neat, orderly way … in Java.

So far the CPU has come up with two different ways to break our code, and both were the kinds of subtle, impossible-to-repro problems that can slip through review and testing and then run roughshod through production. Past this point, the consumer can pick up the item off the queue at any time, so we need to be certain this thread isn’t still running code that might be using the shared memory, in this method or in the calling context. This puts us in a kind of funny situation: according to the stdatomic docs, and the C++ spec, our original queue is technically wrong, but on some pretty popular CPUs, it’ll work just fine anyways.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of sense

sense

Photo of Release Semantics

Release Semantics

Related news:

News photo

Audio brand Moondrop just launched a $399 Android phone with 3.5mm and 4.4mm ports

News photo

Samsung tells its executives to work a 6-day week to 'inject a sense of crisis'

News photo

Industrial robots make people feel worse about jobs and themselves | Study finds workers' sense of meaningfulness and autonomy declines with automation