Each process has two independent status flags:
Task->state: Is the runnability of the relationship process;
Task->exit_state: is about task exiting;
#define TASK_RUNNING 0
#define TASK_INTERRUPTIBLE 1
#define Task_uniterruptible 2
#define __TASK_STOPPED 4
#define __TASK_TRACED 8
/* in task->exit_state*/
#define Exit_zombie 16
#define Exit_dead 32
/*in task->state*/
#define TASK_DEAD 64
#define Task_wakekill 128
#define TASK_WAKING 256
The macro definition of the symbol constants used in the Set_task_state () function:
#define Task_killable (Task_wakekill | task_uninterruptible)
#define TASK_STOPPED (Task_wakekill | __task_stopped)
#define TASK_TRACED (Task_wakekill | __task_traced)
The macro definition of the symbol constants used in the Wake_up () function:
#define TASK_NORMAL (task_interruptible | task_uniterruptible)
#define Task_all (task_normal | __task_stopped | __task_traced)
The macro definition of the symbol constants used in the Get_task_state () function:
#define Task_report (task_running | Task_interruptible \
| task_uninterruptible | __task_stopped\
| __task_traced)
Implementation of the Set_task_state () method:
#define Set_task_state (task, state_value) \
SET_MB (Task)->state, (State_value))
The SET_MB () function guarantees the order of execution of the instruction;
#define __set_task_state (task, state_value) \
do{(Task)->state = (state_value);} while (0)
Implementation of the Set_current_stat () method:
#define __SET_CURRENT_STATE (State_value) \
do{current->state = (state_value);} while (0)
#define SET_CURRENT_STATE (State_value) \
SET_MB (Current->state, (State_value))
Status bit mask for a process