Swapping in Operating Systems

For Complete YouTube Video: Click Here

In this class, we will try to understand Swapping in Operating Systems.

In our previous class, we discussed the concept of context switching.

Swapping in Operating Systems

The concept of swapping is similar to the concept of context switching.

In context switching, the process in the running state will be switched to the ready state, and the process in the ready state will be switched to the running state.

Similarly, swapping means switching the process from the main to the secondary memory.

The swapping helps maintain the degree of multiprogramming.

Our next class will discuss a detailed explanation of the degree of multiprogramming.

To understand the concept of swapping, consider the image shown below.

In the above program, we have processes in a ready state [P1 to P8], and the main memory is full of the process.

For example, assume that. Process P9 with the highest priority wants to get executed. But there is no room for that process to enter the main memory.

In such cases, the process with low priority will be swapped to the secondary memory to make room for the new high-priority process.