When a process is to be executed, it has to be first loaded from the secondary storage to the main memory. This is called process loading. The process has to be loaded back to secondary memory after its execution. Because, memory is limited and the other processes need it for their use an operating system swaps/exchanges the two processes, which is called swapping.
OR
Swapping may be a technique of quickly shifting a program from the most memory onto the storage device.

process swapping
process swapping


A process can be swapped out in the following situation/cases:-

  • On the arrival of a high priority process.
  • The program is neither executing nor performing I/O operation.
  • On the expiry of the-slice in round-robin scheduling.

The consequences/result/outcome/effect/importances of swapping:-

  • The only the idle process is swapped.
  • It increases the operating system overheads.
  • Context switching time is fairly high.

ADVANTAGE OF SWAPPING

  • It increases memory utilization
  • It increases CPU utilization.
  • It increases throughput.