10 Interrupts

The two main methods for handling I/O are polling, which repeatedly asks the device whether it has any data ready, and interrupts, which are when the device interrupts normal workflow to tell you it’s ready. This chapter describes the difference between polling and interrupts as well as explains how interrupts work so you can use them to write a string to the serial port more efficiently (yes, “Hello World” again).

Polling vs. Interrupts

Let’s consider how polling and interrupts would work in the case of the telephone. With polling, the ringer is turned off, and you must check the phone every 10 seconds to see whether a call ...

Get Bare Metal C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.