Assignment 7, due Oct. 12
Part of
the homework for 22C:112, Fall 2012
|
On every assignment, write your name legibly as it appears on your University ID and on the class list! Assignments are due at the start of class on the day indicated (usually Friday). Exceptions will be by advance arrangement unless there is what lawyers call "an act of God" (something outside your control). Homework must be turned in on paper, either in class or in the teaching assistant's mailbox. Never push late work under someone's door!
a) What operating system was the central focus of his talk? (0.2 points)
b) What were the primary problems with that operating system? (0.3 points)
The notes for lecture 15, about 2/3 of the way down, contain code for a disk interrupt service routine and for a disk-read routine. The former corresponds, in a sense, to the EVENT_READY event, while the latter corresponds, in a similar sense, to the EVENT_ARRIVE event.
a) Under what conditions does the simulation model schedule an EVENT_READY event. (0.4 points)
b) What line of code in the disk-read routine performs an action that is simulated by the scheduling of an EVENT_READY event inside the code for an EVENT_ARRIVE event? (There is exactly one line of analogous code.) (0.4 points)
a) Which of the above has a fairness problem when there is always a pending request for one particular cylinder? (0.4 points)
b) In general, the time taken by an interrupt service routine should be strictly bounded. What limits the worst-case interrupt service time in each of the above? The number of cylinders? The number of requests? For each, when does the worst case occur? (0.4 points)
Ignore the possibility that frequently referenced disk sectors might be held in a cache in RAM. To open a file, the contents of that file's i-node must be read into the open-file data structure.
a) How many disk accesses are required, at minimum, to open (but neither read nor write) /myfile (0.4 points)
a) How many disk accesses are required, at minimum, to open and read the first sector of /tmp/myotherfile. (0.5 points)
Consider the discrete-event simulation model distributed here:
-- http://homepage.cs.uiowa.edu/~dwjones/opsys/hw/mp4.txt
This simulation program models the performance of a disk drive with a random distribution of disk requests for randomly selected disk sectors. Neither the arrival distribution nor the disk disk address distribution are uniform, although neither is particularly realistic.
The simulation, as distributed, uses a FIFO queue for the disk request queue. This is not a good choice. Your goal is to replace the FIFO queue with a decent disk scheduling algorithm such as some variant of the circular scan algorithm. This can (and should) be done by making changes to the section of the program entitled "disk queue" along with any required changes to the queueable fields fo the disk request structure (declared in the code section just before the disk queue section).
You can evaluate the effectiveness of your disk scheduler by observing its impact on the statistics gathered by the disk simulator. A decrease in the average time requests spend in the queue is good, as is a decrease in the worst-case wait and the worst-case queue length.
Your code, in a file called mp4.c should be submitted as usual.
Warning: This is a data-structure intensive programming problem. You will need to, at the very minimum, think seriously in terms of multiple linked lists, and you may need to build binary trees. Plan to spend some time, and plan for serious debugging.