Location>code7788 >text

JVM series (I) - Introduction to the history of the growth of virtual machines

Popularity:201 ℃/2024-07-23 14:46:41

I. Summary

As we all know, Java has evolved over the years from a mere computer programming language to a mature set of software solutions. From the Internet to enterprise platforms, Java is the most widely used programming language today.

The following passage is from the official Java introduction!

From laptops to data centers, from game consoles to scientific supercomputers, from cell phones to the Internet, Java is everywhere!

Whether it is an Internet company or a traditional enterprise, when developing a digital platform system, the vast majority of companies in the world will basically prefer to use Java to develop, in order to help the enterprise's digital transformation and productivity enhancement, for the reasons that, without going into details.Secure, stable, high-performance, cross-platformWait, there's actually one big advantage: good recruiting, hahaha~~~

The reason why Java is so attractive, not only limited to its excellent programming language design, which also has a very important reason thanks to its virtual machine platform design, through its virtual machine can easily realize the application of cross-platform operation, to achieve the goal of "write once, run everywhere", and can also achieve good operational efficiency. efficiency.

Introduction to Java

Before we get to the virtual machine, let's briefly review the story of Java's development.

Java was first developed by a small team of engineers at SUN in the early 1990s as a programming language in whichJames Gosling.is the project leader (known as the father of Java), the programming language was originally named Oak, after the oak tree outside their office, and then renamed Java because Oak was already registered.

Here we include a glorious picture of the father of Java!

The goal was to use it to develop embedded applications for the digital cable industry, such as set-top boxes, smart TVs, and other digital devices, for hassle-free operation. As a result, there was little market response after the launch. 4 years later, the technical team had to be disbanded.

But also at this time, the Internet has just risen, coincidentally, this time MarkArdreesen development of Mosaic and Netscape inspired the Oak project team members, they use Java to write HotJava browser, HotJava has the ability to run Java code in the page, can be run on all computer devices without any obstacles, this effect is supported by Sun CEO ScottMcNealy. This effect was supported by Scott McNealy, CEO of Sun, and triggered Java's determination to enter the Internet.

This caused quite a stir at the time, and people seemed to see the future of the Internet, and for a while, Java was sought after by many vendors and developers. So while the iron is hot, Sun officially released JDK1.0 in 1996, when the most important ten operating system vendors announced that they would support the operation of Java programs in their systems, and from then on in the high-speed development of the Internet in the killing four sides.

One of the key reasons why Java has gained widespread developer support in the development of the Internet is that it enables "Write once, run everywhere"The effect ofSignificantly reduces software development effortThis is made possible by Java's architectural philosophy.

Programming languages such as C, C++ and so on, the code is directly compiled into machine code for execution. Although it is very fast, the instruction sets of CPUs on different platforms (x86, ARM, etc.) are different, so every time you develop an application, you need to compile the corresponding machine code for each platform, which is very troublesome.

Java is different, it will compile the code into a kind of "bytecode", which is similar to the abstract CPU instructions, and then the virtual machine is responsible for loading the bytecode, compiling it into the corresponding machine code according to different platforms and executing it, which makes it possible to realize the "Write once, run everywhere"The Effect.

Of course, virtual machines need to be developed separately for each platform. In order to ensure that virtual machines developed by different platforms and companies can execute Java bytecode correctly, SUN has developed a series of specifications for Java virtual machines. From a practical point of view, the compatibility of the virtual machine is very good, the lower version of the Java bytecode can run on the higher version of the virtual machine.

The entire internal structure of the JDK can be summarized in the following diagram (image from theIntroduction to Java by Xuefeng Liao

The relationship between the JDK, JRE and JVM can be briefly described as follows.

  • JDK (Java Development Kit): refers to the software development kit for the Java language, including compilers, debuggers, Java API class libraries, Java virtual machine, etc., usually used for development environment
  • JRE (Java Runtime Environment): refers to the Java Runtime Environment, including the Java API class libraries, Java virtual machine and other content, usually used to run Java applications, usually used in production environments
  • JVM (Java Virtual Machine): refers to the Java Virtual Machine, which is used to execute Java applications on different platforms.

It is clear that the JVM is at the heart of the cross-platform operation of Java applications. Therefore, understanding and learning about the JVM will help developers have a more comprehensive understanding of Java-related technologies.

At the command line of your operating system, typejava -versionYou can see which version of the virtual machine the JDK is currently using.

III. Introduction to virtual machines

When talking about the Java Virtual Machine, many developers may first think of the HotSpot Virtual Machine, as shown in the screenshot above.

In fact, besides HotSpot, there are also Sun Classic VM, Exact VM, BEA JRockit VM, IBM J9 VM, etc. The development of virtual machines can be summarized as followsa hundred flowers bloom (idiom); let the arts have free expressionThese four words sum it up.

3.1、Sun Classic VM

In 1996, when Sun released JDK 1.0, the virtual machine that came with it was the Classic VM, which used a purely interpreter approach to executing Java code, which simply means that you run the code while interpreting it, rather than executing it through a compiler approach (compiling first, executing later), as is the case today. In the Sun Classic VM, the interpreter and the compiler do not coexist, so Java applications will not be executed fast enough.

In 1998, when Sun released JDK 1.2, it also announced a virtual machine called Exact VM, which attempted to solve all the problems encountered by Classic VM. Its execution system solved the Classic VM's problem of the interpreter and compiler not working at the same time, and it also had some of the features of modern high-performance processors, such as two-stage on-the-fly compilation, exact memory management, and so on.

Unfortunately, this virtual machine has never really been used on a large scale, and at this point Sun Classic VM remains the default Java virtual machine.

3.2、HotSpot VM

In 2000, when Sun released JDK 1.3, it announced the HotSpot VM as the default Java Virtual Machine, which is widely known as the Java Virtual Machine.

In fact, this VM was not developed natively by Sun, but by a company called Longview Technologies, which, noting the many good results of the JIT compilation of this VM, acquired Longview Technologies in 1997, thus acquiring ownership of the HotSpot VM.

HotSpot VM not only has the advantages of the two previously mentioned VMs, but also has many new technologies of its own, such as hotspot detection technology. HotSpot detection is a technique that uses an execution counter to find the most optimized code, and then tells the JIT compiler to compile deep optimizations on a method-by-method basis.

There is actually a similar technology in Exact VM, but HotSpot was ultimately chosen as the default VM.

After HotSpot VM as the default Java VM, until now, is still our most commonly used virtual machine, which shows the tenacity of HotSpot VM!

3.3、BEA JRockit / IBM J9 VM

The aforementioned virtual machines were developed by Sun, but in addition to Sun, other organizations and companies have also developed a number of virtual machine implementations, the most famous of which are BEA's JRockit VM and IBM's J9 VM.

JRockit VM is another famous virtual machine besides HotSpot, the developer of which was acquired by BEA in 2002. This virtual machine has been known for quite some time asThe World's Fastest Java Virtual MachineIt is a virtual machine that focuses on server-side applications and has a garbage collection algorithm that outperforms all other virtual machines, as well as a powerful suite of MissionControl services.

IBM's J9 VM is a general-purpose virtual machine positioned as a multi-purpose virtual machine for applications ranging from server-side to desktop to embedded, and was developed by IBM to serve as an execution platform for a variety of IBM Java products. A slight difference is that the IBM J9 VM can only be used with IBM products, and while there are no technical limitations, a separate commercial license is required.

The performance level of the J9 VM is roughly in the same ballpark as the HotSpot VM, and in some scenarios, sometimes the HotSpot VM is faster and sometimes the J9 VM is faster.

3.4 Other JVMs

HotSpot, JRockit, and J9 were the three dominant JVMs for a long time, and are arguably the most visible parts of the history of Java virtual machines. Beyond that, there are actually a variety of virtual machines that are used on a smaller scale.

Dedicated commercial VMs such as Azul VM and BEA Liquid VM are very powerful, managing at least dozens of CPUs and hundreds of gigabytes of memory resources, as well as providing garbage collectors for controlled GC times over huge memory ranges, and so on, and these VMs run only on specific hardware platforms, and are therefore more demanding.

Many other virtual machines exist, such as Apache Harmony, Google Android Dalvik VM, Mircosoft JVM, etc., all of which play a role in their respective fields.

3.5、Oralce

Who would have thought that Sun's technology was so powerful, but in the years that followed it gradually fell, because it did not know how to sell and operate, which led to the company's financial losses, and in 2009, Oracle Corporation acquired Sun in cash, the transaction price of 7.4 billion U.S. dollars.

Previously, Oracle acquired ownership of JRocket VM through its acquisition of BEA in 2008; this means that JRockit is owned by Oracle, along with HotSpot.

In fact, the HotSpot VM of JDK1.8 is now a merged version of the previous HotSpot VM and JRockit VM, which is the legendary "HotRockit", but the product name is still called HotSpot VM.

We'll see what happens with the JVM as it develops!

IV. Summary

This article focuses on the history of the development of Java, the history of the birth of the virtual machine to do a knowledge summary, in the subsequent articles, we will summarize and share the knowledge related to the JVM, if there is a description of the wrong place, welcome everyone to leave a message to point out that we are grateful!

V. References

1./wiki/1252599548343744/1255876875896416

2./xrq730/p/

3./chanshuyi/p/jvm_serial_02_the_history_of_jvm.html