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

Part 12: Example 2 (Maximizing Idle Periods) - Avoid polling and busy wait loops

Another undesirable program construct is the tight polling loop. “Tight” refers to iteration frequency and the desire to commence subsequent processing immediately after a particular condition has been detected. As with high-resolution periodic timers, the effect for power management is to fill idle time intervals with constant and unnecessary computation, robbing the OS of opportunities to apply power-saving (Cx) states when little work is being done by the system. Developers are encouraged to increase polling intervals to the maximum level possible, or to avoid polling entirely by using event-driven programming constructs. Busy wait loops can be avoided by using synchronization primitives like join() or lock().

For more complete information about compiler optimizations, see our Optimization Notice.
Tags: