Virtual memory is a feature of an operating system (OS) that allows a computer to compensate for shortages of physical memory by temporarily transferring pages of data from random access memory (RAM) to disk storage.
Eventually, the OS will need to retrieve the data that was moved to temporarily to disk storage -- but remember, the only reason the OS moved pages of data from RAM to disk storage to begin with was because it was running out of RAM. To solve the problem, the operating system will need to move other pages to hard disk so it has room to bring back the pages it needs right away from temporary disk storage. This process is known as paging or swapping and the temporary storage space on the hard disk is called a pagefile or a swap file.
Swapping, which happens so quickly that the end user doesn't know it's happening, is carried out by the computer’s memory manager unit (MMU). The memory manager unit may use one of several algorithms to choose which page should be swapped out, including Least Recently Used (LRU), Least Frequently Used (LFU) or Most Recently Used (MRU).
In this video tutorial, Mike Callahan explains how virtual memory works in the Windows 7 operating system.
In a virtualized computing environment, administrators can use virtual memory management techniques to allocate additional memory to a virtual machine (VM) that has run out of resources. Such virtualization management tactics can improve VM performance and management flexibility.