Reputation: 2251
It is said that
When an interrupt is sent by the PIC, the PIC will not send another interrupt from that same source until it gets acknowledged through an I/O port. This is because interrupt handlers usually manipulate critical data structures and would not withstand being interrupted by new invocations of themselves (i.e. they are not reentrant).
I don't understand. Is there something different between interrupts of the same source and different source?
Upvotes: 3
Views: 250
Reputation: 4036
The other answers are great, but one other thing to bear in mind is level triggered interrupts. If the interrupt controller did not disable the interrupt it was triggering then a level triggered interrupt would immediately retrigger itself before the ISR got chance to tell the hardware to stop interrupting. Typically an ISR does not only need to reset the PIC, it also needs to tell the harward it is talking to to shut up. If the hardware were to keep interrupting then the stack would overflow and the OS would be toast.
Upvotes: 1
Reputation: 9006
Interrupts from the same source will have to operate on the same data structures as the currently active interrupt. Interrupts from different sources will be operating on different data structures. So you can't have two interrupts from the same source active at the same time unless they were smart enough to coordinate their activities, and the current design prevents them from being active so that the programmer doesn't have to worry about that complexity.
Taking a (contrived) example from the real world, imagine a table where people go to pick up tickets for something, where there are different clerks for different ranges of the alphabet based on last name. Two people whose last name ends in A can't both pick up tickets at the same time because otherwise the clerk responsible for them might get confused and make a mistake. However, someone whose last name ends in A can pick up tickets at the same time as someone whose last name ends in Z because their respective clerks are operating on different lists of names and piles of tickets, so one won't negatively affect the other.
In this example, the letter of the customer's last name is the source, and the customer is the interrupt. The clerk is the interrupt handler, and the list of names and pile of tickets are the kernel data structures.
Upvotes: 3
Reputation: 19704
You can get interrupts from different sources: timer, hard disk, network, etc. Each one of those interrupts will be handled by a different interrupt handler.
Therefore, if an interrupt from source (S1) arrives while another interrupt from source (S2) is being processed, there is no problem. Both interrupts are being handled by different interrupt handlers.
On the other hand, if an interrupt from source (S) arrives while the handler for that source is processing another interrupt, the handler will not be able to process the second one since it is not designed in a reentrant way (i.e., it cannot be interrupted, process the new interrupt, and then go back to process the original interrupt).
You may have a look at Understanding the Linux Kernel for detailed information on the way interrupts work in the Linux kernel.
Upvotes: 7