Interrupts in the Linux Kernel

An interrupt is a signal that tells the CPU that a significant event has occurred and needs the attention of the CPU. There are two types of interrupts that are provided in the Linux Operating system. 

  • Hardware Interrupts – If the Interrupt is coming from an external hardware device connected to the CPU, the interrupt is termed a Hardware interrupt. These interrupts can come at any juncture and are not synchronized to CPU clock. Hence, Hardware interrupts are termed as Asynchronous interrupts.
  • Software Interrupts – If a software program that is executing on the CPU has an exception such as for example – an undefined instruction execution, divide by zero operation or the program wishes to execute a kernel service call (by invoking sysenter), interrupts are raised by the software which are termed as Software Interrupts. The Software interrupts occur synchronously with respect to processor clock and hence the software interrupts are termed as synchronous interrupts.

In response to an interrupt, the CPU pre-empts the current instruction sequence/thread of execution and transfers the control to a special function which is termed as an Interrupt Service Routing (ISR). 

Appropriate ISRs for appropriate interrupts are saved in an Interrupt Vector Table.

In the following articles, we will look at how we can look at the different interrupts in the system and also develop sample code for an ISR routine.

Looking at /proc/interrupts

Comments

  1. Pingback: Semaphore Example implementation | Hitch Hiker's Guide to Learning

Leave a Reply

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