linux 的ps STAT 说明

回复 收藏
经常使用ps查看系统的进程。可是从来没有细细研究过各项所代表的含义。今天仔细查看了man手册,并做了如下总结。
首先看man手册关于STAT部分的说明:
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  已经停止或者暂停的进程,如果我们正在运行一个命令,比如说sleep 10,如果我们按一下ctrl -z 让他暂停,那么我们用ps查看就会显示T这个状态
W 这个好像是说,从内核2.6xx 以后,表示为没有足够的内存页分配
X  已经死掉的进程(这个好像从来不会出现)
Z  僵尸进程,杀不掉,打不死的垃圾进程,占系统一小点资源,不过没有关系。如果太多,就有问题了。一般不会出现。

下面一些是BSD风格的参数
<  高优先级进程
N  低优先级进程
L   在内存中被锁了内存分页
s   主进程
l   多线程进程
+  代表在前台运行的进程
2010-11-30 10:21 举报
已邀请:

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: