Your computer uses a series of intermediate programs to move from simple data processing to specific tasks that allow you to edit words or music, send and receive messages, create graphic images, and save the planet from invading space aliens. You can think about each of these programs as an individual layer in a stack of digital pancakes. Each layer exchanges instructions with the ones above and below it in this logical stack. Figure 5.6 shows the logical layers that control your PC.
Figure 5.6: Each layer in this logical stack interacts with the layers above and below it.
At the bottom of the stack is the hardware, or physical layer, which includes the central processor, the keyboard, mouse, video display monitor, and all the other I/O devices that perform some kind of physical work. These devices depend on the layers above them in the stack for instructions about how to do whatever they do.
Above the physical layer is the Basic Input/Output System, or the BIOS. The BIOS is a small block of code that tests and controls devices in the hardware layer, including a series of instructions that runs every time you turn on the computer. The BIOS tests the hardware and sets a number of configuration settings.
Next come several intermediate programs that prepare the computer to use the operating system. In Windows, there's a boot loader that tells the processor to expect 32 data bits at a time, a boot program that locates the operating system files, and a detect file that identifies and configures the I/O devices.
Above that, there's the operating system, such as Windows, which is the software that decides how the computer uses the central processor, memory, and other hardware resources to support and respond to application programs and utilities.
Finally, the application programs and utilities are at the top of the stack. The applications are your word processor, Web browser, MP3 player, and all the other programs that you use to perform actual work. Utilities are programs (many of which run in the background while you're using an application program) that control the way the computer works with peripheral devices, such as the appearance of information on the screen and the sounds that occur when certain events happen. Other utilities are maintenance programs that can make the computer run more efficiently (such as a disk defragmenter) or more safely (such as an antivirus program).
To find out more about disk defragmenters and antivirus programs, see Chapters 48 and 49.
At the lowest level, the computer is a set of hardware devices, each of which performs some kind of action. The keyboard converts keystrokes to a set of specific electrical signals; the printer receives electrical impulses and places ink (or some other material) onto paper; and the disk drive writes and reads digital data to and from a magnetic disk. Even the central processor is just a collection of very fast and very complicated electrical circuits. Everything else that the computer does is ultimately reflected in some form at the physical level.
Before computers, many devices operated exclusively at the physical layer. For example, a piano has a direct mechanical linkage from each key to a felt-covered hammer that strikes a set of tuned wires to produce a sound at a specific frequency (a musical note). This is a relatively simple process, and there's a limited amount you can do with it. You can't press that same key to sound a note that's an octave higher-you have to press a different key.
At some very basic level, all of the components in your computer are like that piano-they do something in response to an impulse. But instead of your finger pressing a piano key, the impulse is usually some kind of electrical signal, or a combination of more than one signal. And most peripheral devices have an internal circuit that interprets that signal and converts it to a physical action.
For example, your computer's ink-jet printer has a nozzle that deposits ink on paper in the shape of each letter in the text you want to print. The internal circuitry in the printer receives each letter from the computer and instructs the ink nozzle exactly when to deposit ink on paper in order to create that letter. The same thing happens in your video monitor, which assembles each letter from tiny dots called picture elements or pixels.
All of the devices that make up the computer's physical layer do something similar. Each of them either converts an instruction from the computer to a mechanical or electrical action, or converts an instruction from outside the computer (in the form of a physical or electrical impulse) to a signal that the central processor can understand.
The BIOS (basic input/output system) is the bridge between the physical-layer hardware and the higher-level software. It's a set of relatively simple instructions that control the devices at the physical layer before the higher-level programs kick in. Among other essential actions, the BIOS provides the instructions that the processor needs in order to read code from the disk drive that contains the operating system software. The BIOS code is stored on a read-only memory integrated circuit mounted on the computer's motherboard.
The code in the BIOS performs several functions:
Power-On Self Test (POST): The POST tests the most important components in the physical layer, including the processor, the memory, links to the graphics controller, the disk drive, the keyboard, and other inputs and outputs. If the POST detects a problem, or if it can't find some important piece of hardware at all, it displays an error message on the video display, unless the problem interferes with the display itself. If the POST can't display an error message, it triggers a series of coded beeps to identify the problem.
The Setup Utility: The Setup Utility sets the computer's hardware to a condition where it's ready to perform useful work. If a component has more than one possible setting, the Setup Utility allows a user to select or change essential configuration options. One of these settings specifies the order in which the BIOS searches various storage devices (hard drives, a CD, floppy disk, USB flash drives, or some other medium) for the operating system software.
The System BIOS: The System BIOS contains the instructions and settings that the processor uses to identify and control essential peripheral devices, and assigns priorities to each type of control. It also controls some low-level utilities, such as a temperature monitor. The processor uses some of these settings and controls as long as the computer is turned on, but it uses other settings only until the operating system takes control of them. Among others, the BIOS sets up initial controls for the clock, the keyboard, the serial and parallel data inputs and outputs, the video interface, and the disk drives. It also issues instructions that start the separate BIOS chips built into some peripheral devices, such as the graphics controller and some network interfaces.
The Boot Loader: Finally, the BIOS sends an instruction to the next layer in the computer's operating structure to find and start a program that prepares the system to load the operating system.
Most motherboard manufacturers obtain their BIOS code (and the integrated circuits that hold that code) from specialist companies that work closely with Intel and AMD to produce core BIOS software for each type of processor. The motherboard makers add their own custom code to match the generic BIOS to the hardware on each of their motherboard models. The most widely used BIOSes come from American Megatrends (AMI) and Phoenix Technologies.
Some older computers might still have BIOS code produced by Award Software, which merged with Phoenix several years ago.
When a new version of the operating system or a new type of hardware comes to the marketplace, or if the motherboard manufacturer discovers a bug in the BIOS code, it is often necessary to install a new version of the BIOS software that recognizes those devices and programs. On most modern personal computers, the BIOS is stored on a form of memory called an EEPROM (electrically erasable programmable read-only memory) or flash memory that allows a user to install an update to the code by entering a special series of commands.
Chapter 8 contains more detailed information about how the BIOS works, how to open and use the BIOS Settings Utility, and how to update the BIOS code to support new and improved hardware and software.
After the BIOS completes all of its testing and configuration activities, it starts a program called the boot loader that prepares the system to load the operating system. The boot loader for Windows XP loads some additional startup programs, it instructs the CPU to handle 32 data bits at a time, and it identifies the type of file system that the hard drive uses to organize and store data. When this is complete, the boot loader reads a file that lists the names and locations of the operating system files, and runs yet another program that takes over control of I/O devices from the BIOS. Finally, it loads the kernel of the operating system-the part that manages memory, input and output devices, and other system resources, and starts application programs-into memory.
In Windows XP, the operating system kernel is in a file called ntoskrnl.exe. When the boot loader successfully loads the kernel (along with a second file that contains some important hardware configuration information), it reads code from a database called the Windows Registry to finish the process of starting Windows.