Introduction to virtual machines (6)-Java Virtual Machine Model

Source: Internet
Author: User

Java Virtual Machine Model

Because of its high portability, JAVA has become the main programming language on the Internet.

The concept of "Simulator" is one of the frequently used virtual machines in the computer industry. This virtual machine concept is very different from that of IBM virtual machines. In IBM's concept, the system memory and resources are divided into precise copies of the current machine. Instead of being split, a new "machine" or virtual machine is loaded into the current system. Without changing the current system, different functions are provided to users. This type of virtual machine proves to be very powerful, and it allows software developers to emulate another machine on a completely different machine. Recently, this concept has created a powerful computer programming language: JAVA.

The JAVA programming language depends on the simulator called Java virtual machine (JVM. JVM allows programmers to deal with virtual machines instead of systems. Therefore, the functions used by programmers are embedded functions in JVM, rather than operating system functions. This is very advanced because it provides portability. If the same JVM is installed on two completely different machines, the same JAVA program can run on both machines, because the JAVA program depends on JVM rather than the system that runs it. Because of its high portability, JAVA has become the main programming language on the Internet. Many Web pages are now integrated with JAVA programs. These JAVA programs can complete some tasks displayed in the browser.

JVM is also very small. Or, it does not use a large amount of memory. This means that JVM can be applied to many different machines. For example, TV sets, cellular mobile phones, and computers. Therefore, it is entirely possible to add complex features like games to the devices we are using today.

How does it work?

You may wonder how a JAVA program actually works. How to Use JVM? Okay. JVM is what we call abstract computers. Or, JVM is implemented by software on the "real" hardware platform and operating system. JAVA programs are compiled for JVM rather than the system. This means that the JAVA program written by the programmer is translated from the JAVA compiler into the language/code executed by the JVM. These codes are called Byte codes ). Byte Code can be considered as the machine language of JVM. JVM interprets the byte code stream as a sequence of commands. Then these commands are executed to generate the expected output. Figure 1.1 shows the route from the JAVA program to the final execution.


As shown in Figure 1.1, once the byte code is interpreted by JVM, the JVM commands are mapped to OS commands or hardware commands. This means that the JVM actually uses the operating system and machine commands to implement the commands it obtains. Therefore, JVM commands must have a possible ing on every operating system or machine where the JVM is installed. This is one of the reasons why the JAVA language is not 100% portable. Some JVM commands can be implemented on one operating system, but not on another.

Summary

The main purpose of the Java Virtual Machine is to solve the computer program portability problem. Is JVM completely solving this problem? The answer is no ...... It does not completely solve this problem. However, it provides a solution that is most effective (although not 100% ). JAVA has achieved high portability. The power of JAVA allows people to develop many cross-platform applications. JAVA has proved to be useful and powerful Virtual Machine implementation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.