CS 3120 Operating Systems, Summer 2003

Assignment 6, due: Friday, July 25, 1:35 pm.

 

This assignment is to be typed with the exception of any diagrams, which can be neatly drawn.

 

  1. [6 points] Write the pseudo code (including appropriate initialization) for a monitor solution to the following scenario:

 

A group of students are studying for an OS midterm. The students can study only while eating pizza. Each student repeatedly picks up a piece of pizza and then studies while eating the pizza. If a student finds that all the slices of the pizza are gone, the student goes to sleep until another pizza arrives. The first student to discover that the group is out of pizza phones Pizza Hut to order another pizza before eating the last piece. Each pizza has S slices. Write code to synchronize the student threads and the pizza delivery thread. Your solution should avoid deadlock and Pizza Delight should be phoned (i.e., wake up the delivery thread) exactly once each time a pizza is exhausted. No piece of pizza may be consumed by more than one student.  

 

  1. [7 points] Given a dynamic memory partition setup with current holes of (A) 100K, (B) 500K, (C) 200K, (D) 300K, and (E) 600K (in order), show how each of the First-fit, Best-fit and Worst-fit algorithms would place processes of size 212K, 417K, 112K, and 426K (in order)?  Indicate for each algorithm the total space left, the smallest available hole, the largest available hole, and the processes (if any) that are unable to be placed.  Which algorithm makes the most efficient use of memory?

 

  1. [4 points] Consider a logical address space of 8 pages of 2048 words each, mapped onto a physical memory of 32 frames (assume system is word addressable).

 

    1. How many words does the logical address space contain? How many bits are there in the logical address?
    2. How many words does the physical address space contain?  How many bits are there in the physical address?

 

  1. [3  points] The following is a core map of a virtual memory system that has a page size of 100.

 

Frame #

Process ID

Page #

0

1

2

1

1

1

2

2

1

3

3

0

4

1

3

 

 

a.       To which physical address does logical address 175 of process 1 map?  If this logical address does not map to any physical address, write "does not map".

b.      To which physical address does logical address 38 of process 2 map?  If this logical address does not map to any physical adddress, write "does not map".

c.       Which logical address of which process maps to physical address 27.