Page Faults


If the valid bit for virtual page is off, a page fault occurs. The operating system must be given control. Once the operating system gets control, it must find the page in the next level of the hierarchy (usually disk) and decide where to place the requested page in main memory.

Because we want to minimize the number of page faults, most operating systems try to choose a page that they hypothesize will not be needed in the near future. Use the past to predict the future, operating systems follow the least recently used (LRU) replacement scheme.

The above figure shows the page table maps each page in virtual memory to either a page in main memory or a page stored on disk. The virtual page number is used to index the page table. With a 32-bit virtual address, 4 KiB pages, and 4 bytes per page table entry, compute the total page table size?