Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Running vs Waiting vs Terminated Process
A process is an active program under execution. It is more than just program code as it includes the program counter, process stack, registers, and program code. As a process executes, it transitions through different states based on its current activity and resource availability.
The process state diagram illustrates how processes move between different states during their lifecycle −
Process States
Running Process
A process is in the running state when its instructions are being actively executed by the processor. Only one process can be in the running state at any given time on a single-core system. The process reaches this state after being selected by the short-term scheduler from the ready queue.
Waiting Process (Blocked)
A process enters the waiting state (also called blocked state) when it needs to wait for some event to occur before it can continue execution. Common reasons include waiting for I/O operations, user input, or resource availability. The process cannot proceed until the required event completes, after which it moves back to the ready state.
Terminated Process
A process reaches the terminated state when it has finished executing all its instructions or has been explicitly killed. In this state, the process is removed from main memory, and its Process Control Block (PCB) is deleted to free up system resources. The process cannot return from this state.
State Transitions
| Transition | From State | To State | Trigger |
|---|---|---|---|
| Dispatch | Ready | Running | CPU scheduler selects process |
| Preempt | Running | Ready | Time slice expires or higher priority process arrives |
| Block | Running | Waiting | I/O request or resource unavailable |
| Wakeup | Waiting | Ready | I/O completion or resource becomes available |
| Exit | Running | Terminated | Process completion or termination |
Conclusion
Process states define the current status of a process during its execution lifecycle. Understanding these states − running, waiting, and terminated − is crucial for effective process management and CPU scheduling. The transitions between these states are managed by the operating system to ensure efficient resource utilization.
