When I invoke top
, the %CPU
and TIME+
columns appear to be frozen and never update. Instead, the first few lines of the process list always look like this:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 49364 9168 5720 S 0,0 0,1 0:00.07 systemd
2 root 20 0 0 0 0 S 0,0 0,0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0,0 0,0 0:00.00 ksoftirqd/0
4 root 20 0 0 0 0 S 0,0 0,0 0:00.00 kworker/0:0
5 root 0 -20 0 0 0 S 0,0 0,0 0:00.00 kworker/0:0H
6 root 20 0 0 0 0 S 0,0 0,0 0:00.00 kworker/u24:0
7 root 20 0 0 0 0 S 0,0 0,0 0:00.00 rcu_sched
8 root 20 0 0 0 0 S 0,0 0,0 0:00.00 rcu_bh
9 root 20 0 0 0 0 S 0,0 0,0 0:00.00 rcuos/0
In particular, all processes show 0,0 %CPU and 0:00.00 TIME+, except for the first process (systemd
), which always shows the same unchanging value of 0:00.07 TIME+, even after a reboot. The summary line at the top about CPU usage appears to be updating normally.
I tried looking into /proc/(pid)/stat
, and – if I understand its contents correctly – verified that this is indeed the information stored there. For example, if 5814 is the PID of a long-running process I've started:
$ cat /proc/1/stat | cut -f15 -d" "
7
$ cat /proc/5814/stat | cut -f15 -d" "
0
I'm using Korora (Fedora) 23 with all the latest updates, running kernel version 4.7.6.
What could be causing this behavior, or how I could go about debugging this?
Best Answer
top(1) displays the running processes first sorted by CPU usage, then fills the table with sleeping processes sorted by PID.
systemd(8) is a variant of init(8) and is probably not going to do much after boot. The 70 ms of CPU usage is probably from when you were booting up. When the system is up and running the init process (PID=1) has not much other purpose than to just stay alive.
My systemd(8) has used the CPU for 2:25.72 in 125 days and 12 hours, so it's updating really slowly.
The rest of the processes in that list are some Linux stuff, you'll notice they don't even use any memory.