3

I'm using a Debian Linux OS. I am the sole system administrator.

When I run the top command in a terminal, the second line always exhibits a discrepancy between the total number of tasks, and the combined number of running and sleeping tasks. For example:

Tasks: 138 total, 1 running, 92 sleeping, 0 stopped, 0 zombie

It may have only started recently; I don't remember it happening before. My questions then, are: What might cause this to happen? and Is there any reason to be concerned? I don't like it when things don't add up! Thanks in advance.

1
  • Maybe you don't have rights to see the states of the rest? Is this system administered by you?
    – muru
    Jan 29, 2018 at 1:33

1 Answer 1

4

The issue that you are seeing is that top doesn't report every status, but only a selected number from a larger list. There are more process states than "running" and "sleeping" (see here for a list; there's also "I" for idle.)

Here's a partial view of my top output for a server:

top - 18:49:06 up 10 days, 16:58,  1 user,  load average: 0.19, 0.30, 0.68
Tasks: 129 total,   1 running,  79 sleeping,   0 stopped,   0 zombie
%Cpu(s):  6.1 us,  5.4 sy,  0.0 ni, 84.8 id,  3.7 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3966804 total,   130824 free,  1068132 used,  2767848 buff/cache
KiB Swap:  8388604 total,  8324092 free,    64512 used.  2606136 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1805 qemu      20   0 2353576 845320   3316 S  23.8 21.3   3630:31 /usr/bin/qemu-system-x86_64 -name guest=data,debug-threads=on -S -obje+
 4216 root      20   0   34460   3632   3020 R   0.7  0.1   0:00.03 top
 1752 root      20   0       0      0      0 D   0.3  0.0  26:14.69 [nfsd]
 3889 root      20   0       0      0      0 I   0.3  0.0   0:01.32 [kworker/1:2]
    1 root      20   0  131540   5244   3208 S   0.0  0.1   0:07.51 /lib/systemd/systemd --system --deserialize 38
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.04 [kthreadd]
    4 root       0 -20       0      0      0 I   0.0  0.0   0:00.00 [kworker/0:0H]
    6 root       0 -20       0      0      0 I   0.0  0.0   0:00.00 [mm_percpu_wq]
    7 root      20   0       0      0      0 S   0.0  0.0   0:30.18 [ksoftirqd/0]
    8 root      20   0       0      0      0 I   0.0  0.0   3:33.09 [rcu_sched]
    9 root      20   0       0      0      0 I   0.0  0.0   0:00.03 [rcu_bh]
   10 root      rt   0       0      0      0 S   0.0  0.0   0:01.23 [migration/0]
   11 root      20   0       0      0      0 S   0.0  0.0   0:00.00 [cpuhp/0]
   12 root      20   0       0      0      0 S   0.0  0.0   0:00.00 [cpuhp/1]
   13 root      rt   0       0      0      0 S   0.0  0.0   0:01.20 [migration/1]
   14 root      20   0       0      0      0 S   0.0  0.0   0:27.28 [ksoftirqd/1]
   16 root       0 -20       0      0      0 I   0.0  0.0   0:00.00 [kworker/1:0H]
   17 root      20   0       0      0      0 S   0.0  0.0   0:00.00 [kdevtmpfs]
   18 root       0 -20       0      0      0 I   0.0  0.0   0:00.00 [netns]

As you can see, there are many tasks that are neither "R", "S", "T" nor "Z" and are therefore not included in the summary line.

1
  • Many thanks. "There's also i for idle" answered my question; it's the idle tasks I couldn't account for.
    – user271967
    Mar 21, 2018 at 17:59

You must log in to answer this question.