Homework 1 Solutions

22C:116, Spring 2002

Douglas W. Jones

Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list!

  1. What is your E-mail address?
    Answer not provided.

  2. Do you have access to a UNIX/Linux/MacOS-X system?
    Answer not provided.

  3. Background: Here are some questions to test your understanding of programming language concepts and computer architecture, at the level expected for success in this course.

    Look at the exception handler primitives documented in:

    http://homepage.cs.uiowa.edu/~dwjones/syssoft/style.html#except

    Part A: Explain the difference between this exception handling model and the model of the Java and C++ programming languages. This difference can be explained in a few lines; the documentation for the primitives gives the consequences of this difference, but it does not explain the difference.

    In the handler documented in the web page cited, exception is a data type, and each named exception that is declared is a new instance of that type, that is, a distinct variable. In this model, an exception handler is a value assigned to this variable.

    In Java and C++, the type exception is effectively an enumerated type, and the declaration of a new exception adds a new value to the range of that enumeration, that is, a named constant. In this model, an exception handler receives, as an argument, the exception value that was raised.

    Part B: The exception handler cited above use the longjmp() and setjmp() primitives of the C programming language. These save and restore state information from a data object called a jump buffer. If you look at implementations of these primitives in different implementations of C, you will find that the size of a jump buffer varies immensely from one implementation to the next. On some, it is hundreds of bytes, while on others, it is less than ten bytes.

    Given what you know about programming languages and computer architecture at the machine or assembly language level, what is the minimum information that must be stored in the jump buffer?

    The jump buffer must hold the stack pointer and frame pointer (the frame pointer is also known as the activation record pointer -- these concepts are key concepts typically taught in assembly language programming language concepts courses), along with the program counter at the time of the call to setjmp(). If we assume that the local variables of the caller are all allocated in the caller's activation record, this is enough. If the compiler allocates locals in registers, we must also include the register values that were saved on behalf of the caller as part of the jump buffer.

  4. Background: You are expcedted to have completed an introductory operating systems or system software course prior to this course. You should be able to answer the following questions from this background:

    A large manufacturer of PDA's is moving to integrate a web browser into their next generation product. This will have a 32-bit processor, 4 megabytes of RAM, and 100 megabytes of page-erasable flash EEPROM, plus a radio modem able to connect to the net using cellular telephone technology. Page erasable EEPROM is 10 times slower than RAM for reading or writing, and the only way to change a bit of this memory from 1 to 0 is to erase a full page of memory, 1024 bytes; changing from 0 to 1 is done by a normal write operation.

    Problem A: Why is virtual memory relevant on this system, given that it has no disk?

    Virtual memory technology can be used to move pages between the flash EEPROM and the main RAM, treating the flash EEPROM as if it was a disk drive.

    Problem B: An important component of the system required for use of virtual memory was not mentioned in the background statement.

    There was no mention of a memory management unit. This could be a separate system component, or it could be an integral part of the CPU.

    Problem C: Your boss says there is no need for DMA I/O, no need for I/O request queues and no need for request schedulers. What is it about the change from disk to flash EEPROM that justifies this assertion?

    With disk, the read and write operations are best done by the I/O controller as a background activity while the CPU continues to execute instructions. With flash EEPROM, on the other hand, the read and write operations are done using normal memory reference instructions -- so input/output to the flash EEPROM is done by a memory-to-memory copy loop, with no need for DMA technology.