What happens when a CPU is interrupted?
When a CPU receives an Interrupt Request (IRQ), it first checks if it must react to the interrupt. So-called Maskable Interrupts allow a programmer to specify that the CPU does ignore it, while Non-Maskeable Interrupt requests must be serviced.
It is important to note that an Interrupt is a way to communicate asynchronously with the CPU - very much like sending an email.
When you send an email to a person, you cannot know at which time the person reads the message, let alone when the person reacts.
A phone call, on the other hand is synchronous (happening at the same time): when I call you, you must answer right now.
Interrupts where introduced to allow tgis email-like communication with slower hardware, like a hard-disk. This way, the CPU can order something from the HD, like "go to this location", the CPU can then return to more important stuff, while the HD seeks. When the HD is done, it sends the CPU an IRQ, which tells the CPU "I am done, talk to me".
The CPU then does a so-called contex-switch, which is a rather costly operation: it must store all the data it was working on earlier in some secure way, normally on the stack and then begin to execute the so-called Interrupt Handler, a piece of software associated with the number of the IRQ.
After executing it, it can carry on doing what it did earlier (after having loaded all the data back into its registers).
The concept of IRQs make multi-tasking possible, here, the OS interrupts each process after its time-slice has expired.