Information Technology Reference
In-Depth Information
9. We described how the operating system kernel mediates access to I/O
devices for safety. Some newer I/O devices are virtualizable | they permit
safe access from user-level programs, such as a guest operating system
running in a virtual machine. Explain how you might design the hardware
and software to get this to work. (Hint: For this, the device needs much
of the same hardware support as the operating system kernel.)
10. System Calls vs. Procedure Calls: How much more expensive is a sys-
tem call than a procedure call? Write a simple test program to compare
the cost of a simple procedure call to a simple system call ( getpid() is
a good candidate on UNIX; see the man page.) To prevent the optimiz-
ing compiler from \optimizing out" your procedure calls, do not compile
with optimization on. You should use a system call such as the UNIX
gettimeofday() for time measurements. Design your code such that the
measurement overhead is negligible. Also, be aware that timer values in
some systems have limited resolution (e.g., millisecond resolution).
Explain the difference (if any) between the time required by your simple
procedure call and simple system call by discussing what work each call
must do.
11. Suppose you have to implement an operating system on hardware that
supports interrupts and exceptions but that does not have a trap instruc-
tion. Can you devise a satisfactory substitute for traps using interrupts
and/or exeptions? If so, explain how. If not, explain why.
12. Suppose you have to implement an operating system on hardware that
supports exceptions and traps but that 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.
13. Explain the steps that an operating system goes through when the CPU
receives an interrupt.
14. When an operating system receives a system call from a program, a switch
to the operating system code occurs with the help of the hardware. In such
a switch, the hardware sets the mode of operation to kernel-mode, calls
the operating system trap handler at a location specified by the operating
system, and allows the operating system to return back to user mode after
it finishes its trap handling.
Consider the stack on which the operating system must run when it re-
ceives the system call. Should this be a different stack from the one that
the application uses, or could it use the same stack as the application pro-
gram? Assume that the application program is blocked while the system
call runs.
Search WWH ::




Custom Search