20

I have a home server sometimes running at a high CPU usage rate of about 50 to 70 percents.

In htop, my favorite process manager, I can sort the processes by CPU usage, but often there isn't any process consuming more than 0 % CPU. On the other side, htop displays the whole CPU usage of the system which is about 50 percents, as said before.

I guess that there is an easy explanation for this, but I don't know it.

Maybe there are some hidden processes? But even running it as root doesn't show more processes.

EDIT:

I looked into top, which is showing (at least) two more processes:

  230 root      20   0     0    0    0 R 37.4  0.0 107:06.59 md127_raid5                                          
20403 root      35  15     0    0    0 D  9.6  0.0   2:45.78 md127_resync   

So my mdadm raid is currently resyncing, which has been confirmed when I displayed /proc/mdstat. (See first comment.)

So this turns the question in: "Why doesn't htop display the same processes than top?"

1
  • top shows more processes. The process in question belongs to mdadm, which is currently performing a resync as I found out. top shows the process under the name md127_raid5 and md127_resync. The former is running since booting the system, the latter since resync has been triggered. So this turns the question in: "Why doesn't htop display the same processes than top?"
    – leemes
    Jun 2, 2012 at 23:26

1 Answer 1

24

Why doesn't htop display the same processes than top?

Because htop hides kernel threads by default, while top doesn't. You can switch this option off in F2-settings in htop.

  1. Before:

    enter image description here

  2. Uncheck the Hide kernel threads setting, press Esc to leave screen instead of F10.

    enter image description here

  3. Notice the new number of kthr (kthreads) at the cursor, and all the new k... processes that have shown up. You can sort these by CPU, etc. as usual. Apart from the name (begins with a k, has a / towards the end), you can also identify kernel threads by their very low PIDs (notice the 1, 2, 3...17 in the screenshot?)

    enter image description here

4
  • Thank you very much. This is something I wanted to know for years! And the solution is so simple... Thanks for the nice screenshots :)
    – leemes
    Jun 3, 2012 at 0:12
  • 1
    The hotkey is H (shift+h).
    – glebm
    Aug 27, 2013 at 22:06
  • 4
    @glebm (late, but I think it's worth to add ;) ): The hotkey for displaying kernel threads is K (Shift+k). The hotkey H (Shift+h) displays (or hides, if already displayed) userland threads. Sep 24, 2013 at 10:11
  • Can htop also hides all the idle processes like top -i?
    – alper
    Mar 9, 2022 at 9:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .