当前位置:网站首页>Interrupt and polling
Interrupt and polling
2022-06-23 13:42:00 【Little monster】
Interrupt and polling
introduction
serial interface ( Foreign name :Serial Interface, abbreviation : A serial port ) Is to use serial communication Mode extension interface , finger Data is transmitted bit by bit . The characteristic of serial interface is that the communication circuit is simple , As long as a pair of transmission lines can achieve two-way communication ( The telephone line can be directly used as the transmission line ), Thus greatly reducing the cost , special It is suitable for long distance communication , But the transmission speed is slow .
There are generally two ways for external devices to interact with the CPU : Interrupt and polling .
interrupt (Interrupt)
Interrupt is a kind of interrupt sent by hardware or software IRQ( Interrupt signal ), once CPU Received interrupt signal ,CPU The current task will be suspended , And keep the site , To respond to an interrupt request from a peripheral .
The interrupt notification mechanism asynchronously calls the attention of the processor through hardware signals , It solves the problem of resource waste caused by speed mismatch between external devices and processors .
polling (Polling)
quite a lot I/O Each device has a status register , Used to describe the current working state of the equipment , Whenever the state of the equipment changes , The device will modify the corresponding status register bits . By constantly querying the device's status register ,CPU You can know the status of the equipment , So as to carry out necessary I/O operation . In order to save CPU resources , Queries are often not continuous , But on a regular basis .
The polling method is simple 、 Easy to implement 、 Easy to control , There are a lot of applications in many small systems . Not very sensitive to those 、 Have a lot of CPU Resource system , Polling is widely used .
The disadvantages of the polling method :
- Increase system overhead . Both task polling and timer polling need to consume corresponding system resources .
- Unable to sense the change of equipment status in time . Changes in the state of the device within the polling interval can only be detected at the next poll , This will not meet the real-time sensitive application market .
- waste CPU resources . Whether the state of the equipment changes or not , Polling is always on , In practice , The state of most devices usually changes less frequently , Polling will be wasted CPU Time slice .
The difference between interrupt and polling
- Idling loss exists in polling mode , It is controllable and real-time . Consume a lot cpu The processing time of , Periodically and continuously detect the occurrence of external events .
- The high priority and fast response requirements of interrupts will cause... Under extreme conditions “ Live lock ” effect . Various I / O devices operate in parallel through interrupt processing , Increase the number of interrupts , Can cause CPU Unable to respond to interrupt ; If an interrupt occurs after the buffer is full of data . So in the process of data transmission , There is more chance of interruption , Will consume a lot of CPU The processing time .
- Interruption is not a protocol , It's a hardware mechanism ; Polling is the opposite .
- The processor checks the interrupt register every instruction cycle , If the interrupt register is valid , That is, there is an interruption , that cpu Will perform a series of interrupt related operations . That is to say, interruption is also necessary CPU check. Interrupt and polling are not the exact opposite .
边栏推荐
- Quartus II 13.1 detailed installation steps
- 前AMD芯片架构师吐槽,取消 K12 处理器项目是因为 AMD 怂了!
- The redis keys command should be used with caution in the production environment. It is best to shield it
- 服务稳定性治理
- Loss, duplication and backlog of message queues
- 5 technical vulnerabilities related to NFT
- What are the conditions for a mature knowledge management?
- "Four highs" of data midrange stability | startdt Tech Lab 18
- .Net怎么使用日志框架NLog
- 在线文本过滤小于指定长度工具
猜你喜欢

Hanyuan hi tech 8-way telephone +1-way 100M Ethernet RJ11 telephone optical transceiver 8-way PCM telephone optical transceiver

Hanyuan hi tech 1-channel gigabit optical port to 4-channel Gigabit Ethernet electrical port Gigabit 1-optical 4-electric optical fiber transceiver

The two 985 universities share the same president! School: true

腾讯云TDSQL-C重磅升级,性能全面领跑云原生数据库市场

Windows install MySQL

The way out after the development of Internet technology -- the birth of IVX

Loss, duplication and backlog of message queues

Common usage of OS (picture example)

Go write permissions to file writefile (FileName, data, 0644)?

美国的国家公园概览
随机推荐
理解ADT与OOP
The two 985 universities share the same president! School: true
Go寫文件的權限 WriteFile(filename, data, 0644)?
You call this shit MQ?
First exposure! The only Alibaba cloud native security panorama behind the highest level in the whole domain
20000 words + 30 pictures | MySQL log: what is the use of undo log, redo log and binlog?
Overview of national parks in the United States
Runtime application self-protection (rasp): self-cultivation of application security
Deci 和英特尔如何在 MLPerf 上实现高达 16.8 倍的吞吐量提升和 +1.74% 的准确性提升
实战监听Eureka client的缓存更新
What is the version of version 1.54 when connecting to Oracle?
Have you ever encountered incompatibility between flink1.15.0 and Flink CDC MySQL 2.2.1? f
Configure SSH Remote Login for H3C switch
What is the principle of live CDN in the process of building the source code of live streaming apps with goods?
Esp32-c3 introductory tutorial problems ⑧ - blufi_ example. c:244: undefined reference to `esp_ ble_ gap_ start_ advertising
Multi-Camera Detection of Social Distancing Reference Implementation
Hanyuan high tech USB2.0 optical transceiver USB2.0 optical fiber extender USB2.0 optical fiber transmitter USB2.0 interface to optical fiber
人脸注册,解锁,响应,一网打尽
[deeply understand tcapulusdb technology] transaction execution of document acceptance
Hanyuan hi tech 1-channel gigabit optical port to 4-channel Gigabit Ethernet electrical port Gigabit 1-optical 4-electric optical fiber transceiver