Virtual Memory Management

Filter Course


Virtual Memory Management

Published by: Zaya

Published date: 22 Jun 2021

Virtual Memory Management Photo

Virtual Memory

Virtual Memory is a storage scheme that provides users the illusion of having a very big main memory. This is done by treating a part of secondary memory as the main memory.

In this scheme, the User can load the bigger size processes than the available main memory by having the illusion that the memory is available to load the process.

Instead of loading one big process in the main memory, the Operating System loads the different parts of more than one process in the main memory.

By doing this, the degree of multi-programming will be increased and therefore, the CPU utilization will also be increased.

How Virtual Memory Works?

In the modern world, virtual memory has become quite common these days. In this scheme, whenever some pages need to be loaded in the main memory for the execution and the memory is not available for those many pages, then in that case, instead of stopping the pages from entering in the main memory, the OS search for the RAM area that is least used in the recent times or that are not referenced and copy that into the secondary memory to make the space for the new pages in the main memory.

Since all this procedure happens automatically, therefore it makes the computer feel like it is having unlimited RAM.

Snapshot of a virtual memory management system

Let us assume 2 processes, P1 and P2 contains 4 pages each. Each page size is 1 KB. The main memory contains 8 frames of 1 KB each. The OS resides in the first two partitions. In the third partition, 1st page of P1 is stored and the other frames are also shown as filled with the different pages of processes in the main memory.

The page tables of both the pages are 1 KB size each and therefore they can be fit in one frame each. The page tables of both the processes contain various information that is also shown in the image.

The CPU contains a register that contains the base address of the page table that is 5 in the case of P1 and 7 in the case of P2. This page table base address will be added to the page number of the Logical address when it comes to accessing the actual corresponding entry.

Virtual Memory

Advantages of Virtual Memory

  1. The degree of Multi-programming will be increased.
  2. Users can run the large applications with less real RAM.
  3. There is no need to buy more memory RAMs.

Disadvantages of Virtual Memory

  1. The system becomes slower since swapping takes time.
  2. It takes more time in switching between applications.
  3. The user will have lesser hard disk space for its use.