Computer Organization & Embedded System — Real-Time Operating and Control System, NEC licence examination syllabus (Nepal Engineering Council).
The translator between generic OS calls and specific hardware quirks.
A device driver is software that lets the OS talk to a specific piece of hardware without the rest of the OS needing to know that hardware's details — this is why installing a new printer doesn't require rewriting Windows itself, just adding a small driver. Drivers usually contain an Interrupt Service Routine (ISR) — the code that runs the instant the device raises an interrupt (e.g., "data ready").
Polling drivers repeatedly check device status (simple, wastes CPU). Interrupt-driven drivers let the CPU do other work until the device signals it — the standard approach for anything beyond trivial devices.
"Keep the ISR short" raises an obvious question the chapter leaves open: where does the rest of the work go? The answer is the standard structure of every serious driver.
Top half (the ISR)Runs immediately with interrupts masked. Does the minimum that cannot wait — acknowledge the device, copy the data out of the hardware buffer before it is overwritten, and schedule the rest.
Bottom halfRuns later as an ordinary schedulable task with interrupts enabled. Does the processing: parsing, checksums, waking whoever was waiting.
Interrupt latency is the delay between a device raising an interrupt and its handler beginning to run. In a real-time system this is not a performance metric but a correctness one: a deadline missed because latency was too high is a failure, not a slowdown.
Interrupts disabledAny critical section currently masking interrupts must finish first. This is usually the dominant and least predictable term.
Current instructionThe processor completes the instruction in progress before it will accept the interrupt.
Context saveRegisters must be preserved before the handler can run.
Higher-priority ISRsAnything more urgent already running goes first.
"Polling wastes CPU" is true and vague. Put figures on it:
The trade-off reverses at high event rates, and a good answer says so.
Every interrupt costs a context switch. If events arrive faster than they can be serviced individually, the system can spend all its time switching and none doing work — a livelock, where the machine is fully busy and makes no progress. Polling has a fixed cost regardless of event rate, so under heavy load it wins.This is exactly why high-speed network drivers switch from interrupts to polling when traffic is heavy, and back again when it subsides. It is also why polling remains correct for very simple or very fast devices, where an interrupt would cost more than the operation itself.
Create a free account to tick topics off, take notes as you read, watch the video lessons and get a day-by-day study plan built around your exam date.
Loading…