What is demand paging and how does it improve memory usage?

Technical
Medium
Flipkart
99.1K views

Tests knowledge of virtual memory management and the technique of loading pages only when needed.

Why Interviewers Ask This

Demand paging is core to modern OS memory management. Interviewers assess your understanding of how systems handle large applications with limited physical RAM and the concept of page faults.

How to Answer This Question

Define demand paging as loading pages into memory only when referenced. Explain the role of the page table and page fault handler. Discuss benefits like reduced startup time and efficient memory utilization. Mention challenges like thrashing if not managed well.

Key Points to Cover

  • Lazy loading concept
  • Page fault handling
  • Memory efficiency benefits
  • Thrashing risks

Sample Answer

Demand paging loads pages into main memory only when they are actually needed by the process, rather than loading the entire program at once. This reduces initial load time and saves physical memory. When a page is missing, a page fault occurs, triggering the OS to fetch it from disk, balancing speed and storage constraints effectively.

Common Mistakes to Avoid

  • Confusing demand paging with swapping
  • Ignoring the cost of page faults
  • Not mentioning the working set model

Practice This Question with AI

Answer this question orally or via text and get instant AI-powered feedback on your response quality, structure, and delivery.

Start Practicing

Related Interview Questions

Browse all 78 Technical questionsBrowse all 52 Flipkart questions