everyone I have some question about tasks in Linux, I know that all tasks which are currently at the state TASK_RUNNING
are in data structure called runqueue
, but what about the tasks which are waiting for some event (states which are not TASK_RUNNING, for example one which is waiting for the input from keyboard). Do I have some other data structure for such tasks or only general list of tasks
? thanks in advance for any explanation
Processes in a TASK_INTERRUPTIBLE
or TASK_UNINTERRUPTIBLE
state are further subdivided in to different classes, each of which corresponds to a specific event. In this state, the process state does not provide enough info to retrieve the process descriptor quickly, so another list of processes called wait_queue
are used. Wait_queue implements conditional waits on events. A process waiting for a specific event is placed in the proper wait queue.
Wait queues are implemented as cyclical lists whose elements include pointers to process descriptors. Each element of a wait queue list is of type wait_queue:
struct wait_queue {
struct task_struct * task;
struct wait_queue * next;
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With