Interrupts in Computer

Interrupts in the computer are the signals generated either by hardware or by software and is sent to the processor informing it that an event needs its instant attention. It causes the processor to stop whatever it is doing and service the interrupt.

We know that a processor can serve only one process at a time. It is due to interrupts that the processor provides you with the illusion of multitasking. Actually, the processor is serving the processes in time-sharing fashion using interrupt scheduling.

Let us take an example, a process has entered a wait loop and is waiting for I/O device to get ready. At this moment the processor is not performing any useful computation and can be utilized to perform some other task. For this, the I/O device must send an alert when it is ready and it can be done by sending the interrupt signal to the processor.

Now as the processor do not have to check the status of I/O device as it would alert the processor when it is ready; the processor can perform some other task. So, with the help of interrupts, the waiting period of the processor can be eliminated easily.

Types of Interrupts in Computer

  1. Hardware Interrupt
    Interrupt signal generated from the hardware device is the hardware interrupt. For example, the processor is executing some task and in the middle of that, you double click on an app to open it. The click would generate a signal to the processor to open the corresponding app.
    The Hardware interrupt is further classified as a maskable and non-maskable interrupt. The maskable interrupts are the one that can be delayed by other high priority interrupts.
    The non-maskable interrupt is the one which is high priority interrupts that cannot be delayed by any other interrupt and has to be serviced by the processor immediately.
  1. Software Interrupt
    Software interrupts are generated by a software application. For example, if the software is expecting a valid number and it received a null value then it generates an interrupt to prevent the application from crashing.
    The software interrupt can also be classified into two types i.e., normal interrupt and exception. Interrupts generated by the software program instruction is a normal interrupt. The unexpected interrupt generated during the execution of the program is an exception.

Interrupt Handler Working

Whenever the interrupt occurs it invokes series of event which are discussed below:

Step 1: Consider that the process is executing the ith instruction and the program counter has the address of i+1th instruction and at this moment the interrupt occurs.

Step 2: As soon as the interrupt occurs the address in program counter is stored in the process stack and now the program counter stores the interrupt service routine.

Step 3: After the completion of interrupt service routine the program counter is again loaded with the address of that i+1th instruction which processor was executing earlier. So, the processor resumes the execution of i+1th instruction.

Enabling and Disabling Interrupt

An interrupt can be raised at any moment and it would cause the processor to suspend the currently executing process and attend the occurred interrupt immediately. The unplanned occurrence of an interrupt can alter the sequence of events predicted by the programmer.

To have control over the interrupt occurrence, all the computers have a fundamental facility that allows the user to enable or disable the occurrence of interrupts.

The user can enable or disable the occurrence of interrupt either at the processor end or at the I/O device end. The processor can be enabled to attend the interrupt immediately or can disable to delay the interrupt. Similarly, the I/O devices can be enabled to raise the interrupt or it can be disabled to raise any interrupt.

In this content we have seen interrupts in brief, we have also covered how the interrupts are attended by the processors. So this is how the interrupts in the computer are the key feature of every operating system which helps the operating system in multitasking.

Share and Enjoy! 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *