Archive for February 2008

One thing that makes Linux stand out is that if you have the knowledge, you rarely have to reboot your computer just because you made some changes. Usually, you can get by with restarting the particular service or module that was affected. You do have to reboot when you want to change the kernel, however. Because the kernel sits at the core of everything, the whole system has to be reloaded.

There is a way around it; well, sort of. When you reboot, you’re completely stopping the system, then letting the firmware/BIOS and bootloader start the kernel again. But you don’t have to drop down to the firmware or bootloader if all you want to do is replace the kernel. In fact, the Linux kernel is capable of unloading itself and handing control over to a different (or the same) kernel, resulting in a much faster reboot. What makes the process tricky is that the new kernel needs to be loaded in memory exactly where the current kernel sits, but the current kernel needs to be running in order to load the new kernel. We don’t have to worry about this because the crafty Linux kernel engineers have figured out a way.

Enter kexec; or, restarting the kernel without rebooting the computer. There’s a wonderful article over at IBM developerWorks that explains how it works. I’d been wanting to give this a try, but the article makes the process seem quite hairy. That was almost four years ago. I just tried kexec on my Ubuntu 8.04 laptop, and it worked almost flawlessly.

To use kexec, you must first install the kexec-tools package available in the universe repository. After that’s installed, the following two commands restart the kernel (it’s also possible to start a different kernel):

$ sudo kexec -l --append="`cat /proc/cmdline`" --initrd=/boot/initrd.img-`uname -r` /boot/vmlinuz-`uname -r`
$ sudo kexec -e

Almost flawlessly? Well… after the system was restarted, I somehow lost control of the keyboard and the touchpad. The machine was responsive on the network, though. This may be because kexec doesn’t clean up; it just reloads the kernel. It should work much better once it’s integrated with the standard reboot/shutdown processes. For now, kexec seems to be coming along very well.

(This is most likely not true, because I was just dreaming. lol.)

So the astronomers and physicists out there tell us of a mysterious class of matter that they call dark matter that makes the universe expand faster and faster. The reason it’s called dark matter is that while we don’t know what it is and can’t explain how it got there, we can feel its effects. Even more mysteriously, the older the universe gets, the more dark matter there is. Matter doesn’t come out of nowhere, so where does dark matter come from?

Let’s imagine, for a moment, that we’re among a super-advanced civilization of a super-advanced species in the far, far future. We already have all the technological gadgets that people from the past could only dream about; we’ve got things like plasma phasers, teleporters, hyperdrive, and time machines.

Well, as you can imagine, the more advanced a civilization gets, the more waste products it produces. At some point, it becomes impossible to process these wastes, and they start accumulating. Well, this scientist at a waste-processing plant soon comes up with an ingenious idea: the people who lived in the past did not have as much waste to deal with, so we should let them handle some of our waste; in fact, the more primitive the civilization is, the less trash it produces, so we should use a time machine to send our trash way back, preferably right to the beginning of the universe. Scientists had entertained this idea from time to time in the past ever since the first time machine was invented, but nobody had been daring enough to risk destroying their past. However, the situation with the waste accumulation has grown to such a degree that it is necessary to offload some of our responsibilities to our past.

Such a smart scientist, eh? Let’s thank him/her for our endless supply of dark matter.