Java jstack analysis process information
1. find out the current process Java program ID (19893)
ps -ef | grep java and ps -aux | grep java all query process information, aux is BSD style, -ef is System V style. The main difference is aux truncate command column, -ef not.
2. Review the current process of each thread usage
top -Hp {pid} # to view the current process thread CPU usage
-Hp 19893 Top # (note that the following pid 19894, 19895 ... 26983 Ze is not a process id, but the thread ID)
3.jstack to view the process in the state of the thread by viewing the details of the process
jstack 19893
In the top command has been acquired to the thread pid, the pid converted into a hexadecimal value in the thread dump each thread has a nid , to find the corresponding nid
Correspond to a thread id nid top -Hp 19893 commands results, hex!
eg: Hex: nid = 0x690d corresponding to decimal: pid = 26893 (the second image point in the last row pid), other threads corresponding to true ~
Base conversion Reference article : https://www.cnblogs.com/summerdata/p/10722144.html
dump files of concern are the following thread state
Deadlock: Deadlock (focus)
Execution: Runnable
Wait resources : Waiting for condition Condition ON (focus)
Waiting to obtain monitor : Waiting ON Monitor entry (focus)
Pause : Suspended
The object wait : the Object.wait () or TIMED_WAITING
Blocking : Blocked (focus)
Stop : Parked
ps: also need to look locked information, whether the object is locked deadlock.
Knowledge to share:
lsof -P {pid} # to view the current process reference file information EG: lsof -P 19893 lsof -i: 8080 # to view the current network access port information
top -Hp {pid} # to view the current process of thread usage eg: top -Hp 19893