认识进程状态 PROCESS STATE CODES


一、PROCESS STATE CODES

       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, 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

翻译一下:

D 无法中断的休眠状态(通常 IO 的进程);
R 正在运行可中在队列中可过行的;
S 处于休眠状态;
T 停止或被追踪;
W 进入内存交换(从内核2.6开始无效);
X 死掉的进程 ;
Z 僵尸进程;

< 优先级高的进程
N 优先级较低的进程
L 有些页被锁进内存;
s 进程的领导者(在它之下有子进程);
l 多进程的(使用 CLONE_THREAD, 类似 NPTL pthreads);
+ 位于后台的进程组;

二、举个例子

ps -aux |  more
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.0  0.0  59184  7500 ?        Ss   Feb11 106:15 /usr/lib/systemd/testsystemd --switched-root --system --deserialize 22
root          2  0.0  0.0      0     0 ?        S    Feb11   0:14 [testkthreadd]
root          3  0.0  0.0      0     0 ?        S    Feb11   8:08 [testksoftirqd/0]
root          5  0.0  0.0      0     0 ?        S<   Feb11   0:00 [testkworker/0:0H]
root          8  0.0  0.0      0     0 ?        S    Feb11   6:34 [testmigration/0]
root          9  0.0  0.0      0     0 ?        S    Feb11   0:00 [testrcu_bh]
root         10  0.0  0.0      0     0 ?        S    Feb11 242:57 [testrcu_sched]
root       3232  0.0  0.0      0     0 ?        SN   Feb11  29:09 [testkipmi0]
root       3321  0.0  0.0  98652   876 ?        Ssl  Feb11   0:12 /usr/sbin/testproxy -D
test     4121  2.6  0.0      0     0 ?        Zsl  Sep09 3935:10 [testsvr] <defunct>
root      24634  0.0  0.0      0     0 ?        D    Dec11   0:00 [kworker/6:10]

猜你喜欢

转载自blog.csdn.net/weixin_44648216/article/details/113851473
今日推荐