How can sleeping processes in "top" be using a percentage of CPU?
When we run top we occasionally see a sleeping, "S", process which is using %CPU; I would expect all sleeping processes to use 0% CPU since they are not active. I would expect only running, "R", processes to be actively consuming %CPU in top. For example, see these sleeping Oracle processes
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
11975 oracle 15 0 16.8g 2.6g 2.6g S 8.9 5.5 56:28.38 oracle
5837 oracle 15 0 16.8g 1.8g 1.7g S 6.6 3.7 10:04.11 oracle
12248 oracle 15 0 16.8g 1.6g 1.6g S 5.9 3.4 12:02.33 oracle
21253 oracle 15 0 16.8g 1.6g 1.6g S 4.3 3.4 12:33.83 oracle
My thinking is that the CPU activity, in this case for Oracle, consists of many short bursts below the 1s time granularity for Top. Which means it the usage counter gets updated but Top does not see the "R" state since it is too short.
Any thoughts?
Solution 1:
That is almost certainly what is happening. In this case, for Oracle, the CPU usage consists of many short bursts below the 1s time granularity for Top. Which means it the usage counter gets updated but Top does not see the "R" state since it is too short.