Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
Virtual memory (VM) is a feature developed for the kernel of an operating system (OS) that simulates additional main memory such as RAM (random access memory) or disc storage. This technique involves the manipulation and management of memory by allowing the loading and execution of larger programs or multiple programs simultaneously. It also allows each program to operate as if it had infinite memory, and is often considered more cost effective than purchasing additional RAM.
Virtual memory permits software to use additional memory by utilizing the hard disc drive (HDD) as temporary storage. Most central processing units (CPUs) provide memory management units (MMUs) that support virtual memory. The MMU supports the “page tables” that are used to transform the “real” and “virtual” addresses located in memory and on the HDD.
An OS that uses virtual memory frees up space by transferring data from the HDD which is not immediately required. When the data is needed, it is copied back to the HDD. When all RAM is being used, VM swaps data to the HDD and then back again. Thus, VM allows a larger total system memory; however, complicated code writing is required.
In the 1940s and 1950s, prior to VM, large programs implemented logic to manage primary and secondary storage. The process was called overlaying. When a program was bigger than memory storage, the procedure allowed parts of the program that were not continuously used to be treated as an overlay. Each individual overlay would overwrite current overlay in memory. The programming for overlaying was extensive. One of the main reasons for creating VM was not for additional primary memory but for ease of programming. By 1969 the effectiveness of virtual memory was realized; and it became widely implemented.
VM literally attempts to use more RAM, or disc storage memory, than actually exists. This process allows the CPU to handle larger and multiple programs simultaneously. VM is an ordinary operating system (OS) and hardware program that utilizes an HDD by temporally storing and controlling memory. The process of manipulating and managing memory allows each application to function as if it had nearly infinite memory. The temporary memory storage is managed by a memory management unit (MMU), also known as a “paged memory management unit” (PMMU).
“Real” memory is divided into small sections called “pages.” The pages are generally 4 kilobytes in size. When all RAM or disc memory is used, any page not used is written to virtual memory in what is called a swap file. When the swap file is needed, it is then translated back to “real” memory, a process called page swapping.
One of the few drawbacks of using VM is that there can be excessive page swapping, especially if a user has numerous open applications. This can cause programs to drastically slow down as the CPU spends much time writing to the HDD. The significant reduction in performance is called thrashing.