Tuesday, February 22, 2011

What are Possible Task States ?

All informations about one process is stored in struct task_struct. It includes the status, flags, priority, and many more information about one task. The task_struct of the currently running process is always available through the macro current.
Possible task statuses are:


(R) The process is able to run and contributes to the system load. The scheduler decides which processes really receive CPU time.

(D) The process waits for some event. It will not be considered by the scheduler. The process cannot do anything while it is waiting (it cannot even be killed). This is usually used by device drivers while the process is waiting for some hardware to respond. Such a process contributes to the system load even though it will not receive CPU time; some other part of the system is considered to be working on behalf of the process.

(S) The process waits for some event as in TASK_UNINTERUPTIBLE but it can be woken up by a signal. This should be used when the action can be interrupted without side effects. A process in this state is considered asleep and does not contribute to the system load.
(T) The process is stopped by a signal (Ctrl-Z)
(Z) The process has exited but there are still some data structures around that could not yet be freed. The zombie will usually be freed when the parent calls wait4() to get the exit status.

No comments:

Post a Comment