/    /  OS -Virtual Memory In Operating System

Virtual Memory In Operating System

 

What is virtual memory?

The extra memory that the computer can address alongside the amount physically installed on the system is known as virtual memory. 

It is beneficial as it helps programs that are larger than the physical memory to run on it. 

Virtual memory aims to:

  1. Extend the use of physical memory by using a disk. 
  2. It enables us to have memory protection. 

 

It is a technique used by the software and hardware to map the memory addresses used by a program into the physical addresses in computer memory. 

 

Advantages of virtual memory:

  1. Less number of I\O devices are required to load the user program into memory.
  2. A program is not limited to the physical memory available.
  3. More programs can be run at the same time as each program takes up less physical memory.

 

Demand Paging

Demand paging is the process of loading the page into the memory on demand.

It includes the following steps:

  1. In a case where the CPU tries to refer to a page that is not available, it generates an interrupt indicating memory access fault.
  2. The Operating System will then put the interrupted processes in a blocking state.
  3. To proceed with the execution the OS must bring the required page to the memory.
  4. Then the required page will be shifted from the logical address space to the physical address space.
  5. The page is then updated depending on the decisions made by the page replacement algorithm. 
  6. After the update, the signal is sent to the CPU for the continuation of execution of the program. 

 

Reference

Virtual Memory In Operating System