Advantage of virtual memory in operating system

advantages of virtual memory

It is very important to understand the concept of memory management although Memory management is the very typical topic. A 32-bit (MIPS) processor promise to each program to provide the 32-bit address space means that every program has the right to access any bytes between the address of 0 to (2^32 -1).

Note:  32-bit address space means, you have right to access the 4 GB of memory.

In initial era of computer processor directly access the physical memory of the system to perform the read and write operation.

The main problems arise when the system does not have the adequate amount of physical memory (RAM). In that situation, if the program tries to get access the address which does not exist in the physical address space then the system could be a crash.

So initially the concept of virtual memory come to avoid the lesser memory issues but nowadays it plays the vital role and solves many other problems.The virtual memory is the part of memory management techniques and it creates an illusion that the system has a sufficient amount memory.In another word you can say that virtual memory is a layer of indirection.

In initial era of computer, computer rarely has 4GB RAM but it is the common today for the new generation PC. So initially the concept of virtual memory come to solve the lesser memory issues in the system but nowadays virtual memory not only solve the lesser memory issues but it also solves some other issues which usually come into a PC when there is more than one application running at a time.

In this article, I am describing some issues which make your PC slow and also describe the advantages of virtual memory.

Some Issues related to memory

Lesser memory issues:

It’s the most dangerous issues which generally occur when your system has a little amount of RAM, I have already described this issue at the beginning of the article.We can solve this issues using the concept of virtual memory, it creates an illusion of there is a lot of memory available in the system using the technique of indirection.
Without the virtual memory program address directly map to the RAM addresses that means there is one to one relation exist between the program and ram memory addresses.To make more clear this scenario supposes there is any program address like 0x05 and this address directly map with the RAM address 0x05 but anyhow if this location not available in RAM then your system will be the crash.

virtual memory

We can solve this problem by using the virtual memory, it prevents from the one-one mapping between the program and  RAM address and it creates a layer between the RAM and program address which is used to map the program address and RAM address and prevent the system being crash.

Image to show how to virtual memory handles the lesser memory scenario

virtual memory advantages

Memory hole

Suppose there is two programs running simultaneously.The first program required 512 MB and second program required 1 GB of physical memory for the execution.

virtual memory
When the first program is terminated by the user then memory which occupied by the first program will be released and now we have the total 1GB amount of free space to execute the other program, but there is one drawback, free memory is not continuous.
So if the user runs a third program which has required only 1 GB of physical memory still unable to execute because it wants a continuous 1GB free memory even though we have 1 GB of memory space that’s the cause of memory fragmentation.

benefits of virtual memory


We can solve this problem using the virtual memory because, with virtual memory, we do not directly access the physical memory MMU play a vital role and map the program address space to the physical address space.Each program has own mapping and using the mapping we can put our program data wherever we want in the RAM.

mapping virtual memory

If you want to learn more about the Windows Internals or another technology, here 10 Free days trial for you.


Keep Program secure

We know that each program can access any 32bit memory of address.So the problem occurs when two programs share the same address (like 512) of address space to store their result.
In that situation result of one program can be altered by another program and we will not get our desired result.It’s the biggest issues which can be solved by the virtual memory.

advantages and disadvantages of virtual memory in computer architecture

I have already described, with virtual memory program address map with RAM address.Here program 1 and 2 have the own program address space so they can not access each other data and their program address space map with different RAM address.

virtual memory map


Your opinion matters

Although here, I have tried to discuss a few advantages of virtual memory but I would like to know your opinion on the advantage of virtual memory. So please don’t forget to write a comment in the comment box.


  1. good job,but for the memory constraint embedded soc system ,tradeoff of virtual memory is too big to use for some os.which run on simple mcu.

  2. Can you please explain in detail like where program will be stored. When it is loaded in to RAM and when it is loaded in to virtual memory. When it loaded back from virtual memory to RAM. What happens when RAM memory is not sufficient to load program. I mean if program size of 4GB, but RAM size is 2GB.

Leave a Reply