PS 查看进行状态

原文:https://blog.csdn.net/lyndon_li/article/details/114295654

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)
               I    Idle kernel thread
               R    running or runnable (on run queue)
               S    interruptible sleep (waiting for an event to complete)
               T    stopped by job control signal
               t    stopped by debugger during the tracing
               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 (TASK_UNINTERRUPTIBLE)        不可中断的睡眠状态
               R (TASK_RUNNING)                正在运行,或在队列中的进程
               S (TASK_INTERRUPTIBLE)          可中断的睡眠状态
               T (TASK_STOPPED)                停止状态
               t (TASK_TRACED)                 被跟踪状态
               Z (TASK_DEAD - EXIT_ZOMBIE)     退出状态,但没被父进程收尸,成为僵尸状态
               W                               进入内存交换(从内核2.6开始无效)
               X (TASK_DEAD - EXIT_DEAD)       退出状态,进程即将被销毁


               <    高优先级
               N    低优先级
               L    有些页被锁进内存
               s    包含子进程
               +    位于前台的进程组;
               l    多线程,克隆线程  multi-threaded (using CLONE_THREAD, like NPTL pthreads do)

 

TASK_INTERRUPTIBLE 和TASK_UNINTERRUPTIBLE 的区别

TASK_INTERRUPTIBLE:是可以被信号和wake_up()唤醒的,当信号到来时,进程会被设置为可运行。

TASK_UNINTERRUPTIBLE:只能被wake_up()唤醒。

posted on 2022-11-02 14:20  红旗kernel  阅读(43)  评论(0编辑  收藏  举报

导航