在ps的STAT列中,有很多字母并没有多大意义。它们是什么意思?

下面是ps aux | head的一个示例:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  27176  2960 ?        Ss   Sep20   0:02 /sbin/init
root         2  0.0  0.0      0     0 ?        S    Sep20   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Sep20  13:05 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   Sep20   0:00 [kworker/0:0H]
root         7  0.0  0.0      0     0 ?        S<   Sep20   0:00 [kworker/u:0H]
root         8  0.0  0.0      0     0 ?        S    Sep20   2:16 [migration/0]
root         9  0.0  0.0      0     0 ?        S    Sep20   0:00 [rcu_bh]
root        10  0.0  0.0      0     0 ?        S    Sep20  20:08 [rcu_sched]
root        11  0.0  0.0      0     0 ?        S    Sep20   0:07 [watchdog/0]
root        12  0.0  0.0      0     0 ?        S    Sep20   0:05 [watchdog/1]
root        13  0.0  0.0      0     0 ?        S    Sep20   2:21 [ksoftirqd/1]
root        14  0.0  0.0      0     0 ?        S    Sep20   1:00 [migration/1]


#1 楼

man ps在“过程状态码”标题下具有所有答案:

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.


评论


我经常来这个答案作为参考

–grasshopper
2014年11月21日在22:40



有趣的是,我得到一个“ U”作为状态代码,似乎没有任何地方记录在案。知道这意味着什么吗?

–汤姆
15年8月19日在13:36

会议负责人?

– Marco Marsala
15年10月20日在16:02

@MarcoMarsala进程的会话ID与它的进程ID相同。本质上,这意味着这是会话中的第一个过程。通常是bash或X之类的登录终端。会话组等进程分组后,可以在领导进程结束时轻松清除。它类似于父母。

–奥利♦
15-10-26在9:31



@Oli-2017年添加了一个新的I,I =空闲-unix.stackexchange.com/questions/462098/…。

–slm
18年8月12日在9:26