Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where does kernel store processes which are not running?

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

like image 231
likeIT Avatar asked Apr 22 '11 14:04

likeIT


1 Answers

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;  
}; 
like image 113
Vikram.exe Avatar answered Nov 09 '22 14:11

Vikram.exe