What you should know about HotSpot VMS

Source: Internet
Author: User

Directory

    • 1 History of HotSpot VMS
    • 2 HotSpot VM Overview
1 History of HotSpot VMS

The JVM used in the Oracle/sun JDK is the HotSpot VM.

SUN's JDK version started with the HotSpot virtual machine from 1.3.1, and at the end of 2006 open source, mainly using C + + implementation, the JNI interface part is implemented by C.

HotSpot is a newer JVM that replaces JIT (Just in Time, instant compilation) and can greatly improve the performance of Java, namely:

Java initially compiles the source code into a. Class-formatted bytecode that executes on the virtual machine and is slower;

HotSpot compiles some of the commonly used code into local (native) code, which significantly improves performance.

The HotSpot JVM parameters are divided into standard options, non-standard parameters (non-standard options), and non-stable parameters, which can be consulted as follows: GC Learning Primer This is enough (Oracle JDK 8 based)

2 HotSpot VM Overview

The HotSpot consists of an interpreter and two compilers (client and server, actually running in two selected one), interpreted with the compilation mixed execution mode, and the default startup interpretation execution.

Compiler: The Java source code is compiled into a class bytecode file by the compiler, and Java bytecode can be dynamically compiled (JIT) cost code at run time (provided that the mixed execution mode is interpreted and compiled and the virtual machine is not just started).

Interpreter: An interpreter is used to interpret a class bytecode file, and Java is an interpreted language (as distinct from a compiled language).

Programs written in the ① interpreted language are compiled at run time and interpreted by a dedicated interpreter-each time it is executed, it is compiled once and is less efficient.

Programs written in the ② compiled language need to be compiled into machine language by the compiler and executed directly by the appropriate operating system before running.

This kind of language program executes fast, the system requirements under the same conditions are low, so like the development of operating systems, large applications, database systems, such as the use of it, such as C + +, Pascal, etc. are compiled language.

Some Web scripts, server scripts, and auxiliary development interfaces, which require a low speed requirement for compatibility with different system platforms, often use explanatory languages such as Java, JavaScript, VBScript, Perl, Python, Ruby, MATLAB and so on. [2]

For explanatory languages, such as the Java language, Java programs are first compiled into class files by compilers, and are interpreted by Java Virtual Machines (VMS) on the Windows platform if they are run on the Windows platform. If running on a Linux platform, the Java Virtual machine on the Linux platform is interpreted and executed. So you can cross-platform, if the platform must have a matching Java virtual machine. If you do not have a Java virtual machine, you cannot cross-platform. [2]

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 -versionJava HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)mixed mode 解释与编译 混合的执行模式 默认使用这种模式

Java-xint-version

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

Interpreted pure Interpretation mode disables JIT compilation

Java-xcomp-version

Java HotSpot (TM) Client VMs (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)

3. Dynamic compilation

? Dynamic compilation (compile during run-time), which is known in English as dynamic Compilation;just in time, is also the meaning.

? Hotspot's compilation of bytecode is not compiled before the program is run, but is compiled during program run.
? The hotspot runs a monitor (Profile monitor) to monitor the health of the program.

? The Java bytecode (class file) is loaded into the virtual machine in an interpreted manner (the default is interpreted for execution at startup). In the process of running the program, that part of the use of large frequency, those on the performance of the program is important. Code that has a large impact on the efficiency of the program, called Hotspot (hotspot), will dynamically compile these hotspots into machine code (native code) while optimizing the machine code to improve operational efficiency. For those less-run code, the hotspot will not compile them.

? Hotspot has three-layer processing of bytecode: not compiled (state when bytecode is loaded into a virtual machine). That is, when the virtual machine executes and then compiles), compiles (the bytecode compiles the cost code. When the virtual machine executes, it is compiled, not compiled, compiled and optimized (not only the bytecode is compiled for cost code, but also optimized).

? As for those programs that do not compile, those that compile, those optimizations, are determined by the monitor (Profile Monitor).

4. Why not statically compile that?

? Why did bytecode compile the cost code before it was loaded into the virtual machine?

? Dynamic compilers are also superior in many ways than static compilers. Static compilers often find it difficult to predict exactly what part of the program is most needed for optimization during operation.

? function calls are a waste of system time because there are many stack-out operations. Therefore, there is an optimization method, that is, the original function call, through the compiler compiler, to non-function calls, the function code directly embedded into the call out, into order execution.

? The object-oriented language supports polymorphism, and static compilation is not valid to determine which method the program calls, because polymorphism is determining which method is called in the program's run.

Reference:

Http://www.cnblogs.com/zengkefu/p/5633342.html

Copyright Notice

Author: Ma_shoufeng (Ma Ching)

Source: Blog Park Ma Ching's Blog

Your support is a great encouragement to bloggers, thank you for your reading.

The copyright of this article is owned by bloggers, welcome reprint, but without the blogger agreed to retain this paragraph statement, and in the article page obvious location to the original link, otherwise Bo Master reserves the right to pursue legal responsibility.

What you should know about HotSpot VMS

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.