77

Htop on my linux machine shows many "processes" after launching one java program/JVM. I do understand that the JVM runs multiple threads (for the actual program, for garbage collection, etc).

But how come htop lists them as multiple processes with different pids. What exactly are those processes?

b.buchhold
  • 3,837
  • 2
  • 24
  • 33

1 Answers1

115

Actually, it's just that htop by default shows each thread as a separate process. You can add the line hide_userland_threads=1 to your ~/.config/htop/htoprc file to show only one line.

See https://unix.stackexchange.com/questions/10362/why-does-htop-show-more-process-than-ps

Community
  • 1
  • 1
Jer
  • 5,468
  • 8
  • 34
  • 41
  • 87
    Hi, htop author here. Recent versions do not use `~/.htoprc`, but rather `~/.config/htop/htoprc`, which is the XDG-compliant path. Also, I know it's not a very Unix thing to say, but I discourage direct editing of the htoprc file; consider it an internal tool -- please edit through the Setup screen from within htop (F2). The htoprc format is not documented and subject to change in between releases (htop handles the conversion internally when the format changes.) – Hisham H M Nov 09 '12 at 03:14
  • 30
    After F2, the actual option to hide threads is in _"Display options"_ and is called _"Hide userland threads"_. Pressing `H` also toogles this option from the main screen. – BoZenKhaa Sep 24 '15 at 13:18