Discussing volatile and the Java Memory Model (JMM)
Before discussing volatile we need to understand JMM (Java Memory Model) first. Jumping straight to volatile without JMM feels odd, so let's cover JMM. To guarantee correctness of shared memory (visibility, ordering, atomicity), the memory model defines the rules for read/write behavior in multithreaded programs on shared memory systems.









