Virtual memory is a mechanism or system. This system deals with Virtual addresses from Virtual address space. Each process running under windows gets virtual memory addresses starting from 0 to 4,294,967,295 (2*32-1 = 4 GB), no matter how much RAM is installed on the system.
That is; each user process typically has 4gb virtual address space (VAS). User process could see only the VAS area, which will in turn map to physical memory. Virtual memory address makes the user process to think in such a way that at any point in time, user process can address more memory than the physical memory(RAM) available in the system. Also the user process will have the impression that all the memory it deals with are contiguous.
The map between the virtual address & physical memory is done using page table entries(PTE). Each user process will have a page table which is an internal data structure translate virtual address to its corresponding physical address. The page table tells the process where the page is stored, whether in the disk or in the ram. PTE are present in the main memory.
PTE will have the information, where the page is available. ie., whether the page is available in the disk of physical memory. If the page is not loaded into memory, the loaction of disk will be there in the PTEs.
If the page has to be loaded, a hard page fault will be triggered & the page will be loaded to the memory(ram). Once the page is in the RAM the PTE is updated to reflect the page frame number/location.
Comments are closed