Open In App
Related Articles

Difference between Hardware Interrupt and Software Interrupt

Improve Article
Improve
Save Article
Save
Like Article
Like

Prerequisite – Interrupts in 8085 microprocessor 

1. Hardware Interrupt : Hardware Interrupt is caused by some hardware device such as request to start an I/O, a hardware failure or something similar. Hardware interrupts were introduced as a way to avoid wasting the processor’s valuable time in polling loops, waiting for external events. 

For example, when an I/O operation is completed such as reading some data into the computer from a tape drive.

  • An interrupt generated by a mouse when a button is clicked
  • An interrupt generated by a network card when data is received
  • An interrupt generated by a disk drive when a read or write operation is completed

 2. Software Interrupt : Software Interrupt is invoked by the use of INT instruction. This event immediately stops execution of the program and passes execution over 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. 

For example, output to the screen, execute file etc. 

  • A system call to read or write data to a file
  • A division by zero exception
  • A page fault exception

Difference between Hardware Interrupt and Software Interrupt :

SR.NO.Hardware InterruptSoftware Interrupt
1Hardware interrupt is an interrupt generated from an external device or hardware.Software interrupt is the interrupt that is generated by any internal system of the computer.
2It do not increment the program counter.It increment the program counter.
3Hardware interrupt can be invoked with some external device such as request to start an I/O or occurrence of a hardware failure.Software interrupt can be invoked with the help of INT instruction.
4It has lowest priority than software interruptsIt has highest priority among all interrupts.
5Hardware interrupt is triggered by external hardware and is considered one of the ways to communicate with the outside peripherals, hardware.Software interrupt is triggered by software and considered one of the ways to communicate with kernel or to trigger system calls, especially during error or exception handling.
6It is an asynchronous event.It is synchronous event.
7Hardware interrupts can be classified into two types they are: 1. Maskable Interrupt. 2. Non Maskable Interrupt.Software interrupts can be classified into two types they are: 1. Normal Interrupts. 2. Exception
8Keystroke depressions and mouse movements are examples of hardware interrupt.All system calls are examples of software interrupts

Conclusion :

Hardware and software interrupts allow the CPU to perform specific tasks, they have different sources, triggers, handling mechanisms, and latencies. By understanding the differences between hardware and software interrupts, developers and system administrators can optimize system performance and troubleshoot issues more effectively.

Last Updated : 10 Apr, 2023
Like Article
Save Article
Similar Reads