views:

84

answers:

1

Just out of interest: what is the source code of system idle process? Which instructions are executed? How is CPU managed to enter power saving mode?

+4  A: 

System Idle Process continuously executes KiIdleLoop, with one thread for each processor. You can see this using a process viewer such as Process Explorer. This function essentially checks the Deferred Procedure Call (DPC) list and executes any pending items (e.g. for timers and hardware components). It then calls power management (PoIdle) which calls the HAL (HalProcessorIdle) so "power saving mode" can be entered. This, on x86 systems, simply consists of enabling interrupts (sti) and then the hlt instruction.

wj32
I'd suggest a couple of changes to your description, but otherwise it is spot on the money. Firstly "System Idle Process" is not a real process - it has no VM, you can't kill it etc. The Idle threads also do not need to check for DPCs - If a DPC is present, it is processed (as long as there is not something more important to do) - the fact that the thread is running means there is no DPC to run.
Stewart