Interrupts vs Polling
Polling checks an input repeatedly in the main loop, which is simple but wastes cycles and can miss short events between checks; an interrupt makes the hardware suspend the program and run a handler the moment the event occurs. Interrupts buy latency and sleep-friendliness at the cost of concurrency hazards, so handlers must stay short and share data through volatile, atomically-accessed variables.
This Concept is waiting for its first lesson!
Polling checks an input repeatedly in the main loop, which is simple but wastes cycles and can miss short events between checks; an interrupt makes the hardware suspend the program and run a handler the moment the event occurs. Interrupts buy latency and sleep-friendliness at the cost of concurrency hazards, so handlers must stay short and share data through volatile, atomically-accessed variables.
Are you a teacher? Sign in to start contributing.
Sign In