Home CS439

CS439: Principles of Computer Systems

Homework 6

(Source: Alison Norman.)

Due: Wednesday, March 20, 2013, 11:59 PM

Homeworks will be submitted electronically. Please refer to the homework turnin instructions.

  1. What is a virtual address? What is a physical address? How do they relate to each other?
  2. Consider a paging system with 16 pages and a page size of 256 bytes. The system has 1024 bytes of physical memory.
    • How many bits are in a physical address?
    • How many bits represent the page number?
    • How many bits are in the complete virtual address?
    • What size are the page frames?

  3. What are the causes of page faults? What are the possible effects on the running process?
  4. Assuming the kernel and hardware are implemented properly, does every illegal memory reference by a process result in an exception (aka fault)?
  5. Belady's anomaly: Intuitively, it seems that the more frames the memory has, the fewer page faults a program will get. Surprisingly enough, this is not always true. Belady (1969) discovered an example in which FIFO page replacement causes more faults with four page frames than with three. This strange situation has become known as Belady's anomaly. To illustrate, a program with five virtual pages numbered from 0 to 4 references its pages in the order:
    0 1 2 3 0 1 4 0 1 2 3 4
    1. Using FIFO replacement, compute the number of page faults with 3 frames. Repeat for 4 frames.
    2. Compute the number of page faults under LRU, the clock algorithm, and the optimal algorithm. What do you notice?