Get the latest tech news

Programming Language Memory Models (2021)


, Part 2) Posted on Tuesday, July 6, 2021. PDF Programming language memory models answer the question of what behaviors parallel programs can rely on to share memory between their threads.

Compilers often reorder program reads and writes based on optimization heuristics or even just the way hash tables or other intermediate data structures end up being traversed while generating code. In general, modern languages guarantee that data-race-free programs always execute in a sequentially consistent way, as if the operations from the different threads were interleaved, arbitrarily but without reordering, onto a single processor. Java defines that all lock, unlock, and volatile variable accesses behave as if they ocurred in some sequentially consistent interleaving, giving a total order over all those operations in the entire program.

Get the Android app

Or read this on Hacker News