Definition

virtual memory

Contributor(s): Sonia Lelii and Herzl Regev

Virtual memory is a memory management capability of an OS that uses hardware and software to allow a computer to compensate for physical memory shortages by temporarily transferring data from random access memory (RAM) to disk storage. Virtual address space is increased using active memory in RAM and inactive memory in hard disk drives (HDDs) to form contiguous addresses that hold both the application and its data.

Computers have a finite amount of RAM so memory can run out, especially when multiple programs run at the same time. A system using virtual memory can load larger programs or multiple programs running at the same time, allowing each one to operate as if it has infinite memory and without having to purchase more RAM.

As part of the process of copying virtual memory into physical memory, the OS divides memory into pagefiles or swap files that contain a fixed number of addresses. Each page is stored on a disk and when the page is needed, the OS copies it from the disk to main memory and translates the virtual addresses into real addresses.

Pros and cons of using virtual memory

Among the primary benefits of virtual memory is its ability to handle twice as many addresses as main memory. It uses software to consume more memory by using the HDD as temporary storage while memory management units translate virtual memory addresses to physical addresses via the central processing unit. Programs use virtual addresses to store instructions and data; when a program is executed, the virtual addresses are converted into actual memory addresses.

virtual memory and memory hierarchy
Memory hierarchy

Other advantages of virtual memory are that it frees applications from managing shared memory and saves users from adding more memory modules when RAM space runs out.


Mike Murphy explains virtual memory
in this video tutorial.

However, the use of virtual memory has its tradeoffs, particularly with speed. It's generally better to have as much physical memory as possible so programs work directly from RAM or physical memory. The use of virtual memory slows a computer because data must be mapped between virtual and physical memory, which requires extra hardware support for address translations.

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.

See also: transparent page sharing, memory ballooning

This was last updated in February 2017

Continue Reading About virtual memory

Dig Deeper on Storage virtualization

PRO+

Content

Find more PRO+ content and other member only offers, here.

Join the conversation

3 comments

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What virtual memory management techniques have you used?
Cancel
Great article Margaret! Does anyone have any tips and tricks for increasing virtual memory on their operating systems?
Cancel
This is a great and easy to understand explanation of Virtual Memory. Thank you.
Cancel

-ADS BY GOOGLE

File Extensions and File Formats

SearchSolidStateStorage

SearchCloudStorage

SearchDisasterRecovery

SearchDataBackup

Close