Profile Image
vishnupriya

What is JVM startup parameter: -XX:-BackgroundCompilation?

What is JVM startup parameter: -XX:-BackgroundCompilation? Have you used this JVM arguement before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvmargument

  • xx-backgroundcompilationmainclass

  • x-backgroundcompilationmainclass

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:


 This flag allows the JVM to disable background compilation and block threads until the compilation is finished.

Since:

 

Starting from JDK 6.

 

Examples:

 

This will instruct JVM to disable background compilation:

 

java -XX:-BackgroundCompilation MainClass

 

Description:

 

Just In Time Compiler (JIT), generally translated as a real-time compiler, this is for interpreted languages, and is not necessary for virtual machines, it is an optimization method, The Java virtual machine standard does not make any specification for the existence of JIT, so this is a custom optimization technique implemented by the virtual machine.

 

JVM can execute Java code in two ways: [interpretation and execution] and [compile and execute]. If the execution method is compiled and executed, JIT will be used, but interpretation and execution will not be used. JIT, therefore, in the early days, there is no problem to say that Java is an interpreted language, but in the Java virtual machine environment with JIT, it is strictly incorrect to say that Java is an interpreted language.

 

The compiler in JVM is javac, and his job is to compile the source code into bytecode. This part of the work is completely independent and does not require runtime participation at all, so the compilation of Java programs is a semi-independent implementation. With the bytecode, there is an interpreter for interpretation and execution. This is the workflow of the early virtual machine. Later, the virtual machine will compile the method or statement block with high execution frequency into local machine code through JIT, which improves the execution time of the code.

 

By default, the JVM is executed in the interpreted mode before the compilation is completed for the instant compilation request, and the compilation action is performed in the background thread.

 

The parameter “-XX:-BackgroundCompilation” disables background compilation. At this time, the compilation request will wait until the local code is executed directly after the compilation is completed.

 

Default Value:

 

By default, this flag is enabled.

 

Arguments related:

 

Xbatch

 

Related Posts:

 

 

 

 

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvmargument

  • xx-backgroundcompilationmainclass

  • x-backgroundcompilationmainclass