CSE 120: Homework #1
Fall 2015
Out: Tuesday September 29
Due: Thursday October 8 at the start of class
Each question is worth 5 points. When a question asks you to
describe or explain, your answers can be relatively brief. The [name]
tags give scholarly attribution to authors of other OS textbooks who
wrote the question.
- [Anderson 2.1] For each of the three mechanisms that supports
dual-mode operation — privileged instructions, memory
protection, and timer interrupts — explain what might go wrong
without that mechanism, assuming the system only had the other two. (In
other words, if we just had memory protection and timer interrupts but
not privileged instructions, what could go wrong; if we just had
privileged instructions and timer interrupts, what could go wrong,
etc.)
- [Silberschatz] Some computer systems do not provide a privileged
mode of operation in hardware. Is it possible to construct a secure
operating system for these computers? Give arguments both that it is
and that it is not possible. (By a secure operating system, we mean
that a user program is not able to corrupt the kernel, prevent it from
running, crash the system, violate memory protection, etc.)
- [Silberschatz] Which of the following instructions should be
privileged? (Also give a one-sentence explanation for why.)
a) Set value of timer
b) Read the clock
c) Clear memory
d) Turn off interrupts
e) Switch from user to monitor (kernel) mode
- [Tanenbaum] For each of the following Unix system calls, give a
condition that causes it to
fail: open, read, fork,
exec, unlink (delete a file). (Hint: We discussed
some in lecture, and you can also explore the error semantics of these
system calls using man on ieng6, e.g., man 2 fork.)
- List two challenges an operating system faces when passing
parameters between user and kernel mode. Describe how an operating
system can overcome them.
- The Java runtime provides a set of standard system libraries for
use by programs. To what extent are these libraries similar to the
system calls of an operating system, and to what extent are they
different?
- [Crowley] Suppose the hardware interval timer only counts
down to zero before signalling an interupt. How could an OS
use the interval timer to keep track of the time of day?
- [Anderson 2.13] Suppose you have to implement an operating system
on hardware that supports interrupts and exceptions but does not have
an explicit trap instruction. Can you devise a satisfactory
substitute for traps using interrupts and/or exceptions? If so,
explain how. If not, explain why. (In this context, the trap
instruction is the instruction used by a user-level process to invoke
a system call in the operating system, i.e., the trap instruction is
the system call instruction.)
- [Anderson 2.14] Suppose you have to implement an operating system
on hardware that supports exceptions and traps but does not have
interrupts. Can you devise a satisfactory substitute for interrupts
using exceptions and/or traps? If so, explain how. If not, explain
why.