

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Dr. Lixin Tao Pace University
September 2002
A computer process is a program in execution. Its state includes the executable code and data in the main memory (the memory image of the process), the value of the program counter (giving the address of the next machine instruction to execute), and the values of all the general-purpose registers.
When an event or process of higher priority needs to get prompt attention from the CPU, it can interrupt the execution of the current process holding the CPU, save its key state information in memory or hard disk, do whatever interrupt processing with the CPU, then resume the original process’s execution by restoring its state in memory and registers.
Interrupt processing is at the core of modern operating system implementation. You must make sure that you thoroughly understand it.
An interrupt is a dynamic event that needs prompt attention by the CPU. Usually an interrupt only needs a short period of CPU time to serve it. After that the original process can resume its execution.
There are two types interrupting events: hardware interrupts that are those issued by I/O device controllers when they need CPU to process I/O data, and software interrupts, also called traps , that are raised when the current process executes a special trap instruction to indicate that something wrong has happened or the process needs special service from the operating system (like performing some I/O operation).
Only a limited number of types of interrupts are defined. For each type of I/O devices, there is a special program called an interrupt handler to serve the interrupt requests from these devices. For all software traps, there is also a special trap handler defined.
Each type of interrupt has an associated priority level. A running process would only be interrupted by an interrupt source or trap of higher priority. When the CPU is executing an interrupt handler, the interrupt handler may be further interrupted by an interrupt source of even higher priority.
The CPU, main memory, and I/O devices are all connected through a system bus. The system bus consists of many parallel metal wires, some carrying data, some carrying addresses for the main memory or I/O device IDs (as well as addresses for I/O device ports; each I/O device has a few registers called ports, and each port has a unique address), and some carrying control signals.
There are two groups of wires of the system bus that are critical to the working of interrupt processing:
For an I/O device to make an interrupt request, it only needs to raise the Interrupt Request Line. Several I/O devices can raise the Interrupt Request Line at the same time, but only the ID of the device with the highest priority will be broadcast on the Address lines.
There is a special Interrupt Enabled Bit in a system control register. If this bit carries 1, the system is ready to process interrupt requests. If this bit carries 0, the system will ignore any interrupt requests. The latter is important when the current process is doing some very sensitive operation that an interrupt may destabilize the system.
For the discussion of interrupt processing, the execution of an instruction has three phases: a. Read the instruction from the main memory, and save it in the Instruction Register b. Execute the instruction c. If the Interrupt Enabled Bit is carrying 1, then check the Interrupt Request Line for any interrupt requests. If the Interrupt Request Line is raised, enter the Interrupt Processing Phase
A natural observation from the above description is that the system only checks for potential interrupt requests at the end of execution of each instruction.
As we mentioned earlier, each type of interrupts will be processed by its own special interrupt handler. These interrupt handlers are an important component of an operating system. The starting address of each of these interrupt handlers are saved in a table called