Optimizing Software Applications for Power: Part 4 (of 13)

Part 4: Operating System Power Management (OSPM)

A distinctive highlight of ACPI is the shift from BIOS-controlled power management in APM to operating system power management, or OSPM. Several reasons underlie this shift. First, the complexity requirements for power management have continued to grow and BIOS-based solutions increasingly pose integration difficulties with operating systems running at the software layer. Second, an OS-based solution allows the software management layer to evolve independently of hardware feature implementations. BIOS-based solutions are necessarily hardware-specific. Finally, an OS has a great deal of information on the applications and processes that run on the system. This information can be leveraged in making management decisions that anticipate usage patterns and respect system and user priorities.

Two key areas of OSPM management are, as the reader might guess, C-states and P-states. C-states, or “idle” states, dictate how much power savings can be achieved during a period of processor idleness. C-states can be applied on a per-core basis within today’s multi-core processors, lending an added degree of complexity to the management task. Typically, a series of stepwise timers are used to detect idleness and to advance the current C-state of an idle core through a sequence of deeper and deeper sleep states (C1, then C2, then C3, etc.) as idle time increases. Other algorithms are possible, and work is continually going on to develop more sophisticated control algorithms that jump to deeper sleep states earlier and generate better sleep state opportunities through OS task scheduling.[1]

Management of P-states, or CPU frequency scaling, is a similar enterprise. The operating system may choose among available P-states on a per core basis to determine the best power-performance tradeoff for a given set of policy objectives. A typical algorithm uses CPU utilization as an indicator, incrementally applying power-saving P-states (P1, then P2, then P3, etc.) as CPU utilization decreases. Sharp increases in utilization often prompt a “jump” back to P0. Different power management policies may be offered, reflecting different possible objectives. For example, a performance-maximizing policy may keep P-states at their maximum level throughout processing, while a power-savings strategy may opportunistically apply P-state changes based on rises and falls in CPU utilization. As with C-states, work on more sophisticated control algorithms is continually in the works, and integration with OS task scheduling is much discussed.[1]

References:
[1] Pallipadi, Venkatesh and Siddha, Suresh B. “Processor Power Management Features and Process Scheduler: Do we need to tie them together?” LinuxConf 2007.
Categories:
For more complete information about compiler optimizations, see our Optimization Notice.