Virtual Storage Technique

Q4. Explain the virtual storage technique describing both the approaches.

Ans. A program can be stored at non contiguous locations, suppose even if we use all available free memory areas still the program cannot be loaded into the main storage because the total free memory is still less than the size of the program. To solve such a problem, we require a technique with which a program can still be executed even if all of it is not loaded in the memory. Virtual storage helps one perform such an execution. Two main approaches to virtual storage are

  • program-paging
  • program-segmentation

In Paging, the computer system is responsible for splitting a program into program segments called pages whereas in segmentation approach, the programmer identifies the logical entities in the program and declares them as program components.

Let us consider both of the approaches one by one.

  • Virtual Storage Using Paging

In paging, each program is split into fixed size program components called pages. Pages in a program, and words in a page, both are numbered from 0…….n, i.e., their logical addresses. The range 0…..n of logical addresses is called virtual address space or logical address space. The range of main storage addresses 0…n is referred to as physical address space. Thus virtual address of a program consists of p pages numbered as 0…. p-1 and the pages contain 0 to S – 1 words, where S is the page size. The physical or main memory is broken into fixed-size blocks called ‘frames’. For a program execution, its pages are loaded into any available frames and the page table (also called page map table (PMT)) is defined to translate from user pages to memory frames. PMT stores an entry for every program page which contains the frame (storage block) number where the page presently resides. The page number (0 …. P-1) is used to index this table and the corresponding frame number (i.e. physical address) is picked in order to access the page contents.

Figure: Virtual Storage Implementation Using Paging

In order to execute a program, some pages of it are loaded in the main memory depending upon storage availability. During its execution, the program generates page number which is mapped to find its physical location and then the page is accessed.


When a required page is not in the main storage, an interrupt, known as missing page interrupt, is raised. This fault/interrupt is popularly called a page fault. The OS now takes action by bringing the required page from the secondary storage into an empty page block, this operation is called page-in. After page-in, PMT entry is modified and new entrant page’s physical address is also stored in it and then the execution resumes.

What if no empty storage block is available?

In such a situation, a storahe block is vacated by moving out a page from main storage to secondary storage (process called page-out). The reading and writing of pages determines page traffic.


Def: Bringing in (page-in) the required pages is known as demand paging.


If page traffic is too much, this situation is called thrashing.


  • Virtual Storage Using Segmentation

The scheme is implemented in the same manner as paging is implemented. The point where it differs from paging is, use of program segment. A program segment is a logical unit of a program as defined by a programmer. Or we can say, it is a piece of program logic which performs a specific task. Responsibility lies on the programmer only for determining how many segments a program should have or which program unit should comprise a segment.

For accessing a particular word in the segment, it logical address consists of two parts:

  • Segment number
  • Word number.

This segment number is mapped on the ‘segment table’ to get physical address of the segment and by adding the word’s identification number, physical or actual address of the word is found out. Again the hardware unit, Address Transformation Unit, is responsible for generation of actual address of the required word within the segment.

In the same (as that of paging), segments in the memory are processed and if a segment is not available in the memory, segment missing fault interrupt is raised. So, there are obvious similarities in these two virtual storage implementation techniques.

To increases the efficiency of a system sometimes paging and segmentation is combined.  A large segment can be broken into pages. A segment obviously would be stored in contiguous area. Now within this paging can be implemented, making ‘Swapping’ possible. It improves the efficiency of the system as access of pages within the segment is fastened. The address now contains the segment-id, page number within the segment and word in a page. For each segment, a separate PMT (page map table) is maintained. Operating Systems like IBM 360/67 and MULTICS use this very technique segmentation with paging.

Leave a Reply

Your email address will not be published. Required fields are marked *