Hardware Interrupt
Hardware Interrupt is caused by some hardware device, such as a request to start an I/O or a hardware failure.
These interrupts were introduced to avoid wasting the processor’s valuable time in polling loops, and waiting for external events.
Examples include:
- An interrupt is generated by a mouse when a button is clicked.
- An interrupt is generated by a network card when data is received.
- An interrupt is generated by a disk drive when a read or write operation is completed.
- Hardware interrupts help in responding to external events efficiently.
Software Interrupt
Software Interrupt is invoked by the use of the INT instruction. This event immediately stops the execution of the program and transfers control to the INT handler.
The INT handler is usually a part of the operating system and determines the action to be taken.
It occurs when an application program terminates or requests certain services from the operating system.
Examples include:
- A system call to read or write data to a file.
- A division by zero exception.
- A page fault exception.
Software interrupts are typically initiated by software or programs to request specific services from the operating system.