How to get - number of threads per process?

Solution 1:

Try this:

ps axo pid,ppid,rss,vsz,nlwp,cmd

Output columns:

  • pid - Process ID
  • ppid - Parent Process ID
  • rss - Resident Set Size - physical memory
  • vsz - Virtual Set Size - virtual memory
  • nlwp - Number of Light Weight Processes - thread count
  • cmd - Command

Solution 2:

Use the following to show the memory use of a single process:

pmap -d <PID>