A process is the operating system’s abstraction for a running program
- Running: In the running state, a process is running on a processor. This means it is executing instructions.
- Ready: In the ready state, a process is ready to run but for some reason the OS has chosen not to run it at this given moment.
- Blocked: In the blocked state, a process has performed some kind of operation that makes it not ready to run until some other event takes place. A common example is when a process initiates an O request to a disk. It becomes blocked, allowing some other process to use the processor.
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