0%

Interrupt

Interrupt Controller

Microcomputer system 需要高效率的维护多个 I/O Device 让整个系统得以工作,早期设计采用 Polled Method 让 Processor 必须按顺序对每一个 I/O Device 做检测,显而易见,这不仅会产生不必要的 Cost,Throughput 也没有任何提高,还会限制 Microcomputer 执行更多的 Task,我们需要一种更优的方法处理不必要的 “Ack”。

Polled Method

![Polled Method](2025/11/06/Interrupt/Polled Method.png “Polled Method”)

Polled Method 让 Processor 主动向 I/O Device “Ask” 谁需要维护,Interrupt Method 则让 I/O Device 主动向 Processor “Req” 服务。理想情况下,Microprocessor 执行主要的 Task ,当有异步请求时,Processor 在完成正在执行的指令后将获取一个 New Routine 来服务 “Req” 的 I/O Device,服务完成后,Processor 将从 Left Off 处 Resume。因此,Throughput 将大幅提高,并且Microcomputer 能够执行更多的 Task。

Interrupt Method

![Interrupt Method](2025/11/06/Interrupt/Interrupt Method.png “Interrupt Method”)

I/O Device 需要通过 Interrupt Controller 间接向 Processor 请求服务,由此可见,Interrupt Controller 在其中充当 Manager 的角色。是否屏蔽 I/O Device,在非屏蔽 I/O Device 中找出优先级最高的 “Req”,并确定其是否拥有比当前 Processor 正在执行的 Routine 更高的优先级,这些都需要 Interrupt Controller 完成。Interrupt Controller 通过 Port I/O 访问,可以使用 in 和 out 编程,因此 Interrupt Controller 又称为 Programmable Interrupt Controller,简称 PIC。

Programmable Interrupt Controller 8259A