CMPSCI 377: Operating Systems
Homework 6: Memory Management
NEW DUE DATE: December 11, 2002 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: README (raw text file), (a postscript file), or README.pdf. 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 a segmented memory system with memory allocated as shown below.
    Suppose the following actions occur:
    • Process E starts and requests 300 memory units.
    • Process A requests 400 more memory units.
    • Process B exits.
    • Process F starts and requests 800 memory units.
    • Process C exits.
    • Process G starts and requests 900 memory units.

    1. Describe the contents of memory after each action using the first-fit algorithm.

    2. Describe the contents of memory after each action using the best-fit algorithm.

    3. How would worst fit allocate memory?

    4. For this example, which algorithm is best?

    Assume that if a process is said to occupy 500 to 800, that it is inclusive of location 500 and exclusive of 800 (so a total of 300 bytes).

    Also: assume that the last memory location is 3399.

  2. There are three questions for this problem

    1. Compare paging with segmentation in term of characteristic of partitions (i.e., pages or segments), fragmentation, and protection.

    2. Briefly explain how the two mechanisms can be combined for improvement and list the advantages of the hybrid scheme.

    3. Are there any disadvantage of the hybrid scheme with respect to pure paging or pure segmentation? List at least one and propose a way to alleviate the problem. Explain your answers

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

    How many page faults would occur for the following replacement algorithms, assuming one, two, three, four, five, size, 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

  4. 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 52.
    1. In what order does the disk service requests for blocks that are stored on the following tracks: 67 40 19 82? 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?

    5. Explain why SSTF scheduling tends to favor middle tracks over the innermost and outermost tracks of a disk.

  5. None of the disk scheduling disciplines, except FCFS are truly fair(starvation may occur).
    1. Explain why this assertion is true

    2. Describe a way to modify algorithms such as SCAN to ensure fairness

    3. Explain why fairness is an important goal in time-sharing systems

    4. Give two or more examples of circumstances in which it is important that the operating system be unfair in serving I/O requests.

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