CS560 Lab #8

  • Jim Plank, Rich Wolski
  • URL: http://www.cs.utk.edu/~plank/plank/classes/cs560/560/labs/lab8/lab.html
  • Directory: /blugreen/homes/plank/cs560/labs/lab8
  • Makefile: /blugreen/homes/plank/cs560/labs/lab8/Makefile

    Lab 8 -- Demand Paging

    Below we describe the JOS disk interface. Your job is now to get demand paging to work in JOS. When you are done, everything should work as in lab 7, however you should be able to load up to 8 megabytes of user processes at any one time, even though there is only 1 megabyte of user memory in core.

    Compiling Information

    Same as lab 7.

    Disk Operations

    Now when JOS starts up, it will have an eight megabyte disk. This disk consists of 512-byte sectors set in 512 tracks with 32 sectors per track. It has the following interface:

    Virtual Memory / Demand Paging

    Once again, if the valid field of a PTE is not set, then JOS will get control in exceptionHandler(), with the which argument set to PageFaultException, and with the faulting address in register BadVAddrReg (see simulator.h). This now can be for one of two reasons. Either the address is illegal, or the page has been swapped to disk. It is your job to figure out which this is (by keeping track of the sbrk() value *and* the size of the stack), and deal with it appropriately.

    Use the CLOCK (second chance) algorithm from the book to approximate LRU for page replacement.

    The dirty and use bits are set by the simulator whenever a page is written or accessed respectively. You may clear these by setting them to zero, and you may set them to keep things straight as you modify process pages from JOS space.

    Have fun.

    (A final tip from Aunt Heloise's brother, Uncle Todd: Remember, every time JOS touches user memory, the access can block. Design your synchronization strategy accordingly).