All about virtual memory
In computing, virtual memory is a memory management technique developed for multitasking kernels. This technique virtualises a computer architecture's various forms of computer data storage, such as Random Access Memory and disk storage, thus allowing a program to be designed as though there is only one kind of memory, "virtual" memory, which behaves like directly addressable read/write memory. (RAM) . Read this article to learn more about virtual memory.
/wedata%2F0029907%2F2011-08%2FComputer-Mess.jpg)
History
Virtual memory was introduced to the x86 architecture with the protected mode of the Intel 80286 processor, but its segment swapping technique scaled poorly to larger segment sizes. The Intel 80386 introduced paging support underneath the existing segmentation layer, enabling the page fault exception to chain with other exceptions without double fault. However, loading segment descriptors was an expensive operation, causing operating system designers to rely strictly on paging rather than a combination of paging and segmentation.
Page tables
Page tables are used to translate the virtual addresses seen by the application into physical addresses used by the hardware to process instructions. Such hardware that handles this specific translation is often known as the memory management unit. Each entry in the page table holds a flag, indicating whether the corresponding page is in real memory or not. If it is in real memory, the page table entry will contain the real memory address at which the page is stored. When a reference is made to a page by the hardware, if the page table entry for the page indicates that it is not currently in real memory, the hardware raises a page fault exception, invoking the paging supervisor component of the operating system.
Paging supervisor
This part of the Operating System creates and manages page tables. If the hardware raises a page fault exception, the paging supervisor accesses secondary storage, returns the page that has the virtual address that resulted in the page fault, updates the page tables to reflect the physical location of the virtual address and tells the translation mechanism to restart the request. When all physical memory is already in use, the paging supervisor must free a page in primary storage to hold the swapped-in page. The supervisor uses one of a variety of page replacement algorithms, such as least recently used to determine which page to free