Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here is a screenshot of top and htop running at the same moment on same host (both sorted by cpu usage). Why does top show only few of php-cgi and mysqld processes while htop shows them all (according to ps output)?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I believe top breaks ties in sorting by ordering by pid. What this equates to is that all the processes that are considered to be using 0.0% at any given moment will actually be sorted by their pid. The processes with the lowest pid will of course be the ones relating to the kernel etc and those are the ones you are seeing in top since the pid for your php-cgi processes are way higher than 100 and therefore way farther down on the list of 0.0% processes.

Hope that helps.

share|improve this answer

I believe the difference you are seeing is due to top defaulting to show threads off, while htop defaults to show threads on. Try pressing "H" in one program or the other to toggle that setting to match and see if the display matches as well.

share|improve this answer

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.