Home CS439

CS439: Principles of Computer Systems

Homework 7, Part 1

Due: 9:45a Thursday, October 22, 2015

Part 1 of the homeworks must be submitted electronically. Please refer to the homework turnin instructions.

  1. What is TLB (Translation Lookaside Buffer)? What issue does it try to solve? How does it solve that issue?

  2. Consider a program with seven virtual pages numbered from 0 to 6 references its pages in the order:

    0 1 3 6 2 4 5 2 5 0 3 1 2 5 4 1 0

    Using clock page replacement algorithm with 4 frames and assuming demand paging, compute the number of page faults and show the state of frames (pages in frames and value of clock bit) after each page access.
  3. 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 and assuming demand paging, 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?

  4. In some operating systems, I/O from/to disk is done directly to/from a buffer in the user program's memory. The user program does a system call specifying the address and length of the buffer (the length must be a multiple of the disk record size).

    The disk controller needs a physical memory address not a virtual address. Your co-worker proposes that when the user does a write system call, the operating system should check that the user's virtual address is valid, translate it into a physical address, and pass that address and the length (also checked for validity) to the disk hardware.

    This won't quite work. In no more than two sentences, what did your co-worker forget?

  5. The MegaGiga hard disk rotates at 5400 rpm with an arm seek time given by = 4 + 0.05t msec, where t is the number of tracks the arm seeks. Assume a block size of 512 bytes, and 1024 tracks with 512 blocks/track, and 2 platters with 4 usable surfaces. The disk controller and DMA read or write data from/to disk at a rate of 4MB/sec. What is the storage capacity of the disk?