This flag allows you to set a defined number of threads to be used for compilation. Its syntax is:
-XX:CICompilerCount=value, where value is the number of the thread to be used.
Starting from JDK 6.
To following command, display how to use 3 threads for compilation:
java -XX:CICompilerCount=3 MainClass
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.
There are two types of JIT compilers:
If you are developing a Java desktop application, you will be using JDK with JIT client compiler, but if you are developing a Java server application then you will need to use JDK with JIT server compiler. The main difference between these two compilers is that the client compiler it will compile code when the application runs and the server compiler will keep a watch over the executing code for a while and based on the execution plan that learned from its execution, it will start compilation. Nowadays, the recent JDK contains both JIT compilers and they are called internally C1 (client) & C2 (server) compilers.
JVM introduced multiple arguments to manipulate compilers C1 & C2, one of them is “CICompilerCount” which allows you to allocate threads for compilers C1 & C2. 1/3 of the threads will be allocated to C1 and the rest will be allocated for C2. If you run your java application with the argument “-XX:CICompilerCount=9” then 3 threads will be allocated to compiler C1 and the rest which is 6 threads will be allocated to C2.
The default number of threads is 2 but it can depend on the Java type (Server or Client) and CPUs.
If the value is negative or above the maximum.
CompileCommandFile, CompileOnly, CompileThreshold, CompileThresholdScaling.