# irq handling in hardware, how do they work?

## _______0

hi,

At which frequency does the irq part of the hardware operate? What controls it? I sounds wierd that devices should have to WAIT to process their job.

irq turns on and off serialy for each device signal? There can't be lanes permanetly connected to the cpu for an un-interrupted communication?

It just sounds odd.

In the case of sound card, if there's a song playing it means  that X bits are transfered from/to the sound card until another device interrupts the sound card, then the sound card picks up again? If so, a long song is never played continuously but chopped up along the way and re-assembled somewhere else.

How is possible to watch movies and and listen smoothly if there are interrupts? Why don't we see and listen movies and sound with interruptions?

thanks

(or it's all magic?)

----------

## aCOSwt

 *_______0 wrote:*   

> (or it's all magic?)

 

Yes it is !   :Twisted Evil: 

OK then, more seriously there are different kinds of interrupts. So there cannot be a unique answer to each one of your questions apart from : "It depends"

 *_______0 wrote:*   

> At which frequency does the irq part of the hardware operate?

 

Apart from timer related interrupts, there is nothing such as a given frequency of interrupts.

Interrupts occur when events occur. If the event is periodic then the interrupt will be generated at the same period; if the event is not periodic then so will be the interrupt.

 *_______0 wrote:*   

> I sounds wierd that devices should have to WAIT to process their job.

 

In the vast majority of the times, devices do not wait to process their job. Devices are generally considerably slower than the CPU of the system. The concept of interrupt has been invented so that the CPU does not have to wait for a device to process its job.

 *_______0 wrote:*   

> In the case of sound card, if there's a song playing it means  that X bits are transfered from/to the sound card until another device interrupts the sound card

 

Formally speaking no other device will interrupt the sound card. Another device may interrupt the CPU which was busy with the sound card and require the CPU for something else if the priority of the interrupt is higher than the priority of the sound card interrupt.

 *_______0 wrote:*   

> If so, a long song is never played continuously but chopped up along the way and re-assembled somewhere else.

 

Seen from the CPU, yes, you are correct, the CPU will not manage the whole sound file in a single go. Seen from the CPU, the sound file will be chopped.

But not necessarily seen from the sound card itself... if... the CPU is fast enough, not that much loaded and not that much interrupted by higher priority interrupts. And more surely depending on the size of...

 *_______0 wrote:*   

> How is possible to watch movies and and listen smoothly if there are interrupts? Why don't we see and listen movies and sound with interruptions?

 

... Buffers !

Devices get input and output buffers (RAM) that the CPU writes or reads following its own pace and that the device reads or writes following its own pace.

If these buffers are undersized, you might well get your movies / sound interrupted depending on the load of the CPU.

----------

## PaulBredbury

 *_______0 wrote:*   

> How is possible to watch movies and and listen smoothly if there are interrupts?

 

Because the CPU is fast enough to do it all. Especially if the GPU is helping out with the video decoding via e.g. VDPAU.

----------

