I'm a newbie in computer science and would to understand how hardware interrupts work at the physical layer. I ask my question considering a specific example. When packet arrives at the network adapter, a hardware interrupt is raised. Wikipedia says that
an interrupt is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention.
I know that the OS will invoke a corresponding interrupt handler when the interrupt's type is detected. But I don't understand how the CPU detects and distinguishes incoming interrupts.
First, why CPU does know that the interrupt is coming from the network adapter and not from some other device?
Second, where are interrupt handlers registered in the CPU? Are there specific areas of the CPU that contain addresses for handlers registered by the OS?