OS & Hardware

Which describes demand paging?

  1. AAll pages are loaded into physical memory when a program starts
  2. BFrequently used pages are pinned permanently in the cache instead of on disk
  3. CA page fault occurs on a page's first use, and the page is loaded into physical memory then
Show answer and explanation

Answer: C. A page fault occurs on a page's first use, and the page is loaded into physical memory then

Under demand paging, starting a program only sets up page tables without loading actual pages. The first access to a page causes a page fault, and the OS loads just that page from disk. Startup is faster and no memory is spent on code or data that is never used. It is the opposite of loading everything up front and has nothing to do with pinning pages in the cache.

  • A. It is the opposite of loading everything first.
  • B. It has nothing to do with pinning data in the cache.
  • C. Correct. Pages are loaded when they are needed.
Practice this topic Back to topic

More OS & Hardware questions

  1. In the clock (second-chance) page-replacement algorithm, what is each page's reference bit used for?
  2. With FIFO page replacement, adding physical pages can sometimes increase page faults. What is this phenomenon called?
  3. What is the state called in which physical memory is so short that pages are constantly evicted and reloaded and little work gets done?
  4. Memory access time is 100 ns and handling a page fault takes 8 ms. If a page fault occurs once per million accesses, what is the average access time approximately?
  5. During a context switch, what must be saved for the process being switched out?