Difference Between Maskable and Non-Maskable Interrupt


Interrupt is an issue that is not caused by the CPU but is done by a component. Interrupts may occur suddenly and CPU has to take immediate action to resolve the issue. Interrupts are of many types and in this article, we will discuss the difference between Maskable and Non-Maskable Interrupts.

What is Maskable Interrupt?

Maskable interrupt is a kind of interrupt which can be ignored or disabled by instructions given by the CPU. The ignoring or disabling of this interrupt allows the system to give priority to certain tasks. The sources of interrupts are also disabled so that critical operations cannot be disturbed. This interrupt can be level-triggered or edge-triggered.

Examples of Maskable Interrupts

The examples of Maskable interrupts are as follows −

  • External Hardware Interrupts
  • Software Interrupts
  • Timer Interrupts
  • Peripheral Interrupts
  • Maskable Software Exceptions
  • System Calls

Ways of handling Maskable Interrupts

Maskable interrupts can be handled in the following ways −

  • Interrupt Detection
  • Interrupt Request
  • Context Switching
  • Interrupt Controller
  • Interrupt Vector Table
  • Context Restoration
  • Interrupt Service Routine
  • Interrupt Acknowledgment
  • Return from Interrupt
  • Enabling/Disabling Interrupts

What is a Non-Maskable Interrupt?

Non-Maskable interrupt cannot be ignored and disabled. This is an interrupt used in the following cases −

  • When the response time is critical
  • When the interrupt is not disabled during the normal operation of the system

Examples of Non-Maskable Interrupt

Some examples of Non-Maskable interrupts are as follows −

  • Hardware Faults
  • Power Failures
  • Watchdog Timer Expiration
  • System Health Monitoring
  • Security Violations
  • Machine-Specific Events
  • Real-Time Clock Alarms
  • Initiating System Recovery

Ways of handling Non-Maskable Interrupts

Here are the ways of handling Non-Maskable Interrupts.

  • Interrupt Vector Table
  • Priority Mechanism
  • Exception Handling
  • Specialized NMI Handlers
  • Minimal Latency
  • Non-Interruptibility
  • Logging and Diagnostics

Difference between Maskable and Non-Maskable Interrupt

The difference between Maskable and Non-Maskable Interrupt can be found in the table below −

Maskable Interrupt Non-Maskable Interrupt
Maskable interrupt can be ignored or disabled through the instructions of the CPU. Non-Maskable interrupts cannot be ignored or disabled by the instructions of the CPU.
In the case of the occurrence of the Maskable interrupt, it can be resolved after the current instruction is executed. In the case of the occurrence of a Non-Maskable interrupt, the status and current instructions are suspended by storing them in a stack so that the CPU can handle the interrupt.
Lower priority tasks can be handled through the Maskable interrupt. Tasks having high priority are handled by the Non-Maskable interrupt.
Maskable interrupt can be used for interfacing with peripheral devices. A Non-Maskable interrupt is used when there is an emergency.
The response time in this case is high. The response time in this case is low.
Maskable interrupts are either vectored or non-vectored. Non-Maskable interrupts are always sectored.

Conclusion

Maskable and Non-Maskable are two types of interrupts which may occur suddenly and the CPU has to handle them. Maskable interrupts can be disabled or ignored so that priority tasks can be executed. In the case of a Non-Maskable interrupt, it cannot be disabled or ignored. The tasks and status are suspended and then the interrupt is handled.

FAQs on Maskable and Non-Maskable Interrupts

1. The response time of which interrupt is high?

The response time of Maskable interrupt is high. It is so because it can be handled after the processing of current instruction is completed. This is not the case with Non-Maskable interrupt.

2. Which interrupt is used in the case of an emergency?

Non-Maskable interrupt is used in the case of an emergency. Maskable interrupt is used for interfacing with peripheral devices.

3. Which interrupt handles the high-priority tasks?

Non-Maskable interrupts are used to handle high-priority tasks. Low-priority task handling is done by a Maskable interrupt.

4. Which interrupt can be ignored or disabled?

Maskable interrupt can be disabled or ignored through the instructions by the CPU. Non-Maskable interrupts cannot be disabled or ignored so all the tasks are suspended to handle the interrupt.

5. What are the examples of Non-Maskable interrupt?

The examples of Non-Maskable interrupt are as follows −

  • Hardware Faults
  • Power Failures
  • Watchdog Timer Expiration
  • System Health Monitoring
  • Security Violations
  • Machine-Specific Events
  • Real-Time Clock Alarms
  • Initiating System Recovery

Updated on: 26-Jul-2024

0 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements