Can someone explain to me how the CPU finds the source of an interrupt in OS theory

interruptsoperating systems

I am currently doing a module in Operating Systems theory and I have a few concepts that I am unable to grasp – would this be the right place to ask questions ?

My main question is about interrupts. When the CPU detects that there has been an interrupt, I understand that it must find out where this interrupt originated. My understanding is as follows, could anyone tell me if this is correct, and explain a few gaps in my knowledge ?

For the CPU to detect where the interrupt originated, it could query all objects to identify the source, but these I/O based questions would take a long time. Instead, it uses the interrupt cycle, and expects an interrupt identifier on the data bus. If it is an 8 bit data bus, there is 256 interrupt levels (i.e 2^8). (Why is this?)

So an Interrupt Service Routine (ISR) is written for every possible interrupt level and stored in a table at a fixed location (interrupt vector) which is standardized by the processor. In my notes is says "Location must be known before getting the address" (What does this mean?)

The interrupt level identifier received as part of the interrupt cycle is used as an index into the interrupt vector (Can someone break this down a little please?). My understanding is that a value, the interrupt level identifier is passed to the CPU and used to point at the interrupt vector.

Also, what does it mean when an interrupt is said to be "serviced"?

Thank you very much, and sorry for the long paragraphs, I am just a little confused by many aspects of this !

Best Answer

  • what does it mean when an interrupt is said to be "serviced"?

    When the thing requesting the interrupt is taken care of, then it is called "serviced." This could be as simple as reading the next character from the keyboard, or sending the next packet of data out the ethernet card. Some interrupts are more important than others, so there is the capability to prioritize them.

    A useful article can be found here.

    The interrupt level identifier received as part of the interrupt cycle is used as an index into the interrupt vector

    As you mentioned, when an interrupt happens, the CPU basically asked "who did that?" and the interrupting device puts its interrupt identifier on the data bus. The CPU then takes this number and looks it up into the table of ISR to transfer execution to the handler.

    An interrupt is a request of the processor to suspend its current program and transfer control to a new program called the Interrupt Service Routine (ISR). Special hardware mechanisms that are designed for maximum speed force the transfer. The ISR determines the cause of the interrupt, takes the appropriate action, and then returns control to the original process that was suspended.