A computer can address memory beyond the amount physically installed on the system. This nonphysical memory, which is called virtual memory, is actually a section of a hard disk that's set up to emulate the computer's RAM. The concept of virtual memory comes from 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.
When a computer runs out of RAM, the operating system (OS) will move pages of memory over to the computer's hard disk to free up RAM for other processes. This ensures that the operating system will never run out of memory and crash. Too much reliance on memory paging can impair performance, however, because random access memory operates much faster than disk memory. This means the operating system has to wait for the disk to catch up every time a page is swapped; the more a workload relies on swap files, the more it will negatively impact performance.
In a virtualized environment, the hypervisor manages physical memory. This is because a guest operating system is not aware of the virtualization layer -- it believes it has the host hardware all to itself. Approaches to memory paging in a virtual environment include:
Smart paging - used only during a VM restart when there is no memory available and none can be reclaimed.
Hypervisor swapping - provides long-term page swap support for a certain amount of memory reclamation. Because hypervisors generally have no insight into VM memory, however, the data swapped out may routinely need to be swapped back which can degrade performance.
Memory ballooning - forces the VM's guest operating system (OS) to decide which memory pages are less important and swap them to disk.