An interrupt is a signal from a device that makes the CPU pause its execution and cater to the interrupts needs, after which the CPU carries on with whatever it was doing.
These are generated by the programmer using the INT instruction. Software interrupts are triggered using what are called syscalls. Syscalls are also called monitor calls.
One way to implement interrupts would be to call a generic routine that examines the state of the interrupt and then calls the necessary interrupt service routine. But since interrupts need to be handled fairly quickly, there is a predefined table of pointer to ISRs. This table/array is called the interrupt vector.
During a vectored interrupt, the device making the interrupt sends a special code to the processor, usually the ISR address. This special code is looked up in the interrupt vector (array)
When an interrupt is recieved on the interrupt request line, it is processed. The interrupt saves the current state before it modifies and returns the state as it was at the end of execution.
The processor itself has a priority. When an ISR is being executed, the processor sets its priority to the device's priority and only accepts interrupts from higher priority than it first.
There is a common branch address for all interrupts. This service checks all interrupt sources and determines highest priority
All interrupt sources are attached in a serial manner in order of their priorities, and each source has its own vector. An interrupt is triggered when the interrupt request line goes LOW.
A maskable interrupt is one that can be ignored or disabled by the CPU by changing some control bit. These are used by I/O devices, or communication requests
NMIs can not be ignored by the CPU and are of high priority. They are reserved for critical or emergency conditions which require immediate attention. They are used for hardware or power failures.