Homework 1

22C:116, Spring 1997

Due Friday Jan. 31, 1997, in class

Douglas W. Jones

This assignment is dominated by review questions that are not as much specific to the material in the book as they are to material you should have learned in prior courses or work experience.

  1. What is your E-mail address? (If you have more than one, give the address you'd prefer used for class purposes.)

  2. For any architecture which you know well, define a data structure for storing the complete CPU state. This data structure will be called a CPU state record in the remainder of this discussion. Use any programming language, but please, document the language and machine you are using and give citations for any reference material you have used.

  3. For the architecture you used above, write a routine called switch that takes two parameters, each of which is a pointer to a CPU state record. The routine should store the complete CPU state of the caller in the first record, and then load the complete CPU state from the second record. You may write this code in any language (not necessarily even the same language you used for the first problem), and you need not limit yourself to the use of standard calling sequences -- in fact, on some machines, it is impossible to solve this problem if you assume that the usual call instruction is used to transfer control to your routine!

  4. What is a device driver? Write a paragraph giving a clear general definition that avoids specific details of either specific devices or particularl operating systems.

  5. What is a privileged instruction. Write a paragraph giving a clear general definition that avoids specific details of any particular architecture. In this paragraph, you should describe what happens when user code tries to execute a privileged instruction and why certain instructions are privileged in many instruction sets.
NOTE: If you need help locating documentation for a particular machine to use as an example in solving problems 2 and 3, consider using either the DEC PDP-8 (a historically important computer) as documented on the web, or the fictional Hawk computer used in 22C:18 last semester. These are documented on the web at the following URL's: