Status bit mask of the process

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.