Avoid polling

From Green software

(Difference between revisions)
Jump to: navigation, search
(References)
Line 4: Line 4:
Often a good performance results in energy savings. Polling is one of the few mechanisms that performs equally well as alternatives, but is more energy consuming.
Often a good performance results in energy savings. Polling is one of the few mechanisms that performs equally well as alternatives, but is more energy consuming.
-
 
-
== Advantages ==
 
-
 
-
== Drawbacks ==
 
== Implementations ==
== Implementations ==

Revision as of 08:43, 16 September 2010

Polling is regularly checking to see whether a certain condition has been met. It can be used for example to see whether a network message has come in or user input is ready for processing.

Instead of polling, an event based system can be used for more energy efficiency.

Often a good performance results in energy savings. Polling is one of the few mechanisms that performs equally well as alternatives, but is more energy consuming.

Contents

Implementations

Alternatives to constant polling are less frequent polling, signals, events or push.

Signals and events

Push

Less frequent polling

The less frequent polling is done, the better. This is not always possible, but there is a special case for polling frequency. Polling less frequent than the operating system's kernel schedule, is considerably much more energy efficient. For example for Windows systems, it is adviced to poll not more often than every 15 ms [1].

Flexible timers

In Windows 7 it is possible to introduce a variable in a timer schedule, so that the operating system can schedule it in the most energy efficient way possible. The operating system will try to schedule timed events together, or close to the actual kernel events. Considerable amounts of energy can be saved with this technique, because the CPU can spend more time being idle with no extra startup in between kernel jobs. In Windows 7 this technique is called timer coalescing [1].

In Linux systems the round_jiffies() system call does almost exactly same thing.

The Heartbeat Daemon that runs on the Nokia operating system Maemo for mobile phones wakes up applications on requested intervals. The daemon also internally groups the wakeups together in order to save power. Here no further action by the software developer is needed.

Cases

References

[1]. Timers, Timer Resolution, and Development of Efficient Code. 2010. Microsoft Corporation.

Sources

This best practices was recognized as such by IT professionals, described in Energy efficient software.

Personal tools