Java Virtual Machine
Java virtual machine is a Java Virtual Machine (VM. the concept of VM was first derived from the CPU simulator. It is well known that game machine simulators on PCs use similar technologies as Java VMS. after Java source code is compiled into byte code, it is actually a very similar machineCodeBut there is no CPU that can really run this type of code, so in order to achieve the purpose of running on different platforms, the concept of VM has been vigorously promoted. from a simple point of view, Vm is actually translating Java bytecode into specific machine code, which is similar to interpretedProgramming LanguageDifferent, we will talk about it below.
Most of the first-generation VMS adopt direct interpretation, that is, bytecode is translated into machine code in one sentence. however, there is a disadvantage here. In the case of loops, the VM has to translate the translated code again and again. each translation consumes a certain amount of CPU time. therefore, the second generation of VM-jit (Just In Time compiler) occurs. It only performs translation when bytecode needs to be translated. how can this problem be achieved? For example, jit vm can convert a bytecode into a machine code and put the code into the buffer. When the running loop is, it will call the translated code repeatedly! JIT's efficiency depends on its ability to analyze repeated calls and limit the translation workload to a minimum, so as to allow CPU time to run.ProgramLogic.
The third generation VM is hotspot. We will introduce it later.
With the VM, there is a virtual CPU, but we still need some external devices to help complete the computing task, so JNI, its function has different meanings in different occasions. sometimes you can use JNI to directly write a device driver, and sometimes JNI can be used as lightweight wrapper to encapsulate resources of the local system. coupled with the standard library provided by Java itself, Vm provides an environment for multiple platform applications! In a system, the JVM is often not unique. If JDK, ie, and Netscape are installed in Win32, you may already have three different virtual machines. as for how your program runs on that Vm, it depends entirely on your system settings. generally, if you run the applet, the browser VM will become the default platform. of course, you can replace the ms jvm of IE with JDK plug-in.
Each Win32 system contains a Ms implement VM. If Java SDK is installed, you can use JView to start VM process from command line. you can run several VMS of the same type or different types on one computer at the same time, each of which runs in an independent process.
Below are some system attributes. You can get some information about the VM!
Use System. getproperty (string propertyname)
Properyname: meaning:
-----------------------------------------------------
Java. Version-JRE version
Java. Vendor-JRE vendor
Java. Vendor. url-vendor URL
Java. Home-installation directory
Java. java. VM. Specification. Version-JVM standard version
Java. VM. Specification. Vendor-JVM standard developer
Java. VM. Specification. name-
Java. VM. Version-jvmachine implementation version:
Java. VM. Vendor-JVM implementation vendor
Java. VM. Name-JVM implementation name
Java. Specification. Version-JRE Specification Version
Java. Specification. Vendor-JRE specification vendor
Java. Specification. Name-JRE specification name:
Java. Class. Version-class format version number:
Java. Class. Path-Java classpath