JVM Tuning Series: (a) what is a JVM

Source: Internet
Author: User

Sun's JDK began using hotspot virtual machine technology from 1.3.1, mainly using C + + implementations, and the JNI Interface section is implemented in C.

Java originally compiled the source code into bytecode in the virtual machine execution, so that the execution speed is slow. And the hotspot compiler compiles some of the common code into local (native) code, which is significantly more performance-efficient.

The hotspot consists of an interpreter and two compilers, interpreted with the compilation mixed execution mode, which is initiated by default to interpret execution.

Compiler: Java source code is compiled by compiler into class file (bytecode), Java bytecode can be dynamically compiled (JIT) cost code at runtime

Interpreter: The interpreter is used to interpret the class file (byte code).

Server startup is slow, memory is high, execution is efficient, and it is suitable for the application of servers;

The client starts fast, consumes less memory, performs efficiently without server, and is not dynamically compiled by default for desktop applications.

Java-version

Java HotSpot (TM) Client VM (build 14.3-b01,mixed mode, sharing)

Mixed mode explains and compiles the mixed execution mode by default using this pattern

java-xint-version

Java HotSpot (TM) Client VM (build 14.3-b01,interpreted mode, sharing)

Interpreted pure Interpretation mode disables JIT compilation

java-xcomp-version

Java HotSpot (TM) Client VM (build 14.3-b01,compiled mode, sharing)

Compiled pure compilation mode (fallback to interpreted mode to perform a method that cannot be compiled if the method cannot compile)

Java applications consist of application threads and JVM system threads:

? Vmthread

? Vmperiodic Task Thread

? Finalizer (Java)

? Reference Handler (Java)

? Compilerthread

? Signaldispatcher

? Attach Listener

? Lowmemory Detector

Java code compilation is done by the Java source compiler, and the flowchart is as follows:

The resulting class file consists of the following sections, which can be viewed through JAVAP:

? structure information. Includes the class file format version number and the number and size of each part of the information

? meta data. The information that corresponds to the declarations and constants in the Java source code. Contains class/inherited superclass/implemented interface declaration information, domain and method declaration information, and constant pool

? method information. Corresponds to the information in the Java source code for statements and expressions. Contains byte code, exception processor table, operand stack and local variable size, type record for operand stack (stackmaptable), debug symbol information (linenumbertable)

Java byte code execution is performed by the JVM execution engine to complete, the flowchart is as follows :

-xx:+printcompilation or-xx:+unlockdiagnosticvmoptions-xx:+printassembly yourmainclass prints JIT-compiled code generated by the disassembly plugin, Jdk1.6u20 begins.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

JVM Tuning Series: (a) what is a JVM

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.