What is Interrupt

Interrupt is event/signals generated by H/W(Eg: clock, keyboard) or S/W which is sent to CPU by Interrupt Controller.
Interrupts are used to handle asynchronous events, CPU pauses the current execution, address the event, and then resume its previous activity.
CPU is asked to perform some high priority task wrt what its doing.
Interrupts can be triggered by hardware devices (hardware interrupts) or by software instructions (software interrupts).
Information from interrupt is converted to character and stored in buffer to be later used by ISR.

Interrupt Flow/Hardware Interrupt reaching CPU

Process Control Block(PCB)
Interrupt flow
Interrupt flow1

IVT(Interrupt Vector Table) / (IDT) Interrupt Descriptor Table

Contains ISR(Interrupt service routine)/Handler Address to which CPU jumps at occurrence of interrupt. Present in 1st 1K of physical memory.
Starting address of IVT is stored in dedicated register (IDTR).
IVT is created when the system initially boots and reflects the specific system configuration.
IVT is filled using Probing
Interrupt number is used as index in IVT. CPU goes to IVT's index, gets Instruction Pointer/Program counter and starts Interrupt service procedure. Once CPU starts ISP, Device Acks Interrupt controller

            | 0x420932 ISR of Int0 |      |     |     |
Interrupt No>       0                 1       2     3

    CPU                    Hardware_Device
       <- Interrupt3=signal-
 Find & runs ISR3 for Intr3
    isr3(){..}
        

Probing

Finding which Interrupt line Hardware Device is going to use?
Device driver tells the Hardware device to generate interrupts and watches the IRQ line and finds which line device is using.

            unsigned long probe_irq_on(void);
        
This function returns a bit maskof unassigned interrupts.
The driver must preserve the returned bit mask, and pass it to probe_irq_off later.
Other Method? The interrupt handler can be installed either at driver initialization or when the device is first opened. Installing isr at device initialization causes interrupt line to be occupied even device is not used.