Demand Paging and Working Set Model Fundamentals Quiz Quiz

Assess your understanding of demand paging, page faults, and the working set model in memory management. This quiz covers core concepts, common scenarios, and essential terminology for efficient virtual memory operation.

  1. Basic Concept of Demand Paging

    In demand paging, which event typically causes a page to be loaded into main memory for the first time?

    1. The operating system loads all pages at process start.
    2. The user preselects which pages to load.
    3. A page fault occurs when the page is accessed.
    4. All pages are kept in memory at all times.

    Explanation: Demand paging loads pages into memory only when a page fault indicates the page is needed. Preloading all pages at process start is not demand paging, but eager loading. Memory is limited, so keeping all pages in memory or relying on user selection is not typical of demand paging. Page faults efficiently signal which pages are required.

  2. Page Fault Scenario

    What happens when a process tries to access a page that is not currently in physical memory?

    1. The process immediately terminates.
    2. The page is ignored and processing continues.
    3. The operating system swaps out the entire process.
    4. A page fault occurs, and the missing page is loaded from secondary storage.

    Explanation: When a required page is not in memory, a page fault triggers the loading of the missing page from disk. Immediate termination is not standard behavior for a missing page. Swapping the entire process is inefficient and not the response to a single page fault. Ignoring the access would cause undefined or incorrect program operation.

  3. Role of the Working Set

    What does the working set model represent in virtual memory systems?

    1. The set of pages actively used by a process during a defined time window.
    2. All pages ever allocated to a process.
    3. Pages locked in memory by the operating system regardless of activity.
    4. Pages swapped to secondary storage permanently.

    Explanation: The working set refers to the set of pages a process has used within a recent interval, indicating active use. It is dynamic and changes as the process accesses new pages. The complete set of allocated pages may include inactive pages. Pages swapped out or locked are not necessarily part of the current working set.

  4. Thrashing Identification

    Which situation best describes thrashing in a demand paging system?

    1. Occasional access to secondary memory.
    2. Manually selecting pages for swapping.
    3. Optimized memory use with no page faults.
    4. Frequent page faults causing excessive paging activity.

    Explanation: Thrashing occurs when page faults are so frequent that the CPU spends most of its time swapping pages instead of executing processes. Occasional secondary memory access is normal and doesn't indicate thrashing. A system with no page faults is not thrashing. Manual page selection isn't typical and doesn't relate to thrashing.

  5. Demand Paging Efficiency

    How does demand paging improve memory utilization compared to simple paging?

    1. It reduces access time by placing all data in cache.
    2. It loads only needed pages, allowing more processes to fit in memory.
    3. It loads all pages at startup, consuming more memory.
    4. It requires more swap space for every process.

    Explanation: By loading only the actively used pages, demand paging makes better use of memory, potentially allowing more processes to run. Loading all pages at once increases memory usage, which is less efficient. Requiring more swap space per process is not a direct feature of demand paging. Placing all data in cache is unrelated and inaccurate.

  6. Page Replacement Policy Connection

    Why is an effective page replacement policy important in a demand-paging system?

    1. It reduces the number of page faults by keeping needed pages in memory.
    2. It increases the size of the page table.
    3. It eliminates the need to use secondary storage.
    4. It guarantees all processes will complete instantly.

    Explanation: A good page replacement policy ensures that the most relevant pages remain in memory, minimizing page faults. Increasing the page table size is not a direct benefit. Secondary storage is still required regardless of the policy. Instant process completion is unrealistic and not related to the policy.

  7. Locality of Reference Principle

    Which concept does the working set model rely on to predict future page usage?

    1. Random page access with no predictable pattern.
    2. Locality of reference, where processes access a small set of pages repeatedly.
    3. Static memory allocation at compile time.
    4. Equal probability of accessing all memory pages.

    Explanation: The working set model assumes that processes tend to access the same pages repeatedly for some time—this is called locality of reference. Random access and equal probability contradict this principle. Static allocation does not account for dynamic working set behavior during process execution.

  8. Page Table Function

    In demand paging, what is the main purpose of the page table for a process?

    1. To keep a list of every process in the system.
    2. To record completed input/output operations.
    3. To map virtual addresses to physical addresses and indicate if pages are in memory.
    4. To store program source code for error checking.

    Explanation: The page table translates virtual addresses to their corresponding physical locations and tracks whether pages are loaded. It does not list system processes or store source code. Recording I/O operations is handled elsewhere.

  9. Page Fault Handling Steps

    When a page fault occurs, which of the following describes the first step the operating system takes?

    1. It writes all dirty pages to disk before proceeding.
    2. It checks if the memory access is valid and within the process's address space.
    3. It loads every page of the process into memory.
    4. It immediately terminates the user process.

    Explanation: Upon a page fault, the operating system first verifies if the address is legal for the process. Terminating the process is only necessary if the access is invalid. Writing all dirty pages is not always required and would be inefficient. Loading every page defeats the purpose of demand paging.

  10. Influence of Working Set Size

    What is a likely consequence if the allocated physical memory for a process is smaller than its working set size?

    1. All required pages will remain in memory.
    2. The process will run faster due to efficient paging.
    3. Page replacement will no longer occur.
    4. The process will experience frequent page faults.

    Explanation: If physical memory cannot hold the working set, pages required by the process will constantly be swapped in and out, increasing page faults. Running faster is unlikely with high page fault rates. Not all required pages can be in memory, so frequent replacements occur. The option stating page replacement will no longer occur is incorrect, as it would in fact happen more often.