The first lesson in power management on modern electronics is understanding that nothing is really off until you pull the plug. In my own personal computer lab I acquire a nice tan with the computers and room lights turned off. Routers, printers, surge protectors, backup power, speakers, and monitors all emit a radiant, friendly glow from their many LEDs. I have a running peeve with Hewlett-Packard over power switches on printers. My old HP6L doesn’t even have a power switch. The newer Laserjet 3050 has a switch located on the back, way down at the bottom, requiring a long double-jointed arm to reach it. I’m waiting for HP to claim green creds so I can scoff at them.
The major power users on a PC are the display, the CPU or graphics card, hard drive, LAN interface, and power supply loss. Hardware vendors are paying serious attention to cutting power consumption, so you can factor this in when you’re shopping. The Kill A Watt electric consumption monitor is a wonderful, cheap-and-easy device for measuring how power-hungry your gadgets are. It measures consumption by kilowatt hour just like the electric company, so you can easily calculate what your devices cost to run. It’s nearly always an eye-opener to see how much juice your gadgets are really drinking, even when they are turned “off”. It also captures voltage fluctuations so you can see how clean (or dirty) your power is.
Computers, like all electronic devices, last longer and perform better with clean power that is not beset with surges and sags. If Kill A Watt tells you that your power is flaky and unreliable you should consider using some line-conditioning devices, such as higher-end uninterruptible power supplies.
A very useful power management tool that is best for laptops, though it’s also useful on servers and desktops, is the powertop command (see Figure 1). If you see the “no ACPI power usage estimate available” message, unplug your laptop. (Do I also have to say “don’t unplug your server or desktop PC”?)
The Linux kernel itself used to be a restless critter than never truly rested, but had timer interrupt rates of 100 to 1000 Hz. This meant that 100 to 1000 times per second the kernel would look around for something to do. Lower Hz means less overhead, higher Hz means less latency. This changed with the release of the 2.6.21 kernel, also called the tickless kernel. When the tickless kernel is in idle mode, it’s really being idle and therefore not twitching in a bored fashion, uselessly consuming power and generating heat.
powertop shows you which processes are pestering the kernel during idle periods, and it gives you an endless stream of tips for tuning your system for more power efficiency. Some items will be obvious, like turning off Bluetooth and wireless when you don’t need them. Both are significant power users on laptops, and you’ll get longer battery life without them. It’s easy to measure the effects of your changes by watching the Power Usage line.
Some things are questionable, but worth trying. For example, the HAL daemon polls your CD/DVD drives constantly at 2 or 16-second intervals to see if new media have been inserted, so if you don’t read CDs or DVDs very often it might be worth disabling it with the hal-disable-polling –device [devicename] command. Turn it back on with hal-disable-polling –enable-polling –device [devicename]. If you’re thinking that this sort of polling seems a tad kludgy, you’re right. man hal-disable-polling says:
“It is the position of the HAL team that polling should be avoided at all costs as long as it doesn’t heavily impact the user experience in a negative way.”
It also gives a lot of helpful information on how polling affects performance. The good news is that a genuine Asynchronous Event Notification Infrastructure, in which media changes will announce themselves instead of waiting shyly to be announced, is coming to the Linux kernel, and then we won’t need polling anymore.
The Linux Skype client is a notorious CPU hog even when it is idle. There isn’t much you can do to correct this except don’t use it, though the Skype developers are working on the problem
Don’t get too crazy shutting down everything just to get some clean powertop runs- that’s not the point. The processes in bold are the significant ones to watch. It’s better to lug around an extra battery than to obsess over shaving off fractions of watts and crippling functionality.
Come back next week and we shall penetrate the mysteries of suspend, hibernate, standby, and how to kill hard drives by being too energy-frugal.
This article was first published on LinuxPlanet.com.