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
Differentiate between 5 state and 7 state process models.
A process is a program in execution that consists of more than just program code (text section). Process management is fundamental to operating systems as all tasks require processes to execute. The process changes state as it progresses through different phases of execution.
The state of a process is defined by its current activity. Only one process can run on a processor at any given instant, while many processes may be ready and waiting for CPU time.
Five State Process Model
The 5-state model represents the basic lifecycle of a process with the following states −
New − When a new process is created, it enters the new state and attempts to load into RAM.
Ready − Processes loaded in RAM and waiting for CPU allocation are in the ready state.
Running − The process currently executing on the CPU is in the running state. Only one process can be in this state per CPU core.
Blocked/Waiting − Processes that have left the CPU and are waiting for I/O operations or events to complete are in the blocked state. Once the event occurs, they move back to the ready state.
Terminated/Exit − A process that has completed execution and is removed from CPU and RAM is in the terminated state.
Seven State Process Model
The 7-state model extends the 5-state model by introducing suspension concepts, allowing processes to be moved to secondary storage when main memory is full. The states are −
New − Processes newly created and waiting for admission to memory.
Ready − Processes loaded in main memory and available for CPU execution.
Running − The process currently executing on the CPU.
Blocked/Waiting − Processes in main memory awaiting I/O or event completion.
Ready Suspend − Processes moved to secondary memory but ready for execution once loaded back into main memory.
Blocked Suspend − Processes in secondary memory that are also waiting for I/O or events to complete.
Terminated/Exit − Processes that have completed execution.
Key Differences
| Aspect | 5-State Model | 7-State Model |
|---|---|---|
| Number of States | 5 states | 7 states |
| Memory Management | Only main memory considered | Uses both main and secondary memory |
| Suspension Support | No suspension mechanism | Supports process suspension |
| Additional States | None | Ready Suspend, Blocked Suspend |
| Use Case | Simple systems with adequate memory | Complex systems with memory constraints |
Conclusion
The 7-state model extends the 5-state model by adding suspension capabilities, allowing better memory management in systems with limited RAM. The key difference lies in the two additional suspend states that enable processes to be temporarily moved to secondary storage while maintaining their execution context.
