In-depth understanding of the JVM virtual machine Chapter 1 into java

Foreword:

The system introduces the technology system, development history, virtual machine family of Java, and the method of compiling JDK by yourself.

1. Java technology system
  • JDK : The three parts of Java programming language, Java virtual machine, and java class library are collectively referred to as JDK (Java Development Kit), which is the smallest environment used to support the development of Java programs.

  • JRE : The Java SE API subset and the Java virtual machine in the Java type API are collectively referred to as JRE (Java Runtime Environment), which is a standard environment that supports the running of Java programs.

2. Java virtual machine family (compile once, run everywhere)
  • Classic VM : "The world's first commercial Java virtual machine", this virtual machine can only use a pure interpreter to execute Java code. If the just-in-time compiler is plugged in, the just-in-time compiler will completely take over the execution system of the virtual machine, and the interpreter will no longer work.

  • Exact VM : Named because it uses EXact Memory Management, Exact VM can abandon the previous Handle-based object search method of Classic VM.

  • HotSpot VM : Inheriting the advantages of Classic VM and Exact VM (such as accurate memory management), it also has its own new technology, hot code detection technology, etc. (PS: The hot code detection capability can find the most valuable code for compilation through the execution counter. If a method is called frequently, or there are many effective loops in the method, it will trigger standard just-in-time compilation and on-stack replacement compilation behaviors respectively)

  • JRockit VM : A virtual machine that is highly optimized for server hardware and server-side application scenarios. It can pay less attention to the startup speed of the program. Therefore, JRockit does not include an interpreter implementation, and all codes are executed after being compiled by a just-in-time compiler.

  • IBM J9 VM : IBM J9 is still very active to this day, and the separation of duties and modularity of the IBM J9 virtual machine is better than HotSpot.

  • Zing VM : Zing virtual machine is a high-performance java virtual machine reopened independently from an old version of HotSpot's code branch. Azul has written a new garbage collector for it, and has also modified many implementation details in HopSpot. It performs better than HotSpot in scenarios requiring low latency and fast warm-up. Zing's PGC and C4 collectors can easily support terabytes of java heap memory, and it is guaranteed that the pause time can still be maintained within the range of no more than 10 milliseconds.

3. New generation just-in-time compiler

​ For applications that need to run for a long time, due to sufficient warm-up, the hot spot code will be accurately located and captured by HotSpot's detection mechanism, and compiled into machine code that can be directly executed by the physical hardware. In this type of application, the java code Operating efficiency largely depends on the quality of the code output by the just-in-time compiler

  • The HotSpot virtual machine contains two just-in-time compilers. They are the client-side compiler (C1) that takes a long time to compile but has a low degree of output code optimization, and the server-side compiler (C1) that takes a long time to compile but has higher output code optimization quality ( C2) .

  • A new generation of just-in-time compiler: Graal compiler . The Graal compiler was launched 20 years later than the server-side compiler, and it has the advantage of being extremely late-comer. While maintaining the output of compiled code of similar quality, the development efficiency and scalability are significantly better than C2 compilation. This determines that the excellent code technology in the C2 compiler can be easily ported to the Graal compiler, but in turn, the effective optimizations in the Graal compiler are extremely difficult to implement in the C2 compiler. In some test items, it has gradually overtaken the C2 compiler. Graal is able to optimize more complex than C2, such as "Partial Escape Analysis" (Partial Escape Analysis), but also has easier to use aggressive predictive optimization strategies than C2, and supports custom predictive assumptions.

4. Questions in this chapter
  1. What are interpreters and just-in-time compilers
  2. What is user mode and kernel mode

Guess you like

Origin blog.csdn.net/weixin_44981707/article/details/110928400