Linux 进程状态

往往,我们PS查看进程的时候,可以看到STAT一栏中,表示进程的状态;


[root@iZ28lzm2ehvZ ~]# ps axu

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND

root         1  0.0  0.0  10368   148 ?        Ss    2014   0:02 init [3]

root         2  0.0  0.0      0     0 ?        S<    2014   0:00 [migration/0]

root         3  0.0  0.0      0     0 ?        SN    2014   0:00 [ksoftirqd/0]

root         4  0.0  0.0      0     0 ?        S<    2014   0:00 [watchdog/0]

root         5  0.0  0.0      0     0 ?        S<    2014   0:03 [events/0]

root         6  0.0  0.0      0     0 ?        S<    2014   0:00 [khelper]

root        11  0.0  0.0      0     0 ?        S<    2014   0:00 [kthread]

root        15  0.0  0.0      0     0 ?        S<    2014   0:01 [kblockd/0]

root        16  0.0  0.0      0     0 ?        S<    2014   0:00 [kacpid]

root        60  0.0  0.0      0     0 ?        S<    2014   0:00 [cqueue/0]

root      1262  0.0  0.1  10128   576 ?        Ss    2014   0:01 syslogd -m 0

root      1265  0.0  0.0   3824   288 ?        Ss    2014   0:00 klogd -x

nscd      1274  0.0  0.1 129572   952 ?        Ssl   2014   0:09 /usr/sbin/nscd

root      1294  0.0  0.1  62648   768 ?        Ss    2014   0:00 /usr/sbin/sshd

ntp       1307  0.0  1.0  19428  5120 ?        SLs   2014   0:02 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g

root      1331  0.0  0.2  74828  1152 ?        Ss    2014   0:00 crond

root      1336  0.0  0.0  31628    68 ?        Ssl   2014   0:00 /usr/sbin/gshelld

root      1345  0.0  0.1   3808   520 tty1     Ss+   2014   0:00 /sbin/mingetty tty1

root      1346  0.0  0.1   3808   520 tty2     Ss+   2014   0:00 /sbin/mingetty tty2

root      2903  0.0  1.8 286532  9352 ?        Sl    2014  15:56 /usr/local/aegis/alihids/AliHids

root      3480  0.0  0.3  77528  1944 ?        Ss   Jan05   0:00 SCREEN -S anders.zhangw

root      3481  0.0  0.3  66084  1592 pts/3    Ss+  Jan05   0:00 /bin/bash

root      3493  0.0  0.3  66184  1644 pts/4    Ss+  Jan05   0:00 /bin/bash

root      3505  0.0  0.3  66084  1584 pts/5    Ss+  Jan05   0:00 /bin/bash

root      7527  0.0  0.3  77208  1736 ?        Ss    2014   0:00 SCREEN -S anders.zhangw

root      7528  0.0  0.3  66084  1576 pts/1    Ss+   2014   0:00 /bin/bash

root      7540  0.0  0.3  66084  1572 pts/2    Ss+   2014   0:00 /bin/bash

root     12893  0.0  0.0      0     0 ?        S    Jan16   0:00 [pdflush]

root     12895  0.0  0.0      0     0 ?        S    Jan16   0:00 [pdflush]

root     15075  0.0  0.6  88080  3316 ?        Ss   16:50   0:00 sshd: root@pts/0

root     15079  0.0  0.3  66088  1600 pts/0    Ss   16:50   0:00 -bash

root     15105  0.0  0.1  65608   988 pts/0    R+   16:54   0:00 ps axu

那么,进程的状态都表示些什么意思?


D    uninterruptible sleep (usually IO)

R    running or runnable (on run queue)

S    interruptible sleep (waiting for an event to complete)

T    stopped, either by a job control signal or because it is being traced

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


现在,我们可以详细讨论下Linux进程的状态变化。。。。突然有人叫吃饭,那就吃饭后继续额

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。