Java Tools Tutorials - Herong's Tutorial Notes - Version 5.32, by Dr. Herong Yang
What Is a Thread Dump?
A quick description of JVM thread dump is provided in this section. A thread dump is a list of all execution thread in a JVM with their stack traces.
What Is a Thread Dump? A thread dump is a list of all execution threads in a JVM at a given moment. The status and the stack trace of each thread is also included in the thread dump.
A thread dump is really a snapshot of JVM activity telling you what the JVM is doing at the moment when the thread dump was generated. If you want to know what data objects are there in the JVM, you need to get a different kind of dump, heap dump, which can be generated by the "jmap" tool.
There are 3 important types of information in a thread dump:
1. Thread List - A complete list of execution threads is included in a thread dump, including both threads used by the JVM and threads used by the application. For example, "DestroyJavaVM" listed a thread dump is a JVM thread. "main" is usually the starting thread of the application running by the JVM.
2. Thread Status (or State) - The execution status of each thread is included in a thread dump. The status of a thread tells us what the tread is doing at this moment. A thread can be in one of the following states:
For example, the following lines from a thread dump show "Thread-1" thread is in the state of BLOCKED:
"Thread-1" #9 prio=5 os_prio=0 tid=0x00a3c400 nid=0x36c0 waiting for monitor entry [0x14e8f000] java.lang.Thread.State: BLOCKED (on object monitor) ...
3. Stack Trace - The stack trace of each thread is included in a thread dump. The stack trace is a list of statements and methods showing the current execution point of the thread. The first line of the stack trace is the current statement of the lowerest method in the stack. The second line is the statement in the method that calls method in the first line. The third line is the statement in the method that calls the method in the second line. And so on.
For example, the following stack trace from a thread dump shows "Finalizer" thread is waiting on the execution point inside the java.lang.Object.wait() method, which is called by the java.lang.ref.ReferenceQueue.remove() method, which is called by the java.lang.ref.ReferenceQueue.remove() method, which is called by the java.lang.ref.Finalizer$FinalizerThread.run() method:
"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x00982c00 nid=0x18d8 in Object.wait() [0x00e7f000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x03c06dd0> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143) - locked <0x03c06dd0> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
Last update: 2015.
Table of Contents