One of the most frequently posed Java thread interview questions, be ready for it.   The Java memory model is part of the Java language definition described in Chapter 17. It determines how several threads use shared memory in a concurrent Java application and how data changes made by one thread are visible to other threads. Although JMM is quite short and concise, it can be difficult to understand without a strong mathematical background. The need for a memory model is because the way your Java code accesses data doesn't happen at lower levels. The Java compiler, the JIT compiler, and even the CPU can rearrange or optimize memory writes and reads as long as the observable result of those reads and writes is the same.