欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Linux下Java线程状态分析 博客分类: java编程 javalinuxjvm 

程序员文章站 2024-03-06 19:15:44
...
在Linux上输入top
进入top后按【shift】+【H】组合键,按线程方式查看线程ID、CPU消耗状况等
通过这种方式获取耗CPU的线程后查看ThreadDump文件做进一步分析
获取ThreadDump的方法:
jstack -l pid >jstack.log




"Attach Listener" daemon prio=10 tid=0x00007fd388001000 nid=0x76e6 waiting on condition [0x0000000000000000]



线程名称: Attach Listener
* 线程类型:daemon
* 优先级:10,默认是5
* jvm线程id:jvm内部线程的唯一标识, 0x00007fd388001000
* 对应系统线程id:和top命令查看的pid对应,不过一个是10进制,一个是16进制。0x76e6
* 线程状态:waiting on condition
* 起始栈地址: [0x0000000000000000]
线程状态详解

Runnable
_The thread is either running or ready to run when it gets its CPU turn.
Wait on condition
_The thread is either sleeping or waiting to be notified by another thread._
Waiting for Monitor Entry and in Object.wait()
_The thread is waiting to get the lock for an object (some other thread may be holding the lock). This happens if two or more threads try to execute synchronized code. Note that the lock is always for an object and not for individual methods._
相关标签: java linux jvm