CMPSCI 377: Operating Systems
Homework 6: Memory Management
DUE DATE: Friday, May 9th, 2003 23:30

What to Hand In

Everyone must hand in their own work. In order to get credit for this assignment, it must be handed in accordingly: Place in your Hand-In directory (~/cs377/hw6/) one of the following: hw6.txt (raw text file), or (a postscript file). The file must contain your name, user id, and answers to the questions listed below.

You can check the location of your file by using the "~fagg/bin/checkhw hw6" command.

  1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 3, 7, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2.

    How many page faults would occur for the following replacement algorithms, assuming one, three, five or seven frames? Remember that all frames are initially empty, so your first unique pages will all cost one fault each.

    1. LRU replacement

    2. FIFO replacement

    3. Optimal replacement

  2. Consider a disk that employs the shortest seek time first (SSTF) scheduling algorithm. Assume that the disk has 100 tracks that are numbered from 1 to 100. Further assume that the current disk head position is track number 65.
    1. In what order does the disk service requests for blocks that are stored on the following tracks: 67 28 7 92? Assume that all four requests arrive simultaneously.

    2. What is the total number of tracks across which the disk seeks to satisfy these requests?

    3. What order are the requests serviced assuming the SCAN (elevator) disk scheduling policy? Assume that the disk head is currently moving toward track 100 and that the disk head always seeks to the highest and lowest numbered tracks (i.e., tracks 100 and 1) before reversing direction.

    4. What is the total number of tracks across which the disk seeks in case of SCAN?

  3. Consider a segmented paging system with a physical memory of size 1024 bytes, with frames that are 32 bytes each. Shown are 2 segment tables (one for each process) and 8 page tables.

    Segment Tables
    Process 1 Process 2
    0 0x5 0x2
    1 0x7 0x0
    2 0x3 0x1
    3 0x6 0x7

    Page Tables
    0 1 2 3 4 5 6 7
    0 0x19 0x1C 0x03 0x02 0x11 0x0A 0x00 0x06
    1 0x14 0x13 0x0F 0x15 0x1B 0x02 0x17 0x08
    2 0x02 0x01 0x0C 0x13 0x04 0x0E 0x12 0x09
    3 0x11 0x02 0x07 0x09 0x12 0x1A 0x13 0x18

    Answer the following questions:

    1. How large is the physical address?
    2. How large is the virtual address?
    3. For process 1, what is the physical address (in hex) that corresponds to virtual address 0x45?
    4. What about for process 2?
    5. For process 1, what is the physical address that corresponds to virtual address 0x1E7?
    6. What about for process 2?
    7. What might be stored in segment seven?

  4. How much time did you spend on this assignment?

Last modified: Mon Oct 22 09:32:53 2002