Poll v / s Interruption

I have a basic doubt regarding interrupts. Imagine a computer on which there are no interruptions, so in order for it to perform I / O operations, the CPU will have to poll * the keyboard for pressing a key, mouse for a click, etc. At regular intervals. Now, if it interrupts, the CPU will continue to check if the interrupt line was high (or low) at regular intervals. So, how CPU cycles are saved using interrupts. According to my understanding, instead of checking the device, we check the interrupt line. Can someone explain what basic logic I'm wrong.

* Here, during the survey, I do not mean that the processor is in a busy state. Quote Wikipedia "A survey also refers to a situation where the device is repeatedly checked for availability, and if the computer does not return to another task"

+5
source share
5 answers

@ David Schwartz and @RKT are right, no CPU cycles are required to check the interrupt line.

Basically, a processor has a set of interrupt wires that are connected to a set of devices. When one of the devices has something to say, it includes an interrupt wire that starts the processor (without the help of any software) to pause the execution of current instructions and start the launch of the handler function.

. , ( , ) , , . N , N th , . , , , , ​​ , , , C " , X", " , Y", " , Z" .. , , .

( "" Unix) , , . , userland OS , , , . , , -, , . , , . , , , , . , , , , ( , ).

+5

. , CPU. , , , , .

+3

"CPU ": () , ISR () .

CPU IRQ ( ) IF ( )

+1

: , , . . (ISR). , IRQ , . , Word (PSW) . CPU ISR. - , , . , : Parrnell, , . , 1

-1
source

There are two different methods for input / output of a computer system (polling and interruption). During the interrogation, the CPU constantly remains busy, or the input data is transferred to the input-output device, and if so, it checks the source port of the corresponding device and the priority of this input for its maintenance.

In interrupt-driven mode, when data is transferred to the I / O device, an interrupt is generated, and the CPU checks the priority of this input for servicing it.

-1
source

All Articles