Tasks represent both processes and threads. Conceptually:
- Processes are defined by
- Threads are defined by
Each process has an assigned TTY, a device that behaves like a terminal. Nowadays we generally use PTYs provisioned by a service like
Task states (
state) indicate whether a given task is runnable or not:
TASK_RUNNING(R; running) indicates that a task is either running or runnable.
TASK_INTERRUPTIBLE(S; sleeping) indicates a task waiting for time slot or event.
TASK_UNINTERRUPTIBLE(D; disk sleep) wake only when a waited resource becoming available or a timeout occurs.
__TASK_STOPPED(T) indicates a task is suspended and will only handle
__TASK_TRACED(t; tracing stop) is the state of a task being traced (via the
TASK_PARKED(P; parked) is the state of a kthread after
TASK_DEADtask is dead, pending destruction of its
task_struct. The exit status is in
TASK_WAKEKILLallows a kthread to wake in response to a signal.
TASK_WAKINGindicates a task is being woken.
TASK_NOLOADkthread equivalent of
TASK_UNINTERRUPTIBLEthat doesn't affect the system load average.
TASK_NEWis the state for a newly created task, indicating that it's not yet runnable and cannot wake up in response to a signal or external event.
Exit states are independent:
EXIT_DEAD(X; dead) is the state of a process which has exited, and its parent has waited for it.
EXIT_ZOMBIE(Z; zombie) indicates the process has exited but its parent has not yet awaited its exit.
EXIT_TRACEis a variant of
EXIT_ZOMBIEfor processes under tracing.
The Process VFS exposes much of this.