next up previous
Next: Noncontiguous System Memory Up: Machine-Dependent Code Previous: machdep.c

Interrupt structure

Interrupt structure refers to the precedence of interrupts. Hardware events that cause interrupts are assigned CPU interrupt levels. The CPU can disable interrupts of a certain level and below, thus allowing an important interrupt to preempt an interrupt of lower priority, but not vice-versa. Most machine architectures do not allow the software to reconfigure the interrupt structure. If the precedence of interrupts can be reconfigured, though, make sure that the clock that is used for task-switching has its interrupts serviced at a high priority so that lower priority events (such as disk access) are not capable of disabling the preemtive scheduling. The serial port should also have a high priority so that high baud rates can be reliably used.

The precedence of interrupts is important because disabling interrupts is a common way to provide mutual exclusion in the kernel. For example, a routine that modifies tty structures (those that handle input and output to a terminal) will call spltty() (for Set Processor Level TTY) just before a critical section and later will reset the level to what it was before spltty() was called. On most machines, this call will disable any interrupt that would call a function that handles the tty structures and, in addition, will disable any interrupts with a priority lower than that of ``tty''. An interrupt structure not well suited for UNIX might cause relatively long interrupt code ( e.g., disk access or sound driver processing) to block more frequent interrupts ( e.g., timer, keyboard, or serial port). On the Macintosh port, heavy use of the hard disk would cause the system time to be off by several hours a day, and scrolling of the display, being in a tty device, would preempt the keyboard routine and cause keystrokes to be lost. On A/UX, Apple's System V UNIX for the Macintosh, a beep causes serial port data to be lost.



next up previous
Next: Noncontiguous System Memory Up: Machine-Dependent Code Previous: machdep.c



Lawrence Kesteloot
Fri Jan 20 16:29:52 EST 1995