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)?
Asked
Active
Viewed 5,869 times
2 Answers
5
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.

Dennis Williamson
- 62,149
- 16
- 116
- 151
1
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.

emills
- 774
- 1
- 4
- 15