Driver Vs Interrupt Handler

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
The_Pro

Driver Vs Interrupt Handler

Post by The_Pro »

hello all,
What's the difference between a driver and an interrupt handler. Is it the same.

thanks in advance
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Driver Vs Interrupt Handler

Post by Solar »

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.
Every good solution is obvious once you've found it.
Schol-R-LEA

Re:Driver Vs Interrupt Handler

Post by Schol-R-LEA »

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:
  • 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.
This is just an overview; a real driver would more complicated, of course.
Post Reply