我们可以通过top指令查看进程的运行状态,里面可以看到进程或者线程的运行状态,其中R代表线程运行,S为可中断的空闲态,其他依次按照字符串对比。
/
#define TASK_RUNNING 0
#define TASK_INTERRUPTIBLE 1
#define TASK_UNINTERRUPTIBLE 2
#define __TASK_STOPPED 4
#define __TASK_TRACED 8
/ in tsk->exit_state /
#define EXIT_ZOMBIE 16
#define EXIT_DEAD 32
/ in tsk->state again */
#define TASK_DEAD 64
#define TASK_WAKEKILL 128
#define TASK_WAKING 256
#define TASK_STATE_MAX 512
#define TASK_STATE_TO_CHAR_STR “RSDTtZXxKW”