[2021] What is Virtual Memory? - AG Singh Mehra

 Virtual Memory is a memory-management scheme where only a portion of the virtual address space of a " resident " process may actually be loaded into physical memory. 

In other word, Virtual memory allows execution of partially loaded process. Virtual Memory system routinely provide apparent utilization in excess of 100%! Moreover, the allowable size of the virtual- address space of a single process system. 

For Example: The virtual- address space of a process of a VAX computer can be up to 4GB, whereas some early models of VAX supported a maximum of only 8MB of physical memory. 

This feat is accomplished by maintaining an image of the entire virtual- address space of a process on secondary storage.

The details of virtual memory management are generally transparent to programmers. Being provides. Being provided with the illusion of a much larger memory than may actually be available, programmers are practically relieved of the burden of trying to fit a program into limited memory. Moreover, the same program may run without reprogramming or recompilation on system with significantly different capacities of installed memory.  

The basic idea of virtual memory is to execute partially loaded programs. But does it really make sense? An instruction can be completed only if all code, data, and stack locations that it references reside in physical memory. 

Virtual Memory





"The maximum program execution speed of a virtual memory system can equal but never exceed the execution speed of the same program with virtual memory turned off "

Virtual memory can be implemented as an extension of paged or segmented memory management or as a combination both. Accordingly, address translation is performed by means of page-map tables, segment descriptor tables, or both. The important characteristic is that in virtual  memory system some portions of the address space of the running process can be absent from main memory. To emphasize the distinction, the term real memory is often used to denote physical memory. The main visible advantage of the scheme is that programs can be lager then physical memory. 

Virtual memory is commonly implemented by demand paging. It can also be implemented in a segmentation system. Demand segmentation can also be used to provide virtual memory.

Virtual Memory enables a computer to be able to compensate shortages of physical memory by transferring pages of data from RAM to disk storage.

Management of virtual memory:

Assuming that paging is used as an underlying memory-management scheme , the implementation of virtual memory requires maintenance of one page-map table (PMT) per active process. Given that the virtual-address space of a process may exceed the capacity of real memory, the size of an individual PMT can be much lager in a virtual than in a real paging system with identical page sizes. The operating system maintains one memory-map table (MMT) or a free-frame list to keep track of portion of physical memory that are available for allocation.

A new component of the memory manager's data structures is the file-map table (FMT). In principle, an FMT contain secondary storage addresses of all pages. The memory manager  uses the FMT to load the missing items into the main memory. One FMT is maintained for each active process. Its base may be kept in the control block of the related process. An FMT has a number of entries identical to that of  the related PMT. A pair of page map table base and page map length registers may be provided in hardware to expedite the address translation process and to reduce the size of PMT for smaller processes, As with paging, the existence of a translation lookaside buffer is highly desirable to reduce the negative effects of mapping on the effective memory bandwidth. Having described most of these issues in relation to paging, we now concentrate on those aspects that are specific to the management of the virtual memory. 
           
                The allocation of only a subset of real page frames to the virtual address space of a process requires the incorporation of certain polices into the virtual memory manager. In terms of their relative order of appearance in handling a process, we may classify these policies as follows :
  1. Allocation policy: How much real memory to allocate to each active process.
  2. Fetch Policy: Which items to bring and when to bring them from secondary storage into the main memory.
  3. Replacement policy: When a new item is to be brought in and there is no free real memory, which item to evict in order to make room for the new one.
  4. Placement policy: Where to place an incoming item.
In most implement , items are fetched when the running process causes a missing item exception. In other words, the demands for executing processes dictate the identity and timing of the fetching of items. Accordingly, we speak of demand paging or of demand segmentation. Although anticipatory or prefetching policies are also conceivable, few implementations of virtual memory rely on these because of the difficulty of making accurate predications of future memory requirements of processes.
                Depending on the types of items shuttled between the disk and the main memory, the placement policy follows the rules discussed in relation to segmentation and paging. In the case of paging, placement is straightforward, as any free page frame is equally suitable foe housing a page.
                Replacement and allocation policies are somewhat more involved, and we treat them in separate sections, after a brief overview pf program behavior. 

Comments

Post a Comment

If you have any question . So Please comment.