In the previous articles, the system learned the next JVM memory structure, Java memory model, Java object model, but found themselves or the three concepts and differences are more vague, silly points unclear. So there is this article, this article is mainly on these three technical points to make a summary and distinguish, deepen the impression.
JVM Memory Structure
The JVM runtime memory area structure is described in the Java Virtual Machine specification (Java SE 8) as follows:
In other words, the JVM memory structure is defined by the Java Virtual Machine specification, which describes the different data regions managed by the JVM during the execution of the Java program.
Java memory model
First, we know that Java multithreading is through shared memory communication, and because of the use of shared memory for communication, in the communication process there will be a series of issues such as visibility, atomicity, sequencing, and JMM (Java Memory Model) is a model built around multi-threaded communication and a series of features associated with it. It's just an abstract concept. JMM defines some syntax sets that map to the Java language, which are keywords such as volatile, synchronized, and so on.
Java Object Model
Java is an object-oriented language, and Java objects are stored in the JVM with a certain structure. The storage model for the Java object itself is called the Java object model.
In the hotspot virtual machine, a Oop-klass Model is designed. OOP (Ordinary object Pointer) refers to a normal object pointer, and Klass is used to describe the specific type of an object instance.
As shown, the Oop-klass model of a simple Java object, the Java object model.
Summary
Finally, let's make a simple distinction between the three concepts. The JVM memory structure is related to the runtime region of the Java Virtual machine. Java memory model, related to concurrency programming in Java. The Java object model is related to the representation of Java objects in virtual machines.
Resources
JVM Memory Architecture vs Java memory model vs Java object model
JVM Memory Architecture vs Java memory model vs Java object model