先决条件 – 8085 微处理器中断
1. 硬件中断:
硬件中断是由某些硬件设备引起的,例如请求启动 I/O、硬件故障或类似的东西。引入硬件中断是为了避免在轮询循环、等待外部事件中浪费处理器的宝贵时间。
例如,当 I/O 操作完成时,例如从磁带驱动器将一些数据读入计算机。
2. 软件中断:
软件中断是通过使用 INT 指令调用的。此事件立即停止程序的执行并将执行传递给 INT 处理程序。 INT 处理程序通常是操作系统的一部分,并确定要采取的操作。它发生在应用程序终止或从操作系统请求某些服务时。
例如,输出到屏幕,执行文件等。
硬件中断和软件中断的区别:
SR.NO. | Hardware Interrupt | Software Interrupt |
---|---|---|
1 | Hardware interrupt is an interrupt generated from an external device or hardware. | Software interrupt is the interrupt that is generated by any internal system of the computer. |
2 | It do not increment the program counter. | It increment the program counter. |
3 | Hardware interrupt can be invoked with some external device such as request to start an I/O or occurrence of a hardware failure. | Software interrupt can be invoked with the help of INT instruction. |
4 | It has lowest priority than software interrupts | It has highest priority among all interrupts. |
5 | Hardware interrupt is triggered by external hardware and is considered one of the ways to communicate with the outside peripherals, hardware. | Software interrupt is triggered by software and considered one of the ways to communicate with kernel or to trigger system calls, especially during error or exception handling. |
6 | It is an asynchronous event. | It is synchronous event. |
7 | Hardware interrupts can be classified into two types they are: 1. Maskable Interrupt. 2. Non Maskable Interrupt. | Software interrupts can be classified into two types they are: 1. Normal Interrupts. 2. Exception |
8 | Keystroke depressions and mouse movements are examples of hardware interrupt. | All system calls are examples of software interrupts |