How to analyze a java thread dump?

前端 未结 2 740
难免孤独
难免孤独 2020-11-30 16:14

I am trying to understand more about java, especially about memory management and threads. For this reason I have recently found interest in looking at thread dumps.

2条回答
  •  感情败类
    2020-11-30 16:52

    Further to @James Drinkard's excellent answer:

    Note that, depending on the underlying implementation, the java.lang.Thread.State of a thread that is blocked in a native method may be reported as RUNNABLE, where A thread in the runnable state is executing in the Java virtual machine but it may be waiting for other resources from the operating system such as processor.

    It turns out that this description also encompasses being blocked in an OS call such as a poll or read operation - presumably because there is no guarantee that the JVM can know when a native method call has blocked at the OS level.

    Many discussions of JVM thread dumps that I've seen either ignore this possibility completely, or blithely skim over it without considering the implications - not least of which is that monitoring tools may confusingly report that several such threads are 'running', and furthermore that they are all running at 100%.

提交回复
热议问题