如下信息来自于命令man ps
Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process:
D uninterruptible sleep (usually IO)
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped by job control signal
t stopped by debugger during the tracing
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by its parent
For BSD formats and when the stat keyword is used, additional characters may be displayed:
< high-priority (not nice to other users)
N low-priority (nice to other users)
L has pages locked into memory (for real-time and custom IO)
s is a session leader
l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+ is in the foreground process group
执行命令ps aux可以查看到进程的状态,如下是样例输出
$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 823 0.0 0.4 172272 16980 ? Ssl 7月13 0:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
root 837 0.0 0.4 562900 17232 ? Ssl 7月13 0:00 /usr/sbin/NetworkManager --no-daemon
root 845 0.0 0.1 70584 6088 ? Ss 7月13 0:00 /lib/systemd/systemd-logind
root 850 0.0 0.0 4552 824 ? Ss 7月13 0:00 /usr/sbin/acpid
syslog 852 0.0 0.1 263036 5364 ? Ssl 7月13 0:01 /usr/sbin/rsyslogd -n
root 908 0.0 0.0 110472 3600 ? Ssl 7月13 0:01 /usr/sbin/irqbalance --foreground
root 912 0.0 0.4 1435684 19288 ? Ssl 7月13 0:01 /usr/lib/snapd/snapd
root 945 0.0 0.2 298416 9960 ? Ssl 7月13 0:00 /usr/lib/policykit-1/polkitd --no-debug
root 1162 0.0 1.2 913624 48188 ? Ssl 7月13 0:53 /usr/bin/dockerd -H fd://
root 1227 0.0 0.1 302804 7868 ? Ssl 7月13 0:00 /usr/sbin/gdm3
...
比较有意思的地方是,当进程进入状态D之后,使用命令kill -9无法杀掉这个进程;除非事先知晓进入状态D的原因,否则最快捷的恢复方法即是重启操作系统。
参考资料
若非注明,均为原创,欢迎转载,转载请注明来源:Linux下进程的状态