Where stores kernel processes that do not work?

Everyone has a question about tasks on Linux, I know that all tasks that are currently in the TASK_RUNNING state are in a data structure called runqueue , but what about tasks waiting for an event (states that are not TASK_RUNNING, for example, one that expects keyboard input). Do I have some other data structure for such tasks or just a general list of tasks ? in advance for any explanation

+6
source share
2 answers

Processes in the TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE further subdivided into different classes, each of which corresponds to a specific event. In this state, the state of the process does not provide enough information to quickly get the process descriptor, so another process list called wait_queue . Wait_queue implements conditional event expectations. A process waiting for a specific event is placed in the correct wait queue.

Waiting queues are executed as circular lists, the elements of which include pointers to handle descriptors. Each element of the wait queue list is of type wait_queue:

 struct wait_queue { struct task_struct * task; struct wait_queue * next; }; 
+2
source

wait queues are used to let processes wait for a specific event to occur - for example, wait for keyboard input.

0
source

Source: https://habr.com/ru/post/886481/


All Articles