Simulating more random access memory (RAM) than actually exists, which allows the computer to run larger programs as well as multiple programs concurrently. Actually developed back in the 1950s, virtual memory uses storage (HDD/SSD) to temporarily hold parts of the program that are in RAM. Because there is always more storage space than RAM space, virtual memory increases the computer's capacity to do work.
Hardware Is Required
All modern CPUs have memory management units (MMUs) that support virtual memory. They provide "page tables" that are used to translate between the program's "virtual" addresses and the "real" addresses in RAM and storage, which are constantly changing. Although a program initially loads as a contiguous block of code, it may wind up scattered around RAM. See Windows swap file
Not a Virtual Machine
Virtual memory was the first use of the "virtual" term, and it meant "simulated." Another common simulation technology is the "virtual machine." However, "virtual memory" and "virtual machine" are different. Virtual memory operates in every computer, but a virtual machine is an optional technology widely used for running applications in datacenter servers. See virtual
, virtual machine
and cloud computing
Memory Is Extended to Storage
The computer's RAM is divided into "pages," typically 4KB in size. When RAM fills up, pages not currently in use by open programs are written to storage in a "swap file." When instructions in a swapped out page are required again, some other page in RAM is written to storage to make room (see below).
Page Out, Page In
When real memory (RAM) is full and the current program needs instructions that are not in RAM, pages are swapped. In this example, program A needs a page from the disk, and a page from program C is swapped out to make room.