The Java Memory Model is not a diagram of the heap and stack. It is the contract that decides what one thread is legally allowed to observe from another thread despite CPU caches, compiler optimisation, instruction reordering and concurrent execution. This visual follows the complete reasoning path: 1 Java Code + Threads Your source code has program order, but the compiler, JIT and CPU can internally reorder operations as long as observable behaviour remains legal. 2 Per-Thread Execu...