Final

22C:116, Fall 1998

Douglas W. Jones

This is an open-book exam! You may use any notes or books you wish, but not your neighbor's exam paper. Please write your answers in the exam booklet provided.

NOTE: Each of the questions on this exam is designed to take about 10 minutes of your time. Excessively long or complex answers will be penalized! Please think before you write.

This exam is worth almost 1/3 of the final grade (30 points)

  1. On a typical computer system, when the hardware detects an floating point error, such as divide by zero, a floating-point-error trap request is asserted, causing a control transfer to the floating-point-error trap service routine.

    Part A: If a UNIX process attempts division by zero, it expects a SIGFPE signal to be delivered. Briefly outline how the floating-point-error trap service routine under a UNIX system implements this semantics. (1.0 point)

    Part B: If a Mach thread attempts division by zero, it expects to be stopped and it expects a message to be sent to its process's exception port. Briefly outline how the floating-point-error trap service routine under a Mach system implements this semantics. (1.0 point)

    Part C: If a user running under IBM's VM attempts division by zero, it expects a call to that user's virtual floating-point-error trap service routine. Briefly outline how the real floating-point-error trap service routine inside VM implements this semantics. (1.0 point)

  2. Under IBM's VM operating system, the page fault trap handler may do one of the following in response to a trap request from the memory management unit: Note that a bus trap is requested when an illegal physical address is issued by the CPU or MMU, while a page-fault trap is requested by the MMU when it is unable to translate a virtual address to a physical address.

    How does the VM operating system determine which action to take? (3 points)

  3. Assume that you have a routine called emualte(i) that emulates the execution of the privileged instruction i in the context of the current VM user. Given this, write high level pseudocode for the privileged instruction trap service routine under IBM's VM operating system. Emphasize how your routine decides whether to emulate the instruction that caused the trap or to force a virtual privileged instruction trap for the user. (3 points)

  4. What barriers stand in the way of building an operating system using the Mach kernel (that is, a combination of the Mach kernel with fault handlers, servers and other components) that will act, in sum, like IBM's VM operating system. That is, where the virtual machine offered to the user of this Mach based system is semantically indistinguishable from the host hardware. (3 points).

  5. The study question outlining the design of an object oriented operating system omitted a number of important details that would need to be worked out before a real system could be built. Point out the most important of the omissions. (3 points).

  6. If the object oriented operating system suggested in the study question were to be used in a network environment, where a user on one machine should be able to manipulate objects on another machine, how would you expose the network to the users? (Hint: Consider the concept of stub objects). (3 points).

  7. Given that the object oriented operating system is intended to be supported on a machine with a conventional MMU, the address-translation-fault trap service routine must detect and handle user references to objects. The MMU itself maps pages of the address space to page frames, but from the point of view of the hardware, references to unmapped pages and references to objects are seen identically as illegal memory references.

    Recall that our object oriented operating system interprets all references to a page as calls to one of two methods, one for fetches from the page and one for stores to the page; the actual operand address relative to the page is passed as a parameter to the method, as is the operand size, and for stores, the value being stored.

    Part A How can the trap service routine distinguish between references to unmapped pages and references to objects? (1.5 points)

    Part B Given that the trap service routine has found a reference to an object, what does it do about it? (1.5 points)

  8. There are two interesting alternative models for method invocation under the example object oriented operating system:

    These approaches only differ if multiple parallel processes are attempting to make simultaneous use of some object. Discuss the impact of these two alternatives on the code you would write for a simple object such as the classic counter object (with methods increment and inspect). (3 points)

  9. Consider a simple token-based distributed mutual exclusion algorithm, implemented on a virtual ring, and using an agent process to handle token forwarding while the user processes are idle. What variables, semaphores or other data would your user and agent processes need to share, and how would these be used? (3 points)

  10. Consider an environment where the operating system provides semaphores, mutual exclusion locks and shared memory regions as the basic interprocess communication tools. The operating system detects deadlocks involving mutual exclusion locks, and the system resolves such deadlocks by aborting a process. When a process terminates, normally or abnormally, all locks it holds are automatically released. Discuss (at a high level or using a very simple example) how you would implement atomic transactions in this environment. (3 points)