- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is Process Suspension and Process Switching?
Let us begin by understanding what process suspension is.
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.
The purposes for process suspension are as follows −
Interactive User request
Parent process request
Now let us discuss 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 −
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)
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.
The major differences between process switching and process suspension are as follows −
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 switch also called context switch which involves saving information.
Updating the control information.
And restore the CPU information.
- What is Process Scheduling?
- What is process termination?
- What is Cryptography? (Definition, Process, and Types)
- What is a process hierarchy?
- What is Inter process communication?
- Process vs Parent Process vs Child Process
- What is the difference between process and program?
- What is Electrolysis? – Definition, Principle, and Process
- What is Encryption? (Basic Concepts, Process, and Types)
- What is Electropolishing? – Process, Advantages and Applications
- What is Process Control Block (PCB)?
- What is Zombie Process in Linux?
- What is Interrupt I/O Process?
- What is the process of pipelining?
- What Is a Labour-Intensive Process?