Difference Swapping and Paging

Swapping refers to copying the entire process address space, or at any rate, the non-shareable-text data segment, out to the swap device, or back, in one go (typically disk).

Whereas paging refers to copying in/out one or more pages of the address space. In particular, this is at a much finer grain. For example, there are ~250,000 4 KB pages in a 1 GB RAM address space.

Swapping was used in the early days, e.g. DEC pdp-11 era Unix, 1975-80 ish. For all you could want to know and more, may I recommend The Lions Document a.k.a. Lions' Commentary on Unix 6th Ed. with Source Code, John Lions, ISBN 1-57398-013-7?

You will surely appreciate Chapter 14, "Program Swapping" which begins: "Unix, like all time-sharing systems, and some multiprogramming systems, uses "program swapping" (also called "roll-in/roll-out") to share the limited resource of the main physical memory among several processes."

Paging (on Unix) arrived with the BSD (Berkeley Systems Distribution) on the VAX-11/780 starting around 1980.

Paging is also usually associated with per-page memory attributes (no access, read-only, read-write, no execute, executable), and various virtual memory management tricks like demand-zero-filled pages, copy-on-write pages, and so forth.

Hardware-wise, swapping can be performed without any memory management HW whatsoever, although the early machines employed a simple memory mapping scheme (e.g. base and bound, or a simple one level fixed size page mapping table (e.g. divide the 64 KB data address space into 8, 8KB pages in a larger physical address space (256 KB ... 4 MB)).

In contrast, paging requires page-granularity virtual memory page table entries, which typically encode the physical address of the page, PTE bits such as valid, read, write, etc. The machine also needs to automatically (transparently to the application program) fetch and interpret page table entries as necessary to map each virtual address to its physical address, and/or take a page fault exception to enable the OS to make the page accessible and/or schedule an I/O to load it to physical RAM.

Happy hacking!


Although both terms are considered distinct by the, say, mainstream academic media, the fact is that some authors do use them as synonyms. To quote the excellent book on computers architectures written by David and Sarah Harris (Digital Design and Computer Architecture), "writing the physical page back to disk and reloading it with a different virtual page is called swapping,so the disk in a virtual memory system is sometimes called swap space". So, Tyler actually answered the question correctly and his answer should not be downvoted at all.


None. It's usually referred too as swapping on unix platforms, and paging on Windows. Same concept though.