What is Virtual Memory? How is it implemented in Operating Systems?
What is Virtual Memory? How is it implemented?
637
26-Mar-2023
Updated on 02-Apr-2023
Krishnapriya Rajeev
01-Apr-2023Virtual memory is a memory management technique used by modern operating systems to provide a larger address space than the physical memory available on a computer. It allows a process to use more memory than what is physically available by creating a virtual address space for the process, which is mapped to physical memory by the operating system.
The virtual memory system divides the virtual address space into fixed-size blocks called pages. Each page is mapped to a physical page frame in the physical memory. When a process tries to access a memory location in its virtual address space that is not currently in physical memory, a page fault occurs. The operating system then fetches the page from the disk and brings it into a free page frame in physical memory. This process is known as page swapping.
The implementation of virtual memory involves several components, including:
One advantage of virtual memory is that it enables a computer to run more programs or larger programs than it could otherwise, by using disk space as additional memory. Another advantage is that it provides memory protection, which prevents a program from accessing the memory space of another program.
However, it also causes increased overhead due to page swapping, which slows down the system's performance.