What is the Difference Between Mode Switch and Process Switch

The main difference between mode switch and process switch is that mode switch changes the process privilege between modes like user mode and kernel mode while process switch changes the process state between different states.

A process is a program in execution. Initially, these processes are in secondary memory. These processes then load into the main memory for the CPU to execute them. The OS maintains a data structure called Process Control Block (PCB) for each process. PCB consist of information such as process id, status, program counter, memory management information, IO status information and many more. When the process execution is over, the OS deletes this PCB. Mode switch and Process Switch are two terms related to a process in an OS.

Key Areas Covered

1. What is Mode Switch
     – Definition, Functionality
2. What is Process Switch
     – Definition, Functionality
3. What is the Difference Between Mode Switch and Process Switch
     – Comparison of Key Differences

Key Terms

Operating System, Mode Switch, Process Switch

Difference Between Mode Switch and Process Switch - Comparison Summary

What is Mode Switch

First of all, there are two modes in executing a program; they are user mode and kernel mode. When a program is executed in the user domain, the mode is user mode. When a program is executed in kernel domain, the mode is kernel mode. And, this mode includes interrupt handlers, kernel processes, base kernel, kernel extensions, etc.

Mode switch changes the process privileges between user and kernel modes. A mode switch occurs when a process requires accessing a system resource. It happens using the system call interface or by an interrupt. System call allows user mode process to call a kernel function from user mode. Furthermore, programming libraries allow accessing functions that directly or indirectly invoke system calls.

What is Process Switch

Process switch is the process of switching the process state between various statuses. A process can have various states.

Difference Between Mode Switch and Process Switch

Figure 1: Process States

The major states are as follows.

New – Process is in secondary memory. Now it is initiated for execution.

Ready – The process loads to the main memory. The process waits for the processor to execute it.

Running – The processor executes the instructions of that process.

Exit/Terminate – After completing the execution of the process, it goes to the exit state.

Wait / Block– A process goes to a waiting state when it requires a resource or completion of an IO operation. When the IO operation is complete or when the resource is available, the process goes back to the ready state.

Difference Between Mode Switch and Process Switch

Definition

Mode switch is the process of altering the process privilege between modes like user and kernel whereas process switch is the process of switching the process state between the statuses such as ready and block. Thus, this is the main difference between mode switch and process switch.

Functionality

In mode switch, the privilege of a process changes. However, in process switch, the state of a process changes. Thus, concerning the functionality, this is a difference between mode switch and process switch.

Cost

Cost is another difference between mode switch and process switch. Mode switch is less expensive than process switching.

Conclusion

Mode switch and process switch are two terms related to a process. The main difference between mode switch and process switch is that mode switch changes the process privilege between the modes like user mode, kernel mode while process switch changes the process state between the different states.

Reference:

1. “Mode switching”, IBM Corporation, Available here.
2. “What Is a Process?” Types of Network Topology in Computer Networks | Studytonight, Available here.

Image Courtesy:

1. Process states” By A3r0 assumed (based on copyright claims). – No machine-readable source provided. Own work assumed (based on copyright claims) (Public Domain) via Commons Wikimedia

About the Author: Lithmee

Lithmee holds a Bachelor of Science degree in Computer Systems Engineering and is reading for her Master’s degree in Computer Science. She is passionate about sharing her knowldge in the areas of programming, data science, and computer systems.

Leave a Reply