Memory modelhard3-5 years

What is the Java Memory Model, and what does happens-before guarantee?

The JMM defines when one thread's writes are visible to another. Without a happens-before edge, a thread may never see another thread's write — CPU caches, JIT hoisting and CPU reordering all make that legal. Edges: monitor unlock→lock, volatile write→read, Thread.start, join, executor submission, concurrent collections, and final fields at end of construction. It is transitive.

The lesson behind it →
More on Memory model