Make your Linux netbook battery last longer

3. CPU optimisation

We're going to stick within the /sys subsystem to make a few changes to how the CPU is handled. This can be a rather experimental area to play around with, which may explain why many distributions choose not to enable some of the more optimal modes, but it can be worth the trial and error. It's also dependent on the features embedded within your CPU.

Recent models built around Intel's newer Atom processors shouldn't have any problems, but older models may not be so flexible. You should also make sure you've got a backup of any critical data on your netbook's drive before trying things out.

The most important parameter can be discovered by typing cat / proc/sys/vm/laptop_mode. If your machine returns a value of 0, then Laptop mode is currently disabled. You can enable it by typing echo 1 > /proc/sys/vm/ laptop_mode.

Step 3

When Laptop mode is enabled, the kernel takes special care only to shuttle data to your storage device when it needs to, saving your battery in the process. You can disable this by swapping the 1 for a 0 in the previous command.

You can get even deeper into how the processor handles tasks by changing how the scheduler works. This is only going to be beneficial if you've got a multicore machine, and it changes the way processes are loaded onto each core. Check the contents of the '/sys/devices/system/cpu/sched_ mc_power_savings' location.

If this is set to 0, your netbook is configured for optimal CPU performance – which is useful for mathematically intensive apps, but not so great if you're only planning to read a couple of emails. Changing this value to 1 will ask the scheduler to use the threads and processes more efficiently before more are created, effectively saving your other CPU cores from being used and saving energy in the process.

4. Process pruning

The best thing about a netbook distro is that it is already pruned down to the bare minimum of applications and running processes. There should be very little you can do to improve things here, but there's never any harm in taking a look.

The quickest and easiest way of checking what processes are running is to run the 'top' command from the command line. It may look a little perfunctory, but it tells you everything you need to know. It's called top because it shows you a list of the processes sorted by CPU time, with the highest at the top.

This list changes dynamically, and the processes at the top usually include top itself, the Xorg X-Server (which is rendering the graphics on the screen) and maybe the gnome terminal (if this is how you're running top).

You can also remove processes and change their priority, but you need to be careful about this as you could seriously affect the performance of your netbook (and even lose some of your data). The safest option is to look for tasks that are running under your user account: you should be able to see your name in the second column for any tasks falling into that category.

Step 4

On Moblin 2.0, for instance, we've noticed that the Nautilus file manager is used to manage external storage such as USB sticks. Occasionally, especially when you remove a USB stick without first unmounting it, Nautilus is left running, taking up precious CPU cycles. You'll even be able to see that it's the process connected to the USB device because this path follows the name of the process.

You can remove tasks by pressing [K] to enter Kill mode and then entering the process number. This is listed in the top output below the top line.

If you're running a standard Linux installation, then there are a great number of processes you might want to consider removing. These could include indexing routines, compositing managers, background servers and log file generation.

Further information can be found by looking at how the 'initd' process works and working out how to disable these services at bootup.