Hi
I know that The Windows thread scheduling and DPCs(I mean DPCForIsr) run at at IRQL DISPATCH_LEVEL.
“When the clock interrupt is generated, the clock interrupt handler generally increments the counter of the current thread to calculate the total execution time of that thread, and decrements its quantum time remaining by 1. When the counter drops to zero, the thread scheduler has to be invoked to choose the next thread to be executed on that processor and dispatcher to perform a context switch. Since the clock interrupt occurs at a much higher IRQL, it will be desirable to perform this thread dispatching which is a less critical task at a later time when the processor’s IRQL drops. So the clock interrupt handler requests a DPC object and adds it to the end of the DPC queue which will process the dispatching when the processor’s IRQL drops to DPC/Dispatch level.”
and
“By default, all DPCs are set to medium priority. When the processor drops to an IRQL of Dispatch/DPC level, it checks the DPC queue for any pending DPCs and executes them until the queue is empty or some other interrupt with a higher IRQL occurs.”
http://en.wikipedia.org/wiki/Deferred_Procedure_Call
My question is:
If a DPC queue has one Thread scheduler and 2 DpcforIsr, How does windows execute these DPC routines?
I am asking this because if it executes Thread scheduler first and it schedule threads… This must be useless. Because there are 2 more DPCs in the queue and windows doesn’t execute thread while other DPCs are in the queue. While DPCForIsrs are working maybe another thread scheduler DPC will be sent.
So, Does windows execute drivers’ DPCs first and then if there is no drivers’ DPC in the queue, starts to execute thread scheduler and so threads are able to run in its quantas??
Is my explanation right?
Can you please help me the understand that mechanism.
Thanks.