---

The cpuidle subsystem

“Your editor recently had cause to dig around in the cpuidle
subsystem. It never makes sense to let such work go to only a
single purpose when it could be applied toward the creation of a
kernel-page article. So, what follows is a multi-level discussion
of cpuidle, what it’s for, and how it works. Doing nothing, it
turns out, is more complicated than one might think.

“On most systems, the processor is idle much of the time. We
can’t always be running CPU-intensive work like kernel builds,
video transcoding, weather modeling, or yum. When there is nothing
left to do, the processor will go into the idle state to wait until
it is needed again. Once upon a time, on many systems, the “idle
state” was literally a thread running at the lowest possible
priority which would execute an infinite loop until the system
found something better to do. Killing the idle process was a good
way to panic a VAX/VMS machine, which had no clue of how to do
nothing without a task dedicated to that purpose.

“Running a busy-wait loop requires power; contemporary concerns
have led us to the conclusion that expending large amounts of power
toward the accomplishment of nothing is rarely a good idea. So CPU
designers have developed ways for the processor to go into a
lower-power state when there is nothing for it to do. Typically,
when put into this state, the CPU will stop clocks and power down
part or all of its circuitry until the next interrupt arrives. That
results in the production of far more nothing per watt than
busy-waiting.”

Complete Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis