Using the Solaris process tools on a specific thread

In Solaris 10 the ptools (process tools) were enhanced to display data for specific threads in a process. This functionality can be tapped into by appending a slash and a thread id to the ptool command line:

$ pstack 739/2

739:    java TestApp
-----------------  lwp# 2 / thread# 2  --------------------
 feeb3025 lwp_cond_wait (806eeb8, 806eea0, 0, 0)
 feac58c1 __1cHMonitorEwait6Mbl_b_ (806ee48, 0, 0) + 2c1
 feb28310 __1cHThreadsKdestroy_vm6F_b_ (0, 0, 806a79c, 0, 10006, febb59c9) + 7c
 fe8e2de2 jni_DestroyJavaVM (fec46dc0) + 12a
 0805324c JavaMain (8047cb8) + fec
 feeae662 _thr_setup (fe650200) + 52
 feeae8c0 _lwp_start (fe650200, 0, 0, 0, 0, 0)

This is extremely useful when you need to interrogate a specific thread in a process (e.g., a thread that is consuming 100% of a CPU), or when a process has 100s or 1000s of threads (which is typically the case with Java applications). Nice!

One Comment

HameCralley  on March 12th, 2010

Hi, my name is Tim. Just wanted to say hi to the forum, I been creeping around here for a while now, but tend to participate more. Looking forward to make some new friends. Ciao!



Leave a Comment