swapping
Imagine a small workshop with one workbench but more projects than fit on it. When you need to work on project B but the bench is full of project A, you carefully box up all of project A, set it on a shelf, and lay project B out instead. Later you box up B and bring A back exactly as it was. Swapping does this with whole processes: when memory is tight, the OS moves an entire process out of RAM to a backing store on disk, freeing its space, and brings it back later.
Concretely, swapping temporarily moves a process (its memory image) from main memory to a backing store — a fast region of disk reserved for this — and back. A process swapped out is not running; its complete state sits on disk. When the OS wants to run it again, it swaps it in: copies the image back into memory (with dynamic relocation it can go to a different physical spot than before) and lets it resume. This lets the total memory demand of all processes exceed physical RAM, because not all of them need to be resident at once.
Why it matters: classic swapping moves whole processes, which is simple but slow — copying a large process to and from disk is a major operation, dominated by the disk transfer time, so the swap is only worthwhile if the process then runs for a reasonable while. Modern systems rarely swap entire processes this way; instead they page (swap individual pages in and out on demand), which is far finer-grained. Still, the basic idea — use the disk as an overflow for RAM — is the conceptual ancestor of virtual memory.
Three large processes need RAM but only two fit. The OS swaps out the one that has been idle longest, writing its whole image to the backing store, and uses that freed RAM for a third process. When the idle one is needed again, the OS swaps it back in.
Use the disk as overflow for RAM by moving whole processes in and out.
Whole-process swapping is dominated by disk transfer time and is too coarse for modern interactive systems; today's machines page instead. Do not confuse classic swapping with demand paging, which moves single pages, not whole processes.