Understanding Process States in Operating Systems
Process States in Operating Systems
A process is any kind of activity that requires the attention and CPU utilization of a machine. The process is an active entity that is running, while a program is a passive entity that is not running.
Process States
A process can be found in the following states:
- Running or Active: When using the CPU at a given time (only one process can be in this state at once).
- Executable, Prepared, or Ready: The process is in custody, awaiting the end of another process’s execution to use the CPU.
- Locked: Cannot execute because some event has occurred.
Classification of Processes Based on Interaction
Depending on the interaction between processes, these are classified as:
- Independent: Processes do not communicate or synchronize with each other. In a system with a single processor, there are independent processes (strictly speaking).
- Cooperative: Processes communicate and synchronize their activities for a common goal.
- Competitive: Processes compete for the computer’s resources. Orderly access to these resources requires synchronization and sometimes communication between processes.
Detailed Process States
- Active: A process that is running at a given instant.
- Ready: Ready to run, waiting for the processor to be free.
- Blocked or Suspended: Waiting for a condition to be met (I/O, signal, etc.).
- Died: Has finished executing, or the operating system encountered a fatal error.
- Nonato: Exists, but is still not known by the operating system.
- Global State of the System: Set of resources and processes with their corresponding states at any given time.
State Transitions
The operating system changes in response to external or internal events.
Audited Assets
- Running State: A process is in the Running state when it has control of the CPU (i.e., when the CPU is executing the program for that process). This process is the ongoing process of the processor.
- Ready State: A process is in the Ready state when the only thing it needs to be running is to be granted CPU time.
- Blocked or Waiting State: A process is in the Blocked state when it is waiting for a particular event to occur. For example, a process is blocked when the pending I/O operation it requested is complete.
Suspended States
- Suspended-Ready: If a process is running and is suspended at its request or at the request of another process, it transitions to a suspended-ready state, similar to the ready state after being suspended.
- Suspended-Blocked: If the process was previously blocked, the state transition will move the process to a new state called suspended-blocked.
Middle, External, or Special States
In some systems, there are other states called external states. These occur when the process is created before the corresponding program is loaded into memory or when the process is destroyed after the program has been removed from memory.
- Wait (or Start): The Wait state is one in which the process exists when it is created (i.e., devices are assigned, its environment is prepared) but is not yet physically in memory.
- End (or Final): When the process ends, the opposite happens: the process is in the End state until all traces of the process (and its descendants, if any) have been eliminated.