Swapping

When a new process is about to be loaded to memory, but there is not enough space in memory, a currently-loaded program that is not using the CPU at the moment could be temporarily removed away from memory into a fast local disk called the backing store, to create enough space for the new program to load. This is called memory swapping.

If compile-time or load-time address binding is used, then processes must be swapped back into the same memory location from which they were swapped out. If execution time binding is used, then the processes can be swapped back into any available location.

It is important to swap processes out of memory only when they are idle, with no pending I/O operations.

Swapping is a very slow process compared to other operations. Most modern OSes no longer use swapping, because it is too slow and there are faster alternatives available (e.g., Paging, which we cover in these lecture notes as well.)