What does too many sleeping processes mean in linux top command?



osprey

Well-Known Member
Joined
Apr 15, 2022
Messages
1,095
Reaction score
1,061
Credits
10,421
In relation to sleeping processes, it depends on what sort of sleep is being referred to. To find out the nature of the sleeping process, run ps:

Code:
[flip@flop ~]$ ps aux | less
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.1  21140 12468 ?        Ss   05:21   0:02 /sbin/init
root           2  0.0  0.0      0     0 ?        S    05:21   0:00 [kthreadd]
root           3  0.0  0.0      0     0 ?        I<   05:21   0:00 [rcu_gp]
root           4  0.0  0.0      0     0 ?        I<   05:21   0:00 [rcu_par_gp]
root           5  0.0  0.0      0     0 ?        I<   05:21   0:00 [slub_flushwq]
root           6  0.0  0.0      0     0 ?        I<   05:21   0:00 [netns]
root          11  0.0  0.0      0     0 ?        I<   05:21   0:00 [mm_percpu_wq]
root          12  0.0  0.0      0     0 ?        I    05:21   0:00 [rcu_tasks_kthread]
root          13  0.0  0.0      0     0 ?        I    05:21   0:00 [rcu_tasks_rude_kthread]
root          14  0.0  0.0      0     0 ?        I    05:21   0:00 [rcu_tasks_trace_kthread]
root          15  0.0  0.0      0     0 ?        S    05:21   0:00 [ksoftirqd/0]
root          16  0.0  0.0      0     0 ?        I    05:21   0:00 [rcu_preempt]
root          17  0.0  0.0      0     0 ?        S    05:21   0:00 [migration/0]
root          18  0.0  0.0      0     0 ?        S    05:21   0:00 [idle_inject/0]
root          19  0.0  0.0      0     0 ?        S    05:21   0:00 [cpuhp/0]
root          20  0.0  0.0      0     0 ?        S    05:21   0:00 [cpuhp/1]
root          21  0.0  0.0      0     0 ?        S    05:21   0:00 [idle_inject/1]
root          22  0.0  0.0      0     0 ?        S    05:21   0:00 [migration/1]
root          23  0.0  0.0      0     0 ?        S    05:21   0:00 [ksoftirqd/1]
<snip>

The S in the STAT column shows the processes that are sleeping, but interruptible. The main one of these is init, PID 1, which simply waits for a signal to reawaken after sleeping, that signal often being "poweroff" or the like. All the processes marked with the S are idle awaiting a signal to restart in the same way. These are all interruptible processes. They are usually normal.

The other sleeping process would be noted in the same STAT column with a D, which is an uninterruptible process. There aren't any in this output above from this machine because everything is in order. The D indicates that something has gone amiss, often a kernel system call, and they can't be interrupted to restart from idle, nor be interrupted to be killed. Usually the only way to void them is to reboot the machine.

If a process is marked D as uninterruptible, but by chance oscillates from that state to interruptible and back again, there's a neat little one liner "while loop" bash command that one can set running to try and manage that mentioned here at the end of this response:
 

Members online


Top