Get Understanding the Linux Kernel, 3rd Edition currently with O’Reilly virtual learning.

You are watching: What is the purpose of an interrupt

O’Reilly members experience live virtual training, add to books, videos, and digital content from 200+ publishers.


together the name suggests, interrupt signals carry out a method to draw away the processor to code exterior the normal circulation of control. As soon as an interrupt signal arrives, the CPU must stop what it’s right now doing and also switch to a new activity; that does this by saving the current value of the program counter (i.e., the contents of the eip and cs registers) in the Kernel mode stack and also by place an address related come the interrupt kind into the regimen counter.

There space some points in this thing that will certainly remind girlfriend of the paper definition switch explained in the ahead chapter, brought out when a kernel substitutes one process for another. But there is a crucial difference in between interrupt handling and process switching: the password executed by one interrupt or by an exception handler is no a process. Rather, that is a kernel manage path the runs in ~ the expense of the same procedure that to be running as soon as the interrupt arisen (see the later section "Nested Execution of Exception and Interrupt Handlers“). Together a kernel regulate path, the interrupt handler is lighter 보다 a process (it has less context and also requires less time to collection up or tear down).

Interrupt dealing with is among the many sensitive tasks performed by the kernel, since it must fulfill the adhering to constraints:


Interrupts deserve to come anytime, once the kernel may want to end up something else it to be trying come do. The kernel’s goal is therefore to acquire the interrupt the end of the means as quickly as feasible and defer as lot processing as it can. Because that instance, expect a block of data has arrived ~ above a network line. When the hardware interrupts the kernel, it might simply mark the existence of data, provide the processor earlier to every little thing was to run before, and also do the rest of the processing later (such as moving the data right into a buffer wherein its recipient procedure can uncover it, and also then restarting the process). The tasks that the kernel requirements to do in an answer to one interrupt are thus separated into a crucial urgent component that the kernel executes right away and also a deferrable part that is left because that later.

Although the kernel may accept a new interrupt signal while dealing with a vault one, some vital regions exist inside the kernel code whereby interrupts should be disabled. Such an important regions have to be restricted as much as feasible because, according to the ahead requirement, the kernel, and an especially the interrupt handlers, have to run most of the time with the interrupts enabled.


Get Understanding the Linux Kernel, 3rd Edition currently with O’Reilly digital learning.

O’Reilly members suffer live virtual training, add to books, videos, and digital content from 200+ publishers.


start your totally free trial

About O’Reilly


Support

facebook-logo linkedin-logo youtube-logo

Download the O’Reilly App

take it O’Reilly with you and also learn anywhere, anytime on her phone and also tablet.

See more: What Is The Time Difference Between Boston And California, Usa


*
*

Watch ~ above your large screen

View all O’Reilly videos, Superstream events, and also Meet the skilled sessions ~ above your house TV.