
- Operating System Tutorial
- OS - Home
- OS - Overview
- OS - Components
- OS - Types
- OS - Services
- OS - Properties
- OS - Processes
- OS - Process Scheduling
- OS - Scheduling algorithms
- OS - Multi-threading
- OS - Memory Management
- OS - Virtual Memory
- OS - I/O Hardware
- OS - I/O Software
- OS - File System
- OS - Security
- OS - Linux
- OS - Exams Questions with Answers
- OS - Exams Questions with Answers
- Operating System Useful Resources
- OS - Quick Guide
- OS - Useful Resources
- OS - Discussion
What is Process Suspension and Process Switching?
Let us begin by understanding what process suspension is.
Process suspension
Whenever the processes in main memory are entered into the blocked state, the operating system suspends one process by putting it in the Suspended state and transferring it to disk. The free space present in the memory is used for bringing another process.
Many OS are around Ready, Running, Blocked states. But generally, there is one more state in the operation of an OS that is suspended.
If any process is not occupying the main memory which is in a Ready state, OS swaps one of the blocked processes out onto the Suspend queue.
Suppose, when a Suspended process is ready to run it moves into Ready, Suspend queue. Thus, we have two more states which are Blocked_Suspend and Ready_Suspend.
Purposes
The purposes for process suspension are as follows −
Swapping
Timing
Interactive User request
Parent process request
Now let us discuss process switching.
Process switching
It may occur any time when the operating system has gained control from the currently running process. Let us consider the system interrupts. There are two types of system interrupts which are as follows −
Interrupt
Trap
Switch process
It is explained below when we can switch processes.
Supervisor call − Explicit request by program ex from the file. The process will probably be blocked.
Trap − An error resulted from the last instructions. It may cause the process to be moved to a terminal state
Interrupt − It is the cause of the external execution of the current process.
Steps to process switch
The steps to process switch are as follows −
Save CPU context (mode switch from user mode to kernel mode using mode bit.)
Update PCB of the current process.
Move the PCB of the current process in the appropriate queue.
Select another process for execution. (By CPU scheduler)
Update of selected process
Update memory management structures
Restore CPU context of new PCB (mode switch from kernel mode to user mode)
Purpose
Process switch is an operating system scheduler change from one running program to another. This requires saving all of the state of the currently executing program, including its register state, associated kernel state, and its entire virtual memory configuration. All of the states of the new program is then loaded and execution continues.
Differences
The major differences between process switching and process suspension are as follows −
Process suspension
The suspended process is not immediately available.
The process may or may not be waiting on an event
The process may not be removed from the suspended state until agents order for the removal.
Process switching
Process switch also called context switch which involves saving information.
Updating the control information.
And restore the CPU information.
- Related Articles
- What is Process Scheduling?
- What is process termination?
- What is Negotiation Process?
- What is Process Management?
- What is Electropolishing? – Process, Advantages and Applications
- What is Electrolysis? – Definition, Principle, and Process
- What is Cryptography? (Definition, Process, and Types)
- What is Threat Modeling: Process and Methodologies?
- What is a process hierarchy?
- What is Inter process communication?
- What is the centrifugation process?
- What is the Threshing Process?
- What is switching and the types of switching techniques?
- What is the difference between process and program?
- What is Electro-Extraction? – Definition, Process and Applications
