5.4. Virtual Memory ManagementΒΆ
The Paged Memory Management scheme gives rise to the notion of demand paging using virtual memory. The Virtual Memory Management system maintains a copy of the memory for all programs on secondary storage, such as a hard drive. In fact, many pages for a process may only reside in virtual memory. Loading only the page frames that are needed to run a program can make it faster to load a program. Some memory frames for a program may never be needed while the program runs.
If a current copy of a frame of physical memory is held on disk in virtual memory, then that frame may be removed from physical memory to free up needed memory. When a process references memory that is not loaded in physical memory, the Memory Management Unit of the CPU issues a page fault trap.
The tasks of the Virtual Memory Management system include:
- Maintaining the virtual memory with a reasonably current copy of memory.
- Keeping the page tables current.
- Responding to page faults by loading the requested memory frames into physical memory.
The performance of a virtual memory management system depends on the total number of page faults, which depend on:
-
The page replacement algorithm
Select which frames are to be replaced when a page fault occurs. (Page Replacement Algoritms)
-
The frame allocation algorithm
Decide how many frames to allocate to each process. (Frame Allocation)
Contents: