📜  os 中中断的目的是什么 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:14.594000             🧑  作者: Mango

代码示例1
Interrupts are signals sent to the CPU by external devices, normally I/O devices. They tell the CPU to stop its current activities and execute the appropriate part of the operating system.

There are three types of interrupts:

Hardware Interupts are generated by hardware devices to signal that they need some attention from the OS. They may have just received some data (e.g., keystrokes on the keyboard or an data on the ethernet card); or they have just completed a task which the operating system previous requested, such as transfering data between the hard drive and memory.
Software Interupts are generated by programs when they want to request a system call to be performed by the operating system.
Traps are generated by the CPU itself to indicate that some error or condition occured for which assistance from the operating system is needed.