The mechanism of interruptions of a code stream on the part of a hardware (Механизм прерываний кодового потока со стороны аппаратной часть компьютера), страница 2

Now the so-called critical part of execution of the driver begins. Process of processing of interruption by the driver occurs in two stages: stage ISR (critical on time) and stage DPC (Deferred Procedure Call about which it will be told further). ISR carries out small preparatory process, and puts in system turn of the processor inquiry about execution of a noncritical part of the driver (it DPC procedures).

It is necessary to explain the term "DPC." DPC is simultaneously and level IRQL on which the DPC-procedures put in turn, and the system mechanism of execution of such procedures are carried out. The mechanism consists that for each processor there is a special turn of execution of a code - DPC turn. As soon as level IRQL goes down up to DPC (is below all levels of devices, but is higher than a level of performance of the user code threads), the system checks this turn on presence in it of inquiries. If those are available, there is their serial processing.

Procedure DPC of the driver makes more volumetric work, for example, concerning network cards, transfer of the answer to inquiry from a network. At times basic and unique task ISR of drivers is statement DPC procedure of the driver in turn DPC.

The scheme of processing DPC of turn.

Let's return to our experiment. After DPC the driver has performed the work, it transfers its results to one of dispatchers, in our case - to the special system module - to the dispatcher of input-output. Transfer occurs through the interface function exported by this module.

The further process can be foreseen - transfer to a server of a subsystem - transfer of a key to function expecting pressing (and it always is present if the system in one of internal procedures has not gone in cycles and has not come in clinch). After that procedure of processing of messages, of input field for example, (a system class of windows «EDIT») will make drawing a symbol on the screen in client area of the window.


We have tracked only hypothetical way of succession of events. It only an illustration. It means, what not all occurs in accuracy as it is described. It is possible to tell authentically only how there is a processing of typical hardware interruption in Windows.

In end of this report it would be desirable to specify not covered sides of a question on interruptions. Interruptions can be generated and by programs. For example, the user code for execution of any function of executive system which code is accessible only from a mode of a kernel, causes special service interruption then a code thread continues the performance already in a mode of a kernel. Interruptions can generate and the processor for self-checking, debuggings of an executed code, or at mistakes during execution of a code (run-time). The mistakes of performance leading to interruptions, refer to as exceptions (for example: division by zero, an incorrect code of operation, an exit at the control of value over borders).

In the conclusion let’s note that all this rather complex process occurs imperceptibly from the user. Actually it and should work - as soon as the user has pressed a key, he wants to see result of the actions on the screen.


Этот доклад посвящён механизму прерываний кодового потока со стороны аппаратной часть компьютера. В нём объясняются механизмы реагирования операционной системы Windows NT на аппаратные события: нажатие клавиш, передвижение мыши, и т.д.


Ответ на вопрос о прерываниях нужно искать в аппаратных глубинах системы, с доведением цепочки исследования до самого конца - получение прикладной программой сообщения о нажатии клавиши, с информацией, например о виртуальном коде этой клавиши.