2011年11月7日 星期一

Polling vs Interrupt

最近作業要比較Polling 跟 Interrupt, 目前查到這個投影片還挺不錯的, 晚點再做一些網路資料的整理

http://everything2.com/title/Polling+vs.+interrupt
http://www.atarimagazines.com/compute/issue149/60_Interrupts_made_easy.php

我這邊用英文整理了一些重點, 有興趣可以參考


Interrupt
Definition: An interrupt is an event that stops the current process in the CPU so that the CPU can attend to the task needing completion because of the event.

Pros:
²  CPU doesn’t need to check if there is any events occur by peripheral. Only need to respond if an interrupt happened.
²  Response in real time.
Cons:
²  If more than one interrupt happened, the interrupt controller need to schedule the interrupts by priority or timing.

Polling
Definition: A polling-based program (non-interrupt driven) continuously polls or tests whether or not data are ready to be received or transmitted.

        Pros:
²  It can be efficient if events arrive rapidly.
        Cons:
²  It takes CPU time even when no requests pending.