Introduction to Virtual Machines (vi)--java virtual machine model

Source: Internet
Author: User
Tags functions

Java Virtual machine Model



Because of its high portability, Java has become the primary programming language on the Internet.



The concept of "simulator" is one of the most commonly used explanations of virtual machines in computer industry. This virtual machine concept is very different from the IBM version of the virtual machine. In the IBM concept, system memory and resources are segmented to become exact copies of the current machine. And for the simulator, the system is not split, but a new "machine" or virtual machine loaded into the current system, without changing the current system, the premise of providing users with different functions. This type of virtual machine has proven to be very powerful, allowing 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 relies on a simulator known as a Java Virtual machine (Java MACHINE,JVM). The JVM makes programmers not deal with systems, but with virtual machines. So the functions that programmers use are functions that are embedded in the JVM, not functions of the operating system. This is very advanced because it provides portability. If the same JVM is installed on two completely different machines, the same Java program should run on both machines, because the Java program relies on the JVM rather than the system that runs it. Because of its high portability, Java has become the primary programming language on the Internet. Many web pages are now combined with Java programs. These Java programs can accomplish some of the tasks shown in the browser.



At the same time, the JVM is very small. Or, it doesn't stand for a lot of memory. This means that the JVM can be applied to many different machines. For example, televisions, cellular phones, and computers are all available. Therefore, it is entirely possible to add complex functions such as games to the devices we are using today.



How does it work?



What you're wondering now is probably how a Java program works. How do I use the JVM? Well, the JVM is our name for abstract computers. Or, the JVM is implemented with software on the "real" hardware platform and operating system. Java programs are compiled for the JVM, not the system. This means that the Java program written by the programmer is translated by the Java compiler into the language/code that the JVM executes. These codes are called Byte codes (byte code). The byte code can be considered the machine language of the JVM. The JVM interprets byte code flow as a sequence of instructions. These instructions are then executed to generate the desired 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 the JVM, the JVM instructions are mapped to operating system directives or hardware directives. This means that the JVM actually uses the operating system and machine instructions to implement the instructions it acquires. Therefore, the JVM's instructions must have a possible mapping on each operating system or machine on which the JVM is installed to work. This is one of the reasons why the Java language is not up to 100% portable. Possible JVM directives can be implemented on one operating system and not on another.



Summary



The main purpose of the Java Virtual machine is to solve the portable problem of computer programs. The question is, does the JVM completely solve the problem? The answer is no ... It does not completely solve the problem. However, it provides a solution that is most effective (although not 100% effective). Java has achieved fairly high portability. The power of Java enables people to develop many cross-platform applications. Java has proven to be useful, powerful virtual machine implementations.




Related Article

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.