0
0
Operating Systemsknowledge~20 mins

Demand paging in Operating Systems - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Demand Paging Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What happens during a page fault in demand paging?

In demand paging, when a program accesses a page not currently in physical memory, a page fault occurs. What is the immediate action taken by the operating system?

AThe OS loads the required page from secondary storage into physical memory.
BThe OS terminates the program immediately due to illegal memory access.
CThe OS ignores the request and continues execution without loading the page.
DThe OS swaps out all pages to free memory before loading the requested page.
Attempts:
2 left
💡 Hint

Think about what the OS must do to allow the program to continue after accessing a missing page.

📋 Factual
intermediate
2:00remaining
Which component keeps track of pages currently in physical memory?

In demand paging, which data structure does the operating system use to know which pages are loaded in physical memory?

AProcess control block
BFile allocation table
CInterrupt vector table
DPage table
Attempts:
2 left
💡 Hint

This structure maps virtual addresses to physical addresses.

🔍 Analysis
advanced
2:00remaining
Why can demand paging improve system performance?

Demand paging loads pages only when needed. Which of the following best explains how this improves system performance?

AIt duplicates pages in memory to speed up access times.
BIt preloads all pages before execution, ensuring no delays during program run.
CIt reduces the amount of physical memory used by loading only necessary pages, decreasing disk I/O and speeding up execution.
DIt disables virtual memory, allowing direct access to physical memory.
Attempts:
2 left
💡 Hint

Consider how loading fewer pages initially affects memory and disk usage.

Comparison
advanced
2:00remaining
Difference between demand paging and pre-paging

Which statement correctly contrasts demand paging with pre-paging?

ADemand paging loads pages only when referenced; pre-paging loads pages before they are referenced based on prediction.
BDemand paging loads all pages at program start; pre-paging loads pages on demand.
CDemand paging uses no page table; pre-paging uses a page table.
DDemand paging swaps out pages immediately; pre-paging never swaps pages.
Attempts:
2 left
💡 Hint

Think about when pages are loaded in each method.

Reasoning
expert
2:00remaining
What is the impact of thrashing in a demand paging system?

Thrashing occurs when a system spends more time handling page faults than executing processes. What is the main cause of thrashing in demand paging?

AThe CPU clock speed is too high, causing rapid page faults.
BThe working set of a process is larger than the available physical memory, causing constant page replacements.
CThe disk is too fast, leading to excessive page loading.
DThe page table is corrupted, causing incorrect page mappings.
Attempts:
2 left
💡 Hint

Consider what happens when the memory needed by a process exceeds what is available.