Copyright (C) 2000-2006 Hidetoshi Ohtomo, Nature Heart Laboratory. All rights reserved.
I wrote and published this document in the hope of saving the earth from its serious condition, but WITHOUT ANY WARRANTY. It may contain technical errors, which damage the earth in unexpected ways. I cannot be responsible for such circumstances, though I did my best to avoid them.
This document is my original supplement to following works, which explain how to save computer resources while using Unix and X Window System. So please come back after reading them:
How much memory does your computer have? These days, software require much more memory than their ancestors did twenty years ago. There was a time when a machine equipped with 256 kilobytes of memory being considered a cutting-edge supercomputer. Since then, software grew larger as they incorporated new ideas and became more user-friendly, and some of them now demand a few megabytes of memory (or even more) each.
There are many software available today, and some of them are light and can be good alternatives for such fat software. Using lighter ones saves natural resources because:
Please pay attention to resource usage of software you use. Commands like ps(1) and size(1) are available for measuring program sizes. Look for and use lighter alternatives. Some of them are even freely redistributable, so it is easy to try them first.
Let me introduce some lighter alternatives.
Free Unix-like operating system for various architectures including Intel x86, Alpha and PowerPC. Its development is lead by Linus Torvalds. For more information, visit ibiblio.org/pub/Linux/, where many software and documents for Linux gather.
"Run Up-to-date Linux Everywhere" (RULE) Project (www.rule-project.org), lead by Marco Fioretti, works to get Red Hat Linux run on machines with small resources.
If you are looking for a window manager with another extra feature or two, visit www.xwinman.org, a wonderful site for window manager maniacs.
To generate smaller executables with gcc(1), try using "-O[level]" and "-fomit-frame-pointer" options. "-g" option should be avoided unless you are going to debug the program.
"-fomit-frame-pointer" option may not be appropriate for programs which use dynamic shared loading. In such cases, try:
strip -s -R.note -R.comment [ executable_file ] strip -g -R.note -R.comment [ library_file.{so,a} ]
Please note that libraries stripped with "-R.note -R.comment" options may not function properly in some cases.
Though many programs seem to be small in size, they often are linked to huge libraries. To see which libraries a program is linked with, use ldd(1).
If you author web pages, please pay attention to size of their constituting files. To lessen network traffic jam, you should be responsible for making them as small as possible.
Redundant use of spaces and ineffective use of tags in HTML files should be avoided. Source of this page may be a hint. Also, Dave Raggett wrote HTML Tidy, which corrects HTML-related errors and formats HTML files very nicely. It is freely available at tidy.sourceforge.net.
If you use graphics, ask yourself if you really need them. Yes, "a picture tells a thousand words," but I think it is not always true for the web. Some pages are written using many images, in order to provide links and other decorations. But are they really necessary? A kilobyte of text sometimes tells a lot more than a 16 KB JPEG image.
To reduce load for browsers, it is recommended to use HTML properly according to the specifications. See World Wide Web Consortium's HTML Home Page at www.w3.org/MarkUp/. My personal preference is XHTML 1.0 Strict.
Hardware interrupts are what CPU and OS must take care of. The interrupts sometimes become performance bottlenecks, too. By reducing the use of hardware like mouse, keyboard and disks, the number of interrupts can be reduced.
Some software provides keyboard shortcuts for mouse operations. Learn how to use them, since mouse generates much more interrupts then keyboard for most cases.
It is also effective to reduce keyboard typing. For example, many Unix shells provide "alias" feature, which helps shortening long command sentences. Tcsh(1) also has "complete" built-in command, which enhances command line completion very much. If you prefer vi over emacs, don't hesitate to use "bindkey -v". It offers more precise cursor control.
My notebook computer, whose name is skuld, runs Linux and NetBSD as her operating systems. I configured the Linux kernel with necessary options only, so it reports, "Memory: 30732k/32768k available (500k kernel code, 384k reserved, 1152k data)" upon boot. I compiled some options like "sound" and "isofs" as modules, and use modprobe(1) to load and unload them as necessary, in order to save memory by not running kerneld(8)/kmod(8).
I have stopped using cron daemon, since its only task was to run updatedb(1) every morning, and I rarely use locate(1). Now I run updatedb by hand once in a while.
She is stand-alone, so she probably has forgotten about inetd(8) and other network daemons long time ago. The kernel is advanced power management (APM) enabled, and I disabled update(8) in startup rc. When much disk IO is necessary, I either run sync(8) as often as necessary or invoke update by hand. Since her hard disk is set to go to sleep after two minutes of idle time, these strategies save her battery in significant amount.
She has 32 MB of RAM, and for the most of the time, more than 10 MB are used as cache, and 10 MB or so as buffer. Here is a snapshot at a moment, extracted from /proc/meminfo:
total: used: free: shared: buffers: cached: Mem: 31469568 31047680 421888 4993024 8138752 16519168
This significant use of buffer and cache contributes to the lesser hard disk active time. In addition, when the hard disk becomes active upon a read operation, I try to load all the files, which I expect to use in next 20 minutes or so, into the buffer. So I rarely wake up the disk while it is sleeping. A simple way to do this is "cat [files] > /dev/null".
By the way, skuld has 166 MHz MMX Pentium, 1024x768 LCD, 4 MB of video RAM, and 6 GB of disk space, and exhibits 333.41 BogoMIPS. And yes, I am happy and comfortable in working with her. She is now seven years old.
Aki Helin told me:
Although the CPU uses quite a lot of energy, at least from my experience with laptops it seems that the parts actually using the most electricity are the display, floppy drive, CD-ROM [drive] and hard disk. CD-ROM drives use in general more power than HDD's, so if some data is often needed from a CD, copy it to a HD or take an image and mount it from the HD (using loopback). Display power consumption can be cut down surprisingly much by setting lower contrast and brightness, and using less bright themes in window managers.
...I managed to cut down my laptop's power consumption by more than 30% by putting everything often needed, such as /bin, /lib and $HOME to a ramdisk, so that the HD can fall asleep. This of course requires that you save the actual contents once in a while to the HD, and have enough RAM.
By the way, I have used black for background color for years. For X Window System, "xsetroot -solid black" changes the background to black.
Following people gave me some of the information in this document:
I am looking for more information on light, small, and/or efficient software, which can be good replacement for heavier software. I would also like to hear how you save computer resources. If you have such information, please drop me a line to the address below.
Copyright (C) 2000-2006 Hidetoshi Ohtomo <hok@lab.rim.or.jp>. All rights reserved.