Homework 6

Assigned: Mar. 25
Due: Apr. 1

Problem 1

Consider the following toy paging system: The virtual address space is 6 bits. The actual memory has size 16. The page size is 4, so there are 16 pages and 4 frames. (Assume that the OS and the page table are stored separately from this memory.)

Suppose that the values in the page table are as follows:

[-, 12, -, -, 8, 0, -, -, -, -, -, -, 4, -, -, -]
where "-" indicates that the page is not in memory. For each of the following virtual addresses, give corresponding absolute address if there is one, or answer "page fault", if there isn't:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31.
Needless to say, all indexing is 0-based.

Problem 2

Consider a toy paging system. There are four frames and six pages. In the sequence of events listed below, "Read I" means that an address in page I must be read; "Write I" means that an address in page I must be written to; "TICK" is a clock tick. (Keep in mind that the arguments to Read and Write are pages, not frames.) List the page faults that occur, and the frames chosen for the new pages, if the OS uses (A) the Not Recently Used (NRU) PRA; (B) the Second Chance PRA; (C) the aging PRA. If the algorithm gives a tie between pages to replace, choose the one with the lower frame. Assume that memory is initially empty.
Time: Events:
   1  Write 1
   2  Read 2
   3  Read 3
   4  TICK
   5  Write 2
   6  Read 4
   7  Read 5
   8  TICK
   9  Read 1
  10  Write 6
  11  Write 3
  12  TICK
  13  Read 2
  14  Write 1
  15  Write 4
  16  TICK
  17  Write 5
  18  Write 2