From the beginning of https://en.wikipedia.org/wiki/Interrupt, there are three different kinds of interrupts:
a hardware interrupt,
A software interrupt caused by an exceptional condition in the processor itself (often called a trap or exception)
A software interrupt caused by executing a special instruction in the instruction set. (For example system calls)
My question is that when a cpu switches to run an interrupt handler,
is a new process created for running the interrupt handler?
Or is the running of the interrupt handler part of an existing process, e.g.
- in the first kind of interrupt, the process which requests some service from a hardware device and then waits for the hardware interrupt which indicates that the device operation finishes,
- the process which causes an exception in the second kind of interrupt,
- the process which makes the system call in the third kind of interrupt.
The running process handles the interrupt in kernel mode.
Your three classes of interrupts conflate different, but related concepts, into one term "interrupt".
Fault and traps are EXCEPTIONS, not interrupts. They are usually handled in the same way as an interrupt but they occur synchronously with the instruction stream (interrupts are asynchronous) and (unlike interrupts) they cannot be blocked.
Usually a system call is a FAULT.