How to find out the number of threads a process is using on Solaris?

13.2k views Asked by At

I know the pid of the process. top -H -p <pid> works on Linux, but I am not able to get it running on Solaris:

$ top -H -p 3677
/usr/local/packages/top/bin/top-default: illegal option -- H
Top version 3.5beta7
Usage: top-default [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]
$ top -p 3677
/usr/local/packages/top/bin/top-default: illegal option -- p
Top version 3.5beta7
Usage: top-default [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]

What are the options that I have to find the number of threads a process is using on Solaris?

$ uname
SunOS
$ 
1

There are 1 answers

0
jlliagre On BEST ANSWER

Use prstat. The number of threads is shown in the last column (NLWP = number of lightweight processes).

$ prstat -p 1124,4152,1144
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       
  1144 jlliagre   22M   11M sleep   59    0   4:16:05 2.2% multiload-apple/1
  4152 jlliagre  374M  182M sleep   59    0   0:24:53 0.9% firefox-bin/11
  1124 jlliagre   71M   52M sleep   59    0   0:31:50 0.2% java/20

Total: 3 processes, 32 lwps, load averages: 0.14, 0.12, 0.11