Interrupts are short code fragments that provide useful services that can be used by other programs. Typical routines handle key presses, mouse movements and button presses, screen writing, disk reading and writing and so on.
An interrupt is like a procedure but it is called in a different way. Procedures are called by jumping to the start address of the procedure. This address is known only to the program that owns the procedure. Interrupts are called by looking up the address of the interrupt code in a table of interrupt vectors. The contents of this table is published and widely known. MS DOS makes heavy use of interrupts for all its disk, screen, mouse, network, keyboard and other services.
By writing your own code and making the interrupt vector point to the code you wrote, the behaviour of interrupts can be completely altered. Your interrupt code might add some useful behaviour and then jump back to the original code to complete the work. This is called TRAPPING the interrupt.
Software interrupts are triggered, on demand, by programs.
Hardware interrupts are triggered by electronic signals to the CPU from hardware devices.
Share with your friends: |