Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?"

share|improve this question
    
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 '12 at 23:26
add comment

1 Answer 1

up vote 10 down vote accepted

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

share|improve this answer
    
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 '12 at 0:12
    
The hotkey is H (shift+h). –  glebm Aug 27 '13 at 22:06
    
@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. –  Henning Kockerbeck Sep 24 '13 at 10:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.