JVM operating mechanism
jvm (Java Virtual Machine) is a java virtual machine bytecode, comprising a bytecode instruction set, a set of program registers, a stack of the virtual machine, a method and a garbage collector region, an operating system running on JVM above, do not interact directly with the hardware device
Java source files are compiled by a compiler into the following corresponding .class files, .class files are in turn the jvm interpreter compiled into machine code to run on different operating systems, each system is different interpreter, but based on the virtual machine interpreter implementation is the same, which is the cause of cross-platform Java, after a java process running, start the virtual machine is instantiated, and more than one process starts, it will instantiate multiple virtual machine instances , process exit or shut down, the virtual machine instance demise, can not share data between multiple virtual machine instances,
The detailed operation of Java programs
The first step in the Java source file compiled to bytecode file |
Step jvm compiled byte code files to the corresponding machine code operating system |
The third step machine code calls the appropriate operating system's native method libraries respective method |
Java virtual machine includes a class loader subsystem (Class Loader SubSystem), run-time data area (Runtime Data Area) execution engine and a local interface library. Local interface library by calling the native method libraries and operating system delivery
Run-time data area is divided into: method area, local area method, the virtual machine stack (stack frame), Virtual Machine heap (the old era, the Cenozoic) program counter,
Class loader subsystem
Execution Engine
Local interface library
Native method libraries
The lowest level for the operating system
among them
Compiled .class file class loader subsystem is used to load the JVM
Runtime data area for storing data generated during operation of the JVM, including the program counter, the method area and local area method, the virtual stack machine, the virtual machine heap
Immediate execution engine comprises a compiler and the garbage collector, time compiler java bytecode compiler for a specific machine code process, the garbage collector during the recovery operation for the object is no longer used
Native method interface library for library local call the operating system specific instruction operation is completed
-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ------------------------------ reference to "offer to the" book