What Are System Interrupts?

By J.T. Barett

Although some computers, such as the one that runs your toaster oven, perform one task at a time, desktop PCs, smartphones and mainframes have several processes working simultaneously. The computer manages this through system interrupts, a mechanism by which one program temporarily gets priority over others. The central processing unit allows various kinds of interrupts based on a predetermined task hierarchy.

Multiple Programs

A modern PC, smartphone or server holds several programs in memory, although the CPU runs only a handful at any given moment; most are idle. Programs include applications such as your word processor, spreadsheet and email, utility functions such as memory monitors and print spoolers, and the programs that manage your computer’s network card, keyboard and speakers. When an important program needs service, it issues an interrupt to the CPU, which stops other work in progress to take care of the pressing task. The CPU services the interrupt only if it has priority over other tasks.

Hardware Interrupts

Hard drives, network cards, printers and other devices issue hardware interrupts to get the CPU’s attention. For example, a program requests data from the hard drive; although this task takes about 10 milliseconds, this is a long time to the CPU, which performs other work during the interim. When the hard drive finds the data, it issues a hardware interrupt, telling the CPU to stop what it’s doing temporarily and deliver the data to the requesting program.

Software Interrupts

Programs issue software interrupts to handle special requests through the computer’s operating system. For example, in your word processor, you want to paste the date into a page heading. The word processor issues a software interrupt, requesting the date from Microsoft Windows. The word processor waits briefly as Windows retrieves the date from the system calendar. When the date is ready, Windows returns control to the word processor. Software interrupts have a relatively low priority. if, while getting the date, the CPU gets a request from the hard drive, the CPU services the hard drive interrupt first, then finishes retrieving the date.

CPU Traps

The operating system reserves several very high-priority interrupts for emergencies. For example, a program’s data becomes corrupt, causing it to crash. The operating system issues a CPU trap which stops the program and displays a warning message on the screen, letting you know what happened. In more extreme cases, the operating system itself develops a severe problem. It issues another CPU trap which displays a diagnostic message and halts all processing.