Assignment 5, due Feb. 25
Part of
the homework for 22C:112, Spring 2011
|
On every assignment, write your name and the course number legibly. Exceptions will be by advance arrangement unless there is what insurance companies 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 problem: Write a C routine linearize(int linear, struct diskad * da) to translate linearized disk addresses of the form you would get from lseek() when applied to the raw disk device. The disk address parameter points to a structure with fields called cylinder, track (within cylinder), sector (within track), and byte (within sector). (1 point)
The disk is one of many devices attached to a DMA controller with the following control registers:
With multiple disks attached to one DMA channel, it is essential to tell both the controller and the disk interface to move the data in the same direction, and it is essential that only one disk attempt to transfer data at a time.
a) Outline the code for a stupid version of disk_IO( struct diskad * da, char * buf, int command) that will perform one disk operation on the disk device. It should work correctly in a single-threaded system under the assumption that other devices (including other disks) are driven by similar routines. (1 point)
b) Now, assume that each device can request an interrupt when it is done, and assume that disk interrupts are handled by a different interrupt handler than DMA interrupts. In support of disk interrupts, you have a disk request queue, but you also have to deal with the relationship between the disk and DMA interrupt routines. This might be mediated by an additional queue or queues. Design the communication pattern between the user-side routine that enqueues disk requests, the disk interrupt handler and the DMA interrupt handler. A sensible answer will probably involve a diagram showing how the queue or queues relate to the software components, a description of what goes in each queue, and a textual description of how the different routines relate to each other. (1 point)