Friday, October 20, 2006

A word about computing

This is not something that we usually tell Liberal Arts majors. And I know that at least a few Liberal Arts majors have read this blog in the past, and so I'm taking the risk of letting out one of our most closely guarded secrets. But here goes, anyway: computers are not very complicated. Sometimes people make computers complicated with fancy technical mumbo jumbo, which I will mark with italics in this post.

Most of the computers we use today (certainly all of the ones that we think about primarily as "computers") are based on the Von Neumann architecture. There is a processor and there is memory. The processor fetches instructions from memory and follows them. Typically the instructions are simple things like, "Load a number stored at memory location X", "Load another number stored at memory location Y", "Add those two numbers", "Store the result in memory location Z".

Through some nasty conspiracy billions of these simple instructions were used to create horrors of complexity like the rich text-entry widgets used by websites like Blogger and Gmail, but that's beside the point.

Of course, there are two problems with the Von Neumann architecture: input and output. First, output: how do we show off the results of the instructions we've executed? That's my job (I work for Nvidia, writing drivers for graphics hardware) and I'm not going to tell you how to do my job. Next, input: how do we get all these instructions and data into memory in the first place? This is called "bootstrapping".

Originally people had to write their instructions into memory manually every time they wanted them followed. If I had to do that every time I wanted my computer to post on this blog you can imagine I wouldn't do it very often. Early computing pioneers really liked my blog, however, so they invented all this crazy stuff like hard drives, BIOSes, operating systems and web browsers just to make it easier for me to post here. Later computing pioneers invented those crappy rich-text widgets. The BIOS is a magical entity that, among other magical things, magically grabs some instructions from the hard drive when you turn on your computer and puts them into memory so the processor can follow them.

See, this is where it starts to get complicated. The instructions that the BIOS grabs? They're a "program" (set of instructions) called the "bootloader". Well, part of the bootloader at least. They're the part of the bootloader that tell the processor how to find some more bootloader instructions on the hard disk, put them in memory and follow them. In many systems, once found, these instructions will again tell the processor to find even more bootloader instructions, load them into memory and follow them. After some arbitrary number of "bootloader" stages (on a tri-booting GNU/Linux+WinVista+WinNT system you might have an MBR, a few GRUB stages, then chainload to WinVista's BOOTMGR, which goes and finds NTLDR which finally loads Windows NT, which is a pretty disappointing destination after all that) you eventually have the operating system loaded in memory, its instructions being followed by the processor. The main point of the operating system is... you guessed it: to find other programs on the hard disk and load their instructions into memory so the processor can follow them. Engineers might make things really complicated, but at least we aren't very imaginative.

What I'm writing to complain about, at long last, is a bootloader. GRUB is a rather nice bootloader that's typically used on GNU/Linux systems (though it can be used for some others). One reason it has the multiple stages I mentioned in the last paragraph is because at some stages it can be customized. You can show a menu of choices of operating systems to boot to (or other bootloaders to chainload). There's a file that you use to customize GRUB, it's called "grub.conf". It's a nice text file. You can open and change it with a text editor (a text editor is a set of instructions that tells a computer how to edit a text file according to the wishes of its user; people like me spend a lot of time using text editors, and often our favorite text editor is our favorite program), and you can post yours on the Internet to give other people ideas for theirs. Windows Vista's BOOTMGR, on the other hand, uses a configuration file called BCD. It's a binary file; all computer files are technically binary files and are encoded in various ways; text files are a subset of these particularly encoded to represent a sequence of text characters in a standard way. When I say, "binary files," I mean files falling outside of this subset. Anyhow, BCD is a binary file and can only sensibly be edited using Windows Vista's very own BCDEDIT.EXE. BCDEDIT.EXE is a set of instructions for editing the BCD according to the wishes of its user and also to a set of inscrutable constraints devised by its authors.

And that was pretty much just background knowledge. All I really want to say is (apologies to Douglas Adams):

The Sirius Cybernetics Corporation... err... I mean, THE PEOPLE THAT WROTE BCDEDIT.EXE are a bunch of mindless jerks that will be first against the wall when the revolution comes.


Danielle said...

Bootstrapping... sounds sorta kinky...

Al Dimond said...

Actually, to me, bootstrapping has always had a Little-House-on-the-Prairie feel to it.

Well, I guess that final fading pearl of innocence is at last torn away from the otherwise sordid tapestry of my life.