Linux 的行程狀態

行程狀態

Linux 行程的狀態有 Running, Interruptible, Uninterruptible, Zombie, Stopped 等五種,但後來又增加了 Traced, EXIT_DEAD, TASK_DEAD, TASK_WAKEKILL 等四種,形成了九種狀態 (2.6.29.4 版),如範例 10.4所示。

範例 3. Linux 中的行程狀態

行號    Linux 2.6.29.4 版核心原始碼 include/linux/sched.h 檔案
…    …
174    #define TASK_RUNNING 0
175    #define TASK_INTERRUPTIBLE 1
176    #define TASK_UNINTERRUPTIBLE 2
177    #define __TASK_STOPPED 4
178    #define __TASK_TRACED 8
179    /* in tsk->exit_state */
180    #define EXIT_ZOMBIE 16
181    #define EXIT_DEAD 32
182    /* in tsk->state again */
183    #define TASK_DEAD 64
184    #define TASK_WAKEKILL 128
…    …
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License