CMPSCI 377: Operating Systems
Homework 4: Memory Management
Due: November 21, in class

Due to the Thanksgiving weekend, you can get a free extenstion of one week. If you take up this extension, your homework will be due on Monday Nov 27, 5pm.

  1. Most modern operating systems support copy-on-write. Copy-on-write allows two processes to share a page in memory that contains data that can be modified but for which the processes do not want to see the changes made by each other. If a page is marked as copy-on-write and there is an attempt to write to that page, a trap occurs. The trap handler copies the page, updating the process's page table and re-executes the instruction that caused the trap.

    1. (5 pts.) What will the effect of re-execution be?

    2. (5 pts.) Describe one situation in which you believe copy-on-write would be useful.

  2. Suppose we have virtual memory containing 8 pages with 512 bytes per page and physical memory with 16 page frames.

    1. (4 pts.) How long is a virtual address?

    2. (4 pts.) How long is a physical address?

    3. (2 pts.) Given the following page table, what is the physical address corresponding to the virtual address of page 4, byte 241?

      VirtualPage
      PageFrame
      00
      18
      211
      36
      43
      51
      67
      710

  3. (10 pts.) Is it easier for processes to share code pages in a pure paging system or in a system that includes segmentation? Explain your answer.

  4. Consider a paging system with the page table stored in memory.

    1. (4 pts.) If a memory reference takes 200 nanoseconds, how long does a paged memory reference take?

    2. (6 pts.) If we add associative registers (a TLB), and 75 percent of all page table references are found in associative registers, what is the effective memory reference time? Assume that finding a page-table entry in the TLB takes zero time, if the entry is there.)