Memory Virtualization

 Virtual Memory

Virtual memory is the illusion of memory that is larger than the real memory RAM of a computer system. Virtual memory is a technique that allows the execution of programs that are not completely in the memory. The major advantage of virtual memory is programs can be larger than physical memory

Virtual memory can be implemented through Demand paging and Segmentation.

Demand Paging:

An executable program must be loaded from disk to memory in two ways:

1) Load the entire program into physical memory at program execution time.
2) Load pages only when they are needed.

The process of loading pages only at the time of need is known as demand paging. Through this technique, only the pages which are needed are loaded during program execution. Pages that are never accessed are never loaded into the physical memory.


Segmentation:

To know about segmentation we have to know about segments. Segments are uneven-sized blocks of the user program and secondary memory.

A segment table is used to store the information of all segments of the currently executing process. Segmentation divides processes into smaller subparts known as modules. The divided segments need not be placed in contiguous memory.

Segmentation can be divided into two types:

1. Virtual memory segmentation:  Virtual memory segmentation divides the processes into n number of segments. All the segments are not divided at a time. Virtual memory segmentation may or may not take place at runtime.

2. Simple Segmentation: It also divides the process into n number of segments but the segmentation is done all together at once. Simple segmentation takes place at the run time of the program.