polling vs interrupt
| 轮询 | 中断 |
|---|---|
| In polling the CPU keeps on checking all the hardwares of the availablilty of any request | In polling the CPU keeps on checking all the hardwares of the availablilty of any request |
| The polling method is like a salesperson. The salesman goes from door to door while requesting to buy a product or service. Similarly, the controller keeps monitoring the flags or signals one by one for all devices and provides service to whichever component that needs its service. | An interrupt is like a shopkeeper. If one needs a service or product, he goes to him and apprises him of his needs. In case of interrupts, when the flags or signals are received, they notify the controller that they need to be serviced. |
中断
中断是来自硬件设备通过电子信号产生,并被引导到中断控制器的引脚上。
An interrupt is produced by electronic signals from hardware devices and directed into input pins on an interrupt controller (a simple chip that multiplexes multiple interrupt lines into a single line to the processor)。
当产生interrupt后,内核中处理流程:
- Upon receiving an interrupt, the interrupt controller sends a signal to the processor.
- The processor detects this signal and interrupts its current execution to handle the interrupt.
- The processor can then notify the operating system that an interrupt has occurred, and the operating system can handle the interrupt appropriately.

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/67116.html