I run jstack on a java process (oracle jdk1.7_072) and found these lines
"C2 CompilerThread1" daemon prio=10 tid=0x00007f1a8415d000 nid=0x7d72 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" daemon prio=10 tid=0x00007f1a8415a000 nid=0x7d71 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
I know that C2 is a bytecode compiler. I have three questions:
nid
parameter mean? The first one nid=0x7d72
looks similar to java version, is it coincidence or not?The threads that the client Just-in-Time compiler uses are known as C1 compiler threads. And those that the server Just-in-Time compiler uses are called C2 Compiler threads. The C1 and C2 compiler threads streamline your application's performance. Often, these threads can consume a high CPU, creating problems.
What is a Thread in Java? A thread in Java is the path followed when executing a program. All Java programs have at least one thread, known as the main thread, which is created by the Java Virtual Machine (JVM) at the program's start, when the main() method is invoked.
C2 compiler threads are daemon threads (i.e. JVM threads). Code that your developers write are not the actual code that gets executed at run time. JIT (Just in Time) hotspot compiler in JVM, compiles (i.e. optimizes) the code that your developers have written for better performance.
Tiered compilation, introduced in Java SE 7, brings client startup speeds to the server VM. A server VM uses the interpreter to collect profiling information about methods that is fed into the compiler.
-XX:CICompilerCount=N
JVM option.nid
(Native ID) is a unique ID of a thread given by OS. On Linux it is a number returned by gettid(). In your case TID = 0x7d72 = 32114.[0x0000000000000000]
here is not related to waiting on condition
. What is printed in brackets is a stack pointer of the last known Java stack frame aligned to a page size. Since compiler thread is not a real Java thread, it does not have last Java SP, hence zero is printed.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With