hello all,
What's the difference between a driver and an interrupt handler. Is it the same.
thanks in advance
Driver Vs Interrupt Handler
Re:Driver Vs Interrupt Handler
Not quite.
When an interrupt is raised (i.e., the CPU is notified that an interrupt happened), the CPU invokes the interrupt handler. THis handler is responsible for reading some data from some memory area, or doing some other kind of I/O. Most importantly, though, an interrupt handler should return control to the CPU as soon as possible.
The device driver is a larger beast - it is basically a thread / task / process responsible for making sense out of the data gathered by the interrupt handler.
When an interrupt is raised (i.e., the CPU is notified that an interrupt happened), the CPU invokes the interrupt handler. THis handler is responsible for reading some data from some memory area, or doing some other kind of I/O. Most importantly, though, an interrupt handler should return control to the CPU as soon as possible.
The device driver is a larger beast - it is basically a thread / task / process responsible for making sense out of the data gathered by the interrupt handler.
Every good solution is obvious once you've found it.
Re:Driver Vs Interrupt Handler
More generally, the interrupt handler responds to an interrupt (which may not necessarily be from a hardware device), while a device driver controls and monitors a given device, or even a group of related devices (i.e., floppy drives).
For example, depending on the design, a disk driver might have to:
For example, depending on the design, a disk driver might have to:
- Accept a read or write request from the file system;
- Set aside buffer space for the request;
- Map the logical disk location to the physical head(s), cylinder(s) and sector(s);
- Check if the drive is started, and if not, restart it;
- Send the request to the hardware disk controller;
- [tt]wait()[/tt] for a signal or message from the interrupt handler;
- Check the results, and if an error occurred, retry n times - if all attempts fail, return an error to the file system; and,
- Return the results, if any, to the file system.