IT lexicon › Programming › Memory model

Memory model

Programming På svenska → Updated: 2026-11-15

The set of guarantees a processor makes about the order in which changes to shared memory become visible across threads, affecting both correctness and performance of concurrent software.

A memory model defines what you're allowed to assume about how changes written by one thread become visible to another thread. Without these rules, identical code could produce different results depending on the CPU's and compiler's optimizations. There are two extremes: a strong model guarantees that all reads see the most recently written value (Sequential Consistency), and a weak model permits changes to become visible at different times, relying on explicit synchronization via locks or barriers to restore order.

Languages like Java, C++, and Rust now define formal memory models. The Java Memory Model (finalized 2005) was a turning point — it was the first to completely specify when writes from one thread become visible to another, ending an era where each JVM implementation could have its own semantics.

← Back to the lexicon