Complete JVM learning notes please click here
The location of the JVM
Some of the JVM
- SUN Classic
- Exact VM
- HotSpot VM: HotSpot refers to HotSpot code detection technology
- BEA JRockit :(BEA has been acquired by Oracle) focuses on server applications, one of the fastest JVMS in the world
- IBM J9
- Taobao JVM: It has been launched on Taobao and Tmall, replacing Oracle’s official JVM;
- Graal VM: Oracle released in April 2018 under the slogan Run Programs Faster Anywhere. Most likely to replace HotSpot products
Android虚拟机 DVM
- Developed by Google and based on Android, JIT is available in 2.2
- It can only be called a virtual machine, not a Java virtual machine, because it does not follow the Java Virtual machine specification
- Register-based architecture, high efficiency, but with the hardware coupling degree is relatively high
- The class file cannot be executed directly. The dex file is executed
- 5.0 replaces Dalvik VM with ART VM that supports ahead of time compilation
.java source files are compiled by a front-end compiler (such as javac) into.class bytecode files that are interpreted and executed by a back-end compiler (Java Api, JVM)
Class loading: Load –> link –> initialize
Java code executes the process
Java programs — (compile) –> bytecode files — (explain execution) –> Operating system (Win, Linux, Mac JVM)
Instruction set architecture for stacks and instruction set architecture for registers
Due to the cross-platform design, Java instructions are designed according to the stack, different platforms CPU architecture is different, so it can not be designed as register-based stack: cross-platform, small instruction set, many instructions; Less execution than register Register: Fewer instructions
// View the command code of the instruction setcdOut /production/ class root javap -v StackStruTest. Class // Prints the process JPS executed by the programCopy the code
JVM life cycle
1. Start the
This is done by bootstrap Class Loader to create an initial class that is specified by the virtual machine’s concrete implementation.
2. Perform
- A running Java virtual machine has a clear task: execute Java programs;
- He runs when the program begins and stops when it ends;
- When a so-called Java program is executed, what is really being executed is a process called the Java Virtual Machine.
3. Quit
- The program completes normally
- The program terminates abnormally due to an exception or error
- An operating system error caused the termination
- A thread calls the Exit method of the Runtime class or the System class, or the HALT method of the Runtime class, and the Java security manager also allows the exit or HALT operation
- In addition, the JNI specification describes the Java Virtual machine exit when the Java Virtual machine is loaded or unloaded using the JNI Invocation API
JVM learning code and notes
【 code 】 github.com/willShuhuan… JVM_02 Class loading subsystem JVM_03 Run time data area 1- [program counter + vm stack + local method stack] JVM_04 Local method interface JVM_05 Run time data area 2- heap JVM_06 run time data area 3- Method area JVM_07 JVM_08 Execution Engine JVM_09 String constant pool StringTable JVM_10 Garbage Collection 1- Overview + Related algorithm JVM_11 Garbage Collection 2- Concepts related to garbage collection JVM_12 Garbage collection 3- Garbage collector