[JVM] What are the jvm virtual machines? Introduction to common jvm virtual machines

1. Java virtual machine

The following introduces three common Java virtual machines. Of course, there are many others in the world. I won’t introduce them one by one here. If you are interested, you can Baidu by yourself.

  1. Oracle 's HotSpot virtual machine;
  2. BEA System 's JRockit virtual machine;
  3. IBM 's J9 virtual machine;

Oracle's HotSpot virtual machine, BEA System's JRockit virtual machine and IBM's J9 virtual machine are also called "three major commercial Java virtual machines".

Two, Oracle's HotSpot virtual machine

Speaking of HotSpot VM , I believe all Java programmers know that it is a virtual machine included in Sun JDK and OpenJDK , and it is also the most widely used Java virtual machine at present. But what not necessarily everyone knows is that this virtual machine that seems to be "pure blood" was not originally developed by Sun , but was designed by a small company called " Longview Technologies "; even this virtual machine was originally It is not developed for the Java language, it is derived from the Strongtalk VM , and a considerable amount of technology in this virtual machine is derived from a design that supports the Self language to achieve the goal of "achieving more than 50% of the execution efficiency of the C language". Sun has noticed that this virtual machine has many excellent ideas and practical effects in JIT compilation, and acquired Longview Technologies in 1997 , thus obtaining HotSpot VM .

HotSpot VM not only inherits the advantages of Sun's previous two commercial virtual machines (such as the accurate memory management mentioned above), but also has many new technical advantages of its own. For example, the HotSpot in its name refers to its hot code detection technology ( In fact, the two VMs are basically independent products of the same period. HotSpot is a little earlier. HotSpot is an accurate GC from the beginning , and Exact VM also has almost the same hotspot detection as HotSpot . For Exact VM and HotSpot VM , which one becomes Sun Mainly supported VM products, there are still debates within Sun , HotSpot defeating Exact is not a technical victory), HotSpot VM 's hot code detection capability can find the code with the most compilation value through the execution counter, and then notify the JIT The compiler compiles in units of methods. If a method is called frequently, or there are many effective loops in the method, standard compilation and OSR will be triggered respectively(on-stack replacement) Compile action. Through proper cooperation between the compiler and the interpreter, a balance can be achieved between the optimal program response time and the best execution performance, and there is no need to wait for the output of the native code to execute the program, and the time pressure of just-in-time compilation is relatively reduced, so that It helps to introduce more code optimization techniques and output higher quality native code.

At the JavaOne conference in 2006 , Sun announced that it would eventually open source Java , and in the following year, it successively released the source code of various parts of the JDK (including HotSpot VM , of course ) under the GPL agreement, and here Built on top of OpenJDK . In this way, HotSpot VM becomes the common virtual machine of Sun JDK and OpenJDK, two JDK projects that are extremely close to each other .

In 2008 and 2009, Oracle acquired BEA and Sun respectively , so that Oracle has two excellent Java virtual machines at the same time: JRockit VM and HotSpot VM . Oracle announced that it will complete the integration of these two virtual machines in the near future (about when JDK 8 is released), so that they can complement each other. The integration method is roughly based on HotSpot , transplanting the excellent features of JRockit , such as using JRockit 's garbage collector and MissionControl service, using HotSpot 's JIT compiler and hybrid runtime system.

Three, JRockit virtual machine

The JRockit virtual machine once claimed to be "the fastest Java virtual machine in the world" (advertisement, IBMJ9 virtual machine has also been promoted in this way, and the performance of the three major virtual machines is generally rising alternately), it was launched by BEA in 2002. The Java virtual machine acquired by AppealVirtual Machines . BEA has developed it into a virtual machine that is highly optimized for server hardware and server-side application scenarios. Because it focuses on server-side applications, it can pay less attention to program startup speed, so JRockit does not include interpreter implementation inside, and all codes They are all compiled and executed by a just-in-time compiler.

A comprehensive portfolio of Java runtime solutions, including the industry's fastest standard Java solutions. Numerous industry benchmarks show that the base JRockit JVM is the fastest JVM in the world . JRockit's solution for delay-sensitive applications, JRockit Real Time , provides JVM response time in milliseconds or microseconds, which is suitable for the needs of financial front-end offices , military command and control , and telecommunications networks . Using JRockit products, customers have experienced significant performance improvements (some exceeding 70%) and hardware cost reductions (up to 50%).

Four, J9 virtual machine

The IBM J9 virtual machine is not the only Java virtual machine produced by IBM , but at present, IBM is unable to develop J9 . The name J9 was initially just an internal development code name, and the official name chosen at the beginning was " IBM Technology fotJava Virtual Machine ", or T4J for short, but this name is too catchy and the acceptance is far less than J9 . The J9 virtual machine was originally extended from a SmalTalk virtual machine project in the IBM Otawa laboratory . At that time, this virtual machine had a bug caused by an error in the definition of the 8KB constant value. It took a long time for the engineers to finally discover and solve this error. Since then, this version of the virtual machine has been called K8 , and the virtual machine extended from it to support the Java language has been named J9 . Unlike BEA JRockit, which only focuses on server-side applications, the market positioning of IBM J9 virtual machine is similar to that of HotSpotIt is relatively close. It is a multi-purpose virtual machine that fully considers the server, desktop applications, and embedded in the design. The purpose of developing J9 is to serve as the execution platform for IBM 's various Java products. It is compatible with IBM products ( Such as IBM WebSphere, etc.) and Java applications on platforms such as IBMAIX and Z/OS .

IBM J9 is still very active today. The separation of duties and modularization of the IBM J9 virtual machine are better than that of HotSpot . system, etc.) constitutes the IBM OMR project alone, which can be quickly assembled into corresponding functions in other language platforms such as Ruby and Python . Since 2016, IBM has gradually open sourced the OMR project and the J9 virtual machine, and donated them to the Eclipse Foundation for management after they were fully open sourced, and renamed them Eclipse OMR and OpenJ9 . If you read the source code in order to learn virtual machine technology, the more modular OpenJ9 code is actually a better choice than HotSpot . If there is one more option for using the Java virtual machine, you can use AdoptOpenJDK to obtain a complete JDK composed of OpenJ9 and other OpenJDK libraries .

In addition to BEA and IBM , some other large companies also claim to have their own proprietary JDK and virtual machines, but they either obtain copyrights from Sun/Oracle (such as HP , SAP , etc.), or are based on OpenJDK Project improvements (such as Alibaba, Twitter , etc.) are not independently developed by themselves.

Five, Java virtual machine expansion

1. The ancestor of virtual machine: Sun Classic / Exact VM
2. The leader of martial arts: HotSpot VM
3. Xiaojiabiyu: Mobile / Embedded VM
4. The second in the world: BEA JRockit / IBM J9 VM
5. The combination of software and hardware: BEA Liquid VM / Azul VM
6. Challengers: Apache Harmony / Google Android Dalvik VM
7. No success, but not failure: Microsoft JVM and others
8. Competing schools of thought (KVM, Java Card VM, Squawk VM, JavaInJava, Maxine VM, Jikes RVM\IK VM.NET , JamVM, CacaoVM, SableVM, Kaffe, Jelatine JVM, NanoVM, MRP, Moxie JVM)

The above Java virtual machine expansion content is quoted from the book "In-depth Understanding of Java Virtual Machine-JVM Advanced Features and Best Practices".

Guess you like

Origin blog.csdn.net/weixin_44299027/article/details/128154827