3

我需要对以下进程状态进行分类(从 /proc/[PID]/status 获得)

  • R(运行)
  • S(睡觉)
  • D(磁盘睡眠)
  • T(停止)
  • T(跟踪停止)
  • Z(僵尸)
  • X(死)

作为

  • 运行(1),
  • runnable(2), - 等待资源(CPU、内存、IO)
  • 不可运行(3), - 已加载但等待事件
  • 无效(4) - 未加载

我最初的猜测:

1:R (running)
2:S (sleeping)
3:D (disk sleep)
3:T (stopped)
3:T (tracing stop)
4:Z (zombie)
4:X (dead)

这个对吗?

4

1 回答 1

1

从 fs/proc/array.c:

static const char * const task_state_array[] = {
        "R (running)",          /*   0 */
        "S (sleeping)",         /*   1 */
        "D (disk sleep)",       /*   2 */
        "T (stopped)",          /*   4 */
        "t (tracing stop)",     /*   8 */
        "Z (zombie)",           /*  16 */
        "X (dead)",             /*  32 */
        "x (dead)",             /*  64 */
        "K (wakekill)",         /* 128 */       
        "W (waking)",           /* 256 */
};    
于 2012-04-10T19:24:52.373 回答