What is memory paging?
A computer can address memory beyond the amount physically installed on the system. This nonphysical memory, or virtual memory, is actually a section of a hard disk set up to emulate the computer's RAM.
Virtual memory was originally conceptualized at a time when physical memory -- the amount of RAM installed on a computer -- was extremely expensive. The portion of the hard disk that acts as physical memory is called a page file.
Benefits and disadvantages of memory paging
When a computer runs out of RAM, the operating system (OS) moves pages of memory over to the computer's hard disk to free up RAM for other processes. This process is designed to ensure that the OS will not run out of memory and crash.
However, overreliance on memory paging can impair performance. Because RAM operates much faster than disk memory, the OS must wait for the disk to catch up every time a page is swapped. Heavy reliance on swap files can, therefore, negatively impact a workload's performance.
Memory paging in virtualized environments
In a virtualized environment, the hypervisor manages physical memory. This is because guest OSes are not aware of the virtualization layer and, therefore, behave as though they have the host hardware all to themselves.
Approaches to memory paging in virtualized environments include the following:
- Smart paging. This strategy is used only during a VM restart when no memory is available and none can be reclaimed.
- Hypervisor swapping. This approach provides long-term page swap support for a certain amount of memory reclamation. Because hypervisors generally have no insight into VM memory, the data swapped out might routinely need to be swapped back, which can degrade performance.
- Memory ballooning. This technique forces the VM's guest OS to decide which memory pages are less important and swap them to disk.