Home  >  Article  >  Java  >  What exactly is a java virtual machine?

What exactly is a java virtual machine?

青灯夜游
青灯夜游Original
2019-05-17 15:45:4311673browse

What exactly is a java virtual machine?

Java Virtual Machine (Java Virtual Machine), referred to as JVM, is an abstract computer that runs all Java programs. It is the running environment of the Java language. It is one of the most attractive features of Java. one.

The Java Virtual Machine (JVM) is a specification for computer devices that can be implemented in different ways (software or hardware). Compiling the instruction set for a virtual machine is very similar to compiling the instruction set for a microprocessor. The Java virtual machine includes a set of bytecode instructions, a set of registers, a stack, a garbage collection heap and a storage method field.

The Java Virtual Machine (JVM) is an imaginary computer that can run Java code. As long as the interpreter is ported to a specific computer according to the JVM specification, any compiled Java code can be guaranteed to run on that system.

The Java virtual machine is a fictitious computer that is implemented by simulating various computer functions on an actual computer. The Java virtual machine has its own imaginary hardware, complete hardware architecture, such as processors, stacks, registers, etc., and also has corresponding instruction systems. The Java virtual machine shields the information related to the specific operating system platform, so that the Java program only needs to generate the target code (bytecode) that runs on the Java virtual machine, and it can run on a variety of platforms without modification.

The Java Virtual Machine Specification defines an abstract -- not an actual -- machine or processor. This specification describes an instruction set, a set of registers, a stack, a "garbage heap", and a method area. Once a Java virtual machine is running on a given platform, any Java program (compiled program, called bytecode) can run on that platform. The Java Virtual Machine (JVM) can interpret the bytecode one instruction at a time (mapping it to actual processor instructions), or the bytecode can be compiled by what is called just-in-time on the actual processor. processor for further compilation.

The above is the detailed content of What exactly is a java virtual machine?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn