What Is Virtual Memory? Ultimate Guide on How It Works | ESF (2024)

Enterprise Storage Forum content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Virtual memory enables a system to run larger applications or run more applications at the same time without running out of random access memory (RAM). Specifically, the system can operate as if its total RAM resources were equal to the amount of physical RAM plus the amount of virtual RAM.

Virtual memory is an important technology for enterprises with key applications that have high central processing unit (CPU) requirements. High-capacity storage devices, like hard disk drives (HDDs) and solid-state drives (SSDs) enable business-grade application performance. They also save businesses money because using a storage device for virtual memory costs less than having a large CPU. In this guide, learn all about virtual memory and how it can help IT teams.

Guide to virtual memory

  • How virtual memory works
  • Advantages of using virtual memory
  • Disadvantages of using virtual memory
  • Virtual vs. physical memory
  • Two types of virtual memory
  • Example of how virtual memory is used
  • How to manage virtual memory in an OS
  • Bottom line

How virtual memory works

Virtual memory is an area of a computer system’s secondary memory storage space, such as an HDD or SSD, that acts as if it were a part of the system’s RAM or primary memory.

Ideally, the data needed to run applications is stored in RAM, where the CPU can quickly access it. But when the system is running large applications or when many applications are running at once, the system’s RAM may fill completely.

There’s a workaround to this problem: data stored in RAM that isn’t actively being used can be temporarily moved to virtual memory, which is physically located on a hard drive or other storage device. This frees up space in RAM, which can then accommodate data the system needs to access immediately.

By swapping data between RAM and virtual memory when it is not needed and back from virtual memory to RAM when it is needed, a system can continue to work smoothly with far less physical RAM than it would otherwise require.

Learn about the difference between memory and storage.

Advantages of using virtual memory

Virtual memory has multiple advantages for computer systems:

  • More applications can run at the same time on the same system
  • Larger applications can run on systems that don’t have enough physical RAM alone to run them
  • Increasing memory with virtual memory is less costly than buying more RAM
  • It increases memory in a system that already has the maximum RAM that its hardware and OS can support.

Disadvantages of using virtual memory

Virtual memory has a few disadvantages as well:

  • It doesn’t offer the same performance as RAM
  • It can negatively affect the overall performance of a system, causing slowdowns
  • It takes up storage space, which could otherwise be used for long-term data storage

Virtual vs. physical memory

Virtual memory is a form of logical memory. Logical memory is read by computers as primary memory, but it exists on a local drive and isn’t directly accessed by the CPU. The computer reads the address for logical memory as though it is in the motherboard as well. However, because it’s not actually in the motherboard, retrieving this data can take longer than retrieving data from volatile memory.

In comparison, physical memory, the space specifically dedicated to RAM on the computer’s motherboard, is volatile. That storage only exists when the computer is powered on, and it disappears when the computer shuts down.

Two types of virtual memory

Memory management systems use two types of virtual memory methods to improve application performance.

Paging

In a system that uses paging, RAM is divided into a number of blocks called pages, usually 4K in size. Processes are then allocated just enough pages to meet their memory requirements. This means there will always be a small amount of memory wasted, except in the unusual case where a process requires exactly a whole number of pages.

During the normal course of operations, pages are swapped between RAM and a page file, which represents the virtual memory.

Segmentation

Segmentation is an alternative approach to memory management: Instead of pages of a fixed size, the memory management system allocates segments of differing length to processes to exactly meet their requirements. Unlike in a paged system, no memory is wasted in a segment.

Segmentation also allows applications to be split up into logically independent address spaces, which can make them easier and more secure to share.

One downside to segmentation is that because each segment is a different length, it can lead to memory fragmentation. As segments are continually allocated and de-allocated, small chunks of memory are scattered within the memory space. They’re too small to be useful.

As these small chunks build up, fewer and fewer segments of useful size can be allocated. It’s difficult for the OS to keep track of all these segments, and each process will need to use multiple segments. This is inefficient and can reduce overall application performance.

Read more about paging and segmentation.

Example of how virtual memory is used

An IT manager uses an Apple laptop, which runs macOS. They have all their standard work applications, like Gmail and Slack, active. But they also use Atera, a popular remote monitoring and management software. This platform allows IT managers to monitor all company devices and employee usage statistics. This program uses more memory than the laptop’s RAM can handle at one time. To compensate for the lack of memory, the computer’s memory management unit moves the virtual memory data to the CPU.

If the virtual memory performance of the IT manager’s computer declines, swapping the secondary memory format, a hard drive, to a solid-state drive may speed performance. SSDs are flash memory, and overall, they read data faster than hard drives.

How to manage virtual memory in an OS

On Windows, after navigating to the start menu and to settings, enter performance in the search bar. Choose adjust the appearance and performance of Windows. Select the advanced tab in the window that comes up. In the virtual memory section, select change. Enter desired sizes in the initial size and maximum size boxes; both values are in megabytes.

In Mac operating systems, adjusting virtual memory is a little less simple. One tactic to increase performance is to add more storage space to a computer’s RAM. However, this is expensive. Installing a larger hard drive creates more virtual memory capacity. Users can also reset the parameter random access memory (PRAM) and non-volatile random access memory (NVRAM).

Bottom line: Importance of virtual memory

Virtual memory increases the capability of companies’ computers and servers by providing additional space aside from the limited capacity of the CPU. Although virtual memory is slower than random access memory, it’s critical for overall operating system performance.

Virtual memory combined with physical memory enables computers to support both more applications and allocate enhanced storage resources. The virtual memory provided by secondary storage is used by organizations to equip computers to handle greater data loads.

Read more about memory management in computer systems next.

What Is Virtual Memory? Ultimate Guide on How It Works | ESF (2024)

FAQs

What Is Virtual Memory? Ultimate Guide on How It Works | ESF? ›

Virtual memory is a form of logical memory. Logical memory is read by computers as primary memory, but it exists on a local drive and isn't directly accessed by the CPU. The computer reads the address for logical memory as though it is in the motherboard as well.

What is virtual memory and how does it work? ›

Virtual memory is a common technique used in a computer's operating system (OS). Virtual memory uses both hardware and software to enable a computer to compensate for physical memory shortages, temporarily transferring data from random access memory (RAM) to disk storage.

What should I set my virtual memory to for 32GB RAM? ›

Note: Microsoft recommends that virtual memory be set at no less than 1.5 times and no more than 3 times the amount of RAM on the computer.

What should my virtual memory be set at 16GB RAM? ›

However, with advancements in technology and more efficient operating systems, this rule is not as rigid as it once was. For a system with 16GB RAM, setting the virtual memory between 24GB to 32GB is a good starting point, but adjustments might be needed based on specific use cases.

How much virtual memory should I set for 8GB RAM? ›

As a rule of thumb, the paging file should be a minimum of 1.5 times the size of your installed RAM, and a maximum of 3 times your RAM size.

What is virtual memory in simple words? ›

Virtual memory is a method that computers use to manage storage space to keep systems running quickly and efficiently. Using the technique, operating systems can transfer data between different types of storage, such as random access memory (RAM), also known as main memory, and hard drive or solid-state disk storage.

What is the main purpose of virtual memory? ›

Virtual memory provides virtual address mapping between applications and hardware memory. It provides many functions, including multitasking (multiple tasks executing at once on one CPU), allowing multiple processes to access the same shared library in memory, swapping, and other functions.

What should my virtual memory be set at? ›

Microsoft recommends that you set virtual memory to be no less than 1.5 times and no more than 3 times the amount of RAM on your computer. For power PC owners (like most UE/UC users), you likely have at least 2GB of RAM so your virtual memory can be set up to 6,144 MB (6 GB).

Should I increase virtual memory? ›

Virtual memory is used by your system to expand the available RAM when memory runs low, but it can impact performance. Increasing the size of your virtual memory can help alleviate slowdown issues, but upgrading your RAM is the best solution for improved system speed and performance.

Can I use virtual memory as RAM? ›

At the hardware level, the CPU cannot execute code “directly” from hard disk/SSD storage, it does not reside within the CPU's address space. Physical RAM, of course, does. So the only way virtual memory can be used is as a place to temporarily stick the data that previously resided in some page(s) of physical memory.

What happens if virtual memory is too high? ›

If you allocate more virtual memory, then if you run jobs that are too big, they'll take an unpredictable, very long time. And depending on the allocations, may still fail.

How to maximize virtual memory? ›

Increasing Virtual Memory in Windows 10

Choose Adjust the appearance and performance of Windows. In the new window, go to the Advanced tab and under the Virtual memory section, click on Change. At the bottom of the new window, check what the Recommended value is and how it compares to Currently allocated.

What is the ideal paging file size? ›

A system managed Page File will be adequate is most use cases, unless you are experiencing problems. The Page File should be approximately 1.5 - 2 times the size of your total system memory (RAM). A computer with 4GB of RAM will need a Page File a minimum of 6GB (6144 MB) and a maximum of 8GB (8192MB).

Should virtual memory be on C or D? ›

Microsoft advice when setting virtual memory is to enable it on all drives, maybe set to Auto, and Windows will take care of rest. Windows knows speed of each drive and will use them as needed. Eg if C drive is busy it will switch to D drive, etc. For most users setting swap file to Auto is more than enough.

What is the best paging size for 8gb RAM? ›

On computers that have 8 GB of RAM, the suggested paging file size is 16 GB.

What is the recommended page file size for 16GB RAM? ›

For systems with more RAM, you can make the paging file somewhat smaller. You could trim the paging file to 2 GB on a 16 GB system, for example, or to 3.5 GB on a 32 GB system without running into any noticeable performance problems.

What is an example of how virtual memory works? ›

For example, suppose a program requires 5 GB of memory, but the computer system has only 4 GB of RAM installed. In this case, the virtual memory system will allocate additional memory needed by creating a larger virtual address space and mapping it to both the available RAM and the computer's secondary storage device.

Does increasing virtual memory improve performance? ›

But adding 4GB virtual RAM over 4GB physical RAM is not the same as having 8GB RAM in a mobile phone. At best, the marketing gimmick is good for keeping more apps running in the background, but has little impact in improving the overall performance of the phone or running heaving apps.

How do you use virtual memory? ›

Click Start > Settings > Control Panel. Double-click the System icon. In the System Properties dialog box, click the Advanced tab and click Performance Options. In the Performance Options dialog, under Virtual memory, click Change.

What is the main disadvantage of virtual memory? ›

Despite its advantages, virtual memory also has a negative side to it. It has been observed that virtual memory operates at much slower speeds than computer RAM. If the OS juggles data between virtual memory and RAM continuously, it can slow down the computer considerably.

Top Articles
Latest Posts
Article information

Author: Duncan Muller

Last Updated:

Views: 5591

Rating: 4.9 / 5 (59 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Duncan Muller

Birthday: 1997-01-13

Address: Apt. 505 914 Phillip Crossroad, O'Konborough, NV 62411

Phone: +8555305800947

Job: Construction Agent

Hobby: Shopping, Table tennis, Snowboarding, Rafting, Motor sports, Homebrewing, Taxidermy

Introduction: My name is Duncan Muller, I am a enchanting, good, gentle, modern, tasty, nice, elegant person who loves writing and wants to share my knowledge and understanding with you.