Java Virtual Machine (JVM), JDK and JRE

JVM architecture

How the JVM works:

Class loader : The class loader reads the .class file and saves the bytecode in the method area .

Method area : There is only one method area in the JVM, which is shared among all classes. It saves the class level information of each .class file (class bytecode).

Heap : The heap is a part of the allocated objects in the JVM memory. The JVM creates a Class object for each .class file.

Stack : The stack is also part of the JVM memory, but unlike the heap, the stack is used to store temporary variables .

PC register : track the instructions that have been executed and the instructions that will be executed. Since instructions are executed by threads, each thread has a separate PC register.

Native method stack: Native methods can access the runtime data area of ​​the virtual machine.

Native method interface : It allows Java code to call or be called by native applications. Native applications are programs specific to the system hardware and OS.

Garbage collection : A class instance is explicitly created by Java code. After use, garbage collection will automatically destroy the instance for memory management.

JVM and JRE and JDK

JRE: JRE is the environment in which the Java virtual machine runs. The JRE contains the Java Virtual Machine (JVM), class libraries, and other files , except for development tools (such as compilers and debuggers).
Run code in JRE, but you cannot develop and compile code in JRE.

JVM: As mentioned above, JVM runs programs by using the classes, libraries and files provided by JRE.

JAR: Classes, libraries and files provided by JRE. Generally, we also refer to the packaged jar package when we develop the project. Just call it directly.

JDK: JDK is a superset of JRE. It contains all the content of JRE and development tools (such as compilers, debuggers, etc.).

So you can write java, hahahaha.

Reference link: https://beginnersbook.com/2013/05/jvm/

Guess you like

Origin blog.csdn.net/Candyys/article/details/108130143