I believe this is a question of timing. top
checks CPU state every N seconds. At the moment the check is run, top
will have to be active since it is actively checking the state of the system. A nice way of seing this in action is to decrease the update time of top
and watch your processes move! As suggested in man top
:
o The user interface, through prompts and help, intentionally
implies that the delay interval is limited to tenths of a sec‐
ond. However, you're free to set any desired delay. If you
want to see Linux at his scheduling best, try a delay of .09
seconds or less.
For this experiment, under x-windows open an xterm and maximize
it. Then do the following:
. provide a scheduling boost and tiny delay via:
nice -n -10 top -d.09
. keep sorted column highlighting Off so as to
minimize path length
. turn On reverse row highlighting for emphasis
. try various sort columns (TIME/MEM work well),
and normal or reverse sorts to bring the most
active processes into view
What you'll see is a very busy Linux doing what he's always
done for you, but there was no program available to illustrate
this.
If you try this, you should see more processes going into R
mode. You can also try running top
in batch mode a few times and collecting the processes that are marked as running:
sudo nice -n -10 top -d.09 -bn 100 | awk '$8~/R/{print $NF}' | sort -u
On my system under its current load (which includes an open ssh tunnel) I get the following processes:
cinnamon
firefox
kworker/0:1
kworker/1:2
kworker/2:2
kworker/3:0
plugin-containe
ssh
tint2
top
Xorg