Calvin's Tech Space

          成于堅(jiān)忍,毀于浮躁

             :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理

          Code Meaning
          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:

          Code Meaning
          < 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

          Process in D state

          If there are a lot of processes in D state in your system, then something is wrong with it.

          What is D state and a process state in general? A process in Linux can be in several states: running, sleeping, etc. Running process runs on a CPU just now, sleeping process waits for its turn on CPU or for some other event. Using ps command you can obtain information about state of each process in the system: STAT column shows that:

          # ps a
            PID TTY      STAT   TIME COMMAND
           4975 tty1     Ss+    0:00 /sbin/mingetty tty1
           4976 tty2     Ss+    0:00 /sbin/mingetty tty2
           6202 pts/0    Ss+    0:01 -bash
          10312 pts/1    Ss     0:00 -bash
            639 pts/1    R+     0:00 ps a

          First big S stands for Sleeping, R stands for running ("+" means that the process is foreground and small "s" means that the process is session leader, but it is not relevant for this article).

          D state occurs then the process is in uninterruptible sleep. This state is bad, because you can't do anything with the process in D state. Fortunately, process normally remains in such state not for so long. But if you have a heap of D state processes then some logic in system is disrupt. If that is happening, the very important thing is to determine where this unlucky sleep occurs. It is easy to do with ps command with l option. WCHAN column shows the name of the kernel function where the process is sleeping:

          # ps axl | grep D
          F   UID   PID  PPID PRI  NI    VSZ   RSS WCHAN  STAT TTY        TIME COMMAND
          vass     13478  7.2  0.0   1732   624 pts/1    D+   17:36   0:00 find ./

          http://wiki.preshweb.co.uk/doku.php?id=linux:psflags
          http://wiki.openvz.org/Processes_in_D_state
          posted on 2011-06-08 17:38 calvin 閱讀(375) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): Linux
          主站蜘蛛池模板: 益阳市| 屯门区| 贵州省| 屏东市| 西畴县| 恭城| 勃利县| 黑山县| 阿城市| 宿松县| 瑞金市| 彰武县| 任丘市| 屯门区| 隆昌县| 应城市| 五原县| 双江| 天峨县| 怀仁县| 台北市| 双桥区| 广德县| 阿荣旗| 荆门市| 青河县| 桦南县| 平武县| 阿勒泰市| 大渡口区| 祁连县| 福州市| 涟源市| 重庆市| 星座| 商南县| 石河子市| 金昌市| 贵南县| 美姑县| 小金县|