Lowering CPU Overhead with Interrupts
In this lesson, we discuss how to reduce the overhead due to polling by using interrupts. We also discuss the limitations of this approach.
We'll cover the following
The invention that many engineers came upon years ago to improve this interaction between OS and a device, is something we’ve seen already: the interrupt. Instead of polling the device repeatedly, the OS can issue a request, put the calling process to sleep, and context switch to another task. When the device is finally finished with the operation, it will raise a hardware interrupt, causing the CPU to jump into the OS at a predetermined interrupt service routine (ISR) or more simply an interrupt handler. The handler is just a piece of operating system code that will finish the request (for example, by reading data and perhaps an error code from the device) and wake the process waiting for the I/O, which can then proceed as desired.
Improved utilization
Interrupts thus allow for overlap of computation and I/O, which is key for improved utilization. This timeline shows the problem:
Get hands-on with 1400+ tech skills courses.