Software-based energy savings
Save power by choosing the right system and software configuration.
A computer's power consumption is driven by a number of more or less power-hungry components: In addition to electronic components such as the CPU, RAM, and motherboard are mechanical components such as optical drives and the hard disk. The biggest power hogs are the monitor, the CPU, the mechanical components, and the graphics card. Notebooks are less power hungry in general because vendors tend to use more economical hardware to improve battery life. Whereas a portable PC requires about 20 watts for normal operation, even the most frugal desktop will want 80 watts – not counting the monitor (see the box titled "Desktop Consumption").
Most of the attention for power savings goes to little laptops and big server rooms, but you can also save power on an ordinary desktop PC. Systems that consume less than 80 watts are often difficult to optimize, but computers that consume 100 watts (not including the monitor) have some room for improvement.
The easiest way of saving power on your system is to buy a new thin-film transistor (TFT) display. Older CRT monitors consume 60 to 80 watts when in use, whereas flat-screen monitors use just 25 to 35 watts depending on their brilliance and contrast. If you prefer to keep your legacy CRT, don't forget to enable the screen saver and select a blank screen. This reduced our lab monitor's power consumption to 65 watts. Even if the computer does not transmit an image signal (in sleep mode, for example) a CRT monitor will still consume a few watts of power.
Blank screen mode does not have much effect on the power consumption of a TFT display, but suspend mode does: Modern flat screens require less than 1 watt in this state. Assuming an average use of four hours a day, the CRT monitor will consume 4x365x80 watts per annum – that is, 116kWh. Standby mode (20 hours at 6 watts x 365 days) adds a further 44kWh. If power costs 20 cents per kilowatt hour, the CRT will add US$ 30 a year to your electricity bill, compared with US$ 9 for a TFT.
The CPU and graphics card are also major consumers. If you don't use 3D programs at all, or rarely use them, an on-board graphics chip is your best option. The graphics card driver is also important. A driver specially designed to support a card often reduces power consumption. If you have an additional plugin graphics card in your computer and don't actually need it, just remove the card. Most motherboards will automatically enable the integrated graphics card as soon as you remove the plugin card. Removing the plugin graphics card from a fairly ancient machine – with an integrated Intel GM865 graphics chip and a Radeon 9200 card (AGP) – and using the Intel chipset saved 5 watts.
A hard disk drive consumes between 8 and 12 watts. Many legacy machines use two or more disks because users add disks to increase storage capacity. If you replace three disks of low capacity with a state-of-the-art 500GB hard disk, you can save around 20 watts.
Avoid leaving CDs or DVDs in drives unless you need them. Some programs access these drives at boot time to collect information about the media. KDE also creates a directory for optical drives at login time. Most DVD drives consume about 20 watts of power when they power up, and this value can increase to 30 watts during normal operations.
The exercise of reducing power consumption is an interesting way to learn about your computer, and many users believe that saving energy is intrinsically important regardless of the monetary effects, but just to keep it all in perspective: A reduction of 20 watts will probably save around US$ 5 to US$ 20 per year depending on your usage and power service costs.
The Linux kernel and many applications offer a range of features that let users reduce power consumption, either to improve battery life or save money. Up until recently, a desktop PC's power consumption was typically ignored. This was never true of laptops because the battery is a very limited resource. It stands to reason that power-saving functionality and software is almost exclusively the reserve of notebooks.
To measure your notebook's power consumption in battery-powered mode, you can either opt for the desktop's integrated tools or install add-on software. On Gnome, the power manager displays a battery pictogram in the panel and warns you if you are about to lose battery power (Figure 1). On KDE, you can build and install a tool such as the KThinkBat monitor , which displays the residual charge for up to two batteries, as well as your notebook's current power consumption in watts.
If you have a desktop, the only way to measure consumption – and to test how effective your attempted savings are – is to attach an ammeter (Figure 2) . The formula consumption in watts * daily use in hours * 0.365 * price of electricity per kWh gives you a fair approximation of what your machine is adding to your electricity bill each year.
The display and the CPU are typically the biggest power hogs, although it is fairly simple to minimize the consumption of both components. The Gnome and KDE power-saving applets allow users to switch off external LCD displays and CRTs after a specified idle time. This functionality relies on DPMS.
On a notebook, KPowersave (Figure 3) or the PowerManager (the kde-guidance-powermanager package) and the Gnome brightness applets can do far more than just switch the display on and off, including the ability to dim LCD displays. Reducing the brightness saved around 10 percent on our lab machine (Lenovo X61s).
At the Heart of the Machine
The processor can turn out to be a power hog. For many years, CPUs consumed the same amount of power whether idle or fully loaded. Power-saving technologies such as AMD's Powernow and Cool'n'Quiet and Intel's Speedstep have introduced a more sophisticated approach. Under the hood, these technologies are basically a combination of several switchable clock speeds and processor voltages (P States) depending on the CPU – the PowerTOP program will tell you which states your CPU supports, but more on that later.Distributions with the current kernel support this function both on notebooks and on desktops without the need to modify the configuration.
Frequency scaling is also supported by many legacy processors on Linux. When the computer is idle, the Linux kernel will slow down the CPU. The graphical power-saving applets in Gnome and KDE call this Ondemand and Dynamic.
In addition, you can toggle your computer between various modes: Performance (CPU does not slow down) and Power saving (CPU always runs at the lowest clock speed). The latter state is not always the best approach to saving power. Again, this depends on the processor, which will consume a fair amount of power at high speed. If the CPU does not switch to a higher clock speed to handle the tasks faster, it will consume more power for a longer period of time. Dynamic frequency scaling is a better solution: The CPU completes its tasks at maximum speed and then goes back to sleep again.
Some bad guys wake up the computer on its power-saving breaks between production states. In fact, some of them wake up the computer several hundred times per second, even in idle state. This costs power, too. Up until kernel 2.6.21 (or 2.6.23 for 64-bit architecture), the kernel itself continually woke up the CPU because of its 1,000-Hz timer interrupt cycle. Many Userspace programs and kernel modules also use high-frequency timers that regularly check for keyboard input.
The PowerTOP  tool (Figure 4), which runs on any Linux distribution with kernel 2.6.21 or newer, will help you identify the culprits. For older distributions, you might need to build the current kernel yourself, then copy the PowerTOP archive onto your machine and unpack. If you have installed a full build environment, just a few commands are all it takes to build, install, and launch PowerTOP. Become root and type:
make make install powertop
PowerTOP shows your CPU's P States and C States. C States are only available for mobile processors. On top of this, you see how much time the processor spends in each C State, and this is significant for energy efficiency. The aim is to keep the CPU in one of the two top C States for 90 percent of all idle time. PowerTOP not only shows you how many times per second the CPU has to wake up from its deep sleep, but also which programs and modules are responsible.
To find out which tangible piece of software is hiding behind the cryptic label, check out the "Tips & Tricks" section for PowerTOP on the LessWatts  power-saving website.
To apply the suggestions that PowerTOP displays at the bottom of the screen immediately, press the key displayed by the program. This will substantially optimize your system. To make sure your computer starts saving power immediately the next time you boot it, without needing to load PowerTOP first, you need to add the commands to your /etc/rc.local file. The system automatically executes the script whenever it changes the runlevel. If the file does not exist on your favorite distribution, create a file called local and populate it with the required power-saving commands. Then, working as root, make the file executable, copy it to /etc/init.d, and link it to each runlevel in which you want to execute the script:
# chmod 755 local # cp local /etc/init.d # ln -s /etc/init.d/local /etc/rc2.d/S99local
The last line in this example just links the local script with runlevel 2, the standard runlevel for most distributions. If you frequently work in other runlevels, you will need to set up more links along the same lines.
To take some of the load off a power-hungry CPU, it is a good idea to check out process-hungry software. By disabling the 3D desktop and extensions, such as Superkaramba or the gDesklets, you can take some of the load off the graphics card.
The Strigi and Beagle search agents regularly stress the CPU.
Buy this article as PDF
VMware bids for a stake in the container industry with a bold effort to integrate containers with its classic virtualization system.
3ROS attack tool lowers the technical bar so anyone can be an intruder.
Mozilla's latest browser offers powerful new privacy feature
If attackers are on your system, saving your passwords in a password vault is no protection.
Faulty hash algorithm persists, despite efforts by experts to raise awareness.
Powerful man-in-the-middle attack is now targeting online shopping.
Another high-profile coder says the kernel team needs a kinder, gentler culture.
Bug database has a bug of its own that could allow an intruder to create an unauthorized account.
Report focuses federal resources on achieving universal Internet access.
Leading browser makers say “no” to porous encryption algorithm