Linux下进程的各种状态

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)  

不可中断的深度睡眠,一般由IO引起,同步IO在做读或写操作时,cpu不能做其它事情,只能等待,这时进程处于这种状态,如果程序采用异步IO,这种状态应该就很少见到了

R Running or runnable (on run queue)  

进程处于运行或就绪状态

S Interruptible sleep (waiting for an event to complete)

可接收信号的睡眠状态,sleep函数可演示这种状态

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

  被ctrl+z中断或被trace

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

留下评论

邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据