Test 3 - Memory Management

Operating Systems Concepts


  1. Explain the difference between the FIFO and the least recently used page replacement algorithms.


    FIFO page replacement ejects the page with the longest residency time, independent of the access patterns for that page. LRU page replacement ejects the page with the longest period between accesses. The two algorithms are not equivalent; that is, each ejects a page the other would keep.


  2. Two virtual memory programs contain a block of identical data

    that they could share between themselves when executing. Describe and justify the least restrictive set of requirements on the virtual address of the data segment in each program to be able to share the data between the two processes in a paged virtual memory environment. Do not rely on the figure to answer this question; it may or may not be correct.


    One requirement that works is that the shared segment should be located at the same virtual address in both programs:

    With this arrangement virtual addresses in the shared segment are identical in both programs, which ensures a consistent access when the program's pages are mapped.

    However, requiring identical shared-segment address in both programs is too restrictive; all that is really required is that the shared segments be aligned on page boundaries. The differences in the page number portion of the virtual addresses in the two programs are dealt with in the paging hardware.


  3. The (simulated) hardware for the programming assignments uses an inverted page table. Explain the changes required to your os if the hardware used a page table instead. You need only describe the major changes to the data structures and procedures required; you needn't go into details.


    Because a page table is a map from process pages to page frames (or an non-resident indicator), the MMU now contains per-process state. A context switch requires that the current MMU state be flushed (possibly being saved to the outgoing process's context) and either all entries be invalidated or else loaded from the incoming process's saved context.

    What happens next depends on how efficient the virtual memory system needs to be. The simplest thing to do is flush all dirty pages to disk so the new process can continue execution with empty page frames. However, if the os maintains its own inverted page table it can keep track of the per-process page-frame allocations and delay or avoid paging by loading the MMU from its inverted page table.


  4. It it necessary for hardware to provide both a relocation register and a segment register? Explain.


    No. They both refer to the same address - a program's starting address in primary store - and are used for the same purpose - to relocate a program's virtual address.



This page last modified on 27 November 2002.