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
What is Process Suspension and Process Switching?
Process suspension and process switching are two fundamental concepts in operating system process management. Process suspension involves temporarily moving a process out of main memory, while process switching involves changing which process is currently executing on the CPU.
Process Suspension
Process suspension occurs when the operating system moves a process from main memory to secondary storage (disk) to free up memory space. When processes in main memory enter the blocked state, the OS may suspend one of them by transferring it to disk and bringing another process into memory.
Most operating systems use additional suspended states beyond the basic Ready, Running, and Blocked states:
Blocked/Suspend − Process is waiting for an event and has been swapped to disk
Ready/Suspend − Process is ready to run but currently stored on disk
Purposes of Process Suspension
Swapping − Free main memory for other processes
Timing − Suspend processes that are scheduled to run at specific times
Interactive user request − User explicitly suspends a process
Parent process request − Parent process suspends its child processes
Process Switching
Process switching (also called context switching) occurs when the operating system stops executing one process and starts executing another. This happens when the OS gains control from the currently running process due to system interrupts.
Types of System Interrupts
Interrupt − External event (hardware interrupt, timer expiration)
Trap − Software-generated interrupt (system calls, exceptions, errors)
When Process Switching Occurs
Supervisor call − Explicit request by program (e.g., file I/O request). The process will likely be blocked
Trap − Error from the last instruction. May cause the process to terminate
Interrupt − External event that preempts the current process execution
Steps in Process Switching
| Step | Action | Description |
|---|---|---|
| 1 | Save CPU context | Switch from user mode to kernel mode, save registers |
| 2 | Update current PCB | Save process state in Process Control Block |
| 3 | Move PCB to queue | Place current process in appropriate queue (ready/blocked) |
| 4 | Select new process | CPU scheduler chooses next process to execute |
| 5 | Update selected PCB | Mark new process as running state |
| 6 | Update memory structures | Set up memory management for new process |
| 7 | Restore CPU context | Load new process registers, switch to user mode |
Comparison
| Aspect | Process Suspension | Process Switching |
|---|---|---|
| Purpose | Free main memory space | Multiprogramming and multitasking |
| Location | Process moved to disk | Process remains in main memory |
| Availability | Not immediately available for execution | Can be scheduled immediately |
| Overhead | High (disk I/O required) | Moderate (CPU context switching) |
| Recovery | Requires explicit activation | Automatic by scheduler |
Conclusion
Process suspension manages memory resources by temporarily moving processes to disk, while process switching enables multitasking by rapidly alternating CPU execution between processes. Both mechanisms are essential for efficient operating system resource management and providing the illusion of concurrent execution.
