## 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
4  TICK
5  Write 2