State | Description |
---|---|
D | uninterruptible sleep (usually waiting for I/O operations). |
I | idle kernel thread. |
R | running or runnable (on the run queue). |
S | interruptible sleep (waiting for an event to complete). |
T | stopped by a job control signal. |
t | stopped by a debugger during the tracing. |
X | dead (should never be seen). |
Z | defunct (“zombie”) process; terminated but not reaped by its parent. |
State Machine of a process
Zombie Process
- process that has completed execution but still has an entry in the process table.
- only occupy space in the process table. They take no memory or CPU.
- This occurs because the process has ended, but its parent process has not yet called
wait()
to read its exit status, leaving the process in a “dead” state. - The purpose of a zombie process is to retain information about the process so the parent can retrieve its exit status. Once the exit status is read by the parent using
wait()
, the zombie is removed (reaped) from the process table.
Orphan Process
- child process continues running even after its parent process has terminated.
- adopted by a special system process, often the init process (PID 1), which then becomes their new parent process. This ensures that the orphan process continues to run and is properly terminated.
- not generally problematic, as they are still being managed by the operating system and will eventually terminate.
- Zombie processes use minimal resources, primarily an entry in the process table
proc
man 5 proc