Understanding How A Computer Works -- Part 2: The Boot Process
Posted by Wade Burchette at 12:00 PM General
Computers are not yet instant on machines. A computer must boot up. The is the process by which your computer goes from off to usable. The process really has changed little since the first computer mostly because the process is good enough. The whole purpose of the boot system is to get your computer ready for the operating system. This is the second article in the series on how computers work. The other articles are:
- Part 1: The CPU
- Part 2: The Boot Process (this blog entry)
- Part 3: Early Apple Computers and MS-DOS
- Part 4: Windows 1 to Windows 3.11
- Part 5: Windows 95 Based Operating Systems
- Part 6: Windows NT Based Operating Systems
- Part 7: Windows Vista Based Operating Systems
- Part 8: Unix and Linux Operating Systems
- Part 9: MacIntosh
The BIOS
BIOS standards for Basic Input-Output System. This is the first code run by the computer when you turn on the computer. The first thing it does is perform some basic tests of your hardware. It does not do exhaustive testing, so even if the hardware check passes, that does not mean your hardware is fine. The BIOS also initializes and identifies certain hardware. Floppy disks and older hard drives require the BIOS to work. Certain functions of the CPU and motherboard must also be enabled in the BIOS.
The BIOS is very simple compared to an operating system. But they are much more complex than when it first came out. The modern BIOS can do much more than the older BIOS. Some of the BIOS's out there set the speed at which your memory and CPU run. Although the BIOS can set the speed, that does not mean the CPU or memory can run at that speed so some caution is required when doing so. When an user sets the speed of their CPU or memory faster than what it is rated for, that is called overclocking. This is most often done to increase performance. When an user sets the speed of their CPU or memory slower than what it is rated for, that is called underclocking. This is most often done to reduce energy usage which can be significant with a computer. Although some programs can do this inside of the operating system, more often than not overclocking or underclocking is done in the BIOS.
Even though the BIOS system is old, it is good enough. The replacement to the BIOS, called EFI and described below, offers no real world advantage over the BIOS. Therefore, motherboard companies do not replace the BIOS. They know how to create a BIOS better than the know how to create an EFI. Plus, the BIOS has no licensing costs.
The settings of the BIOS are stored in the CMOS. CMOS stands for Complementary Metal–Oxide Semiconductor. In reality, the name is a misnomer. Older BIOS's used CMOS chips for the BIOS memory, but this is no longer true today. CMOS chips were used for BIOS memory because they are low-power, meaning a small battery could be used to store them. Today other types of chips are used, but they are still low-power. Motherboards have a small battery that keeps power going to the so-called CMOS chip so that you do not need to set the BIOS settings again after the computer has had a power failure.
After the BIOS performs the hardware checks and hardware iniatilization, the BIOS looks for something to take over. It looks for a device with a boot sector on it in the order specified in the BIOS. The boot sector is a small program that makes the transition between BIOS and operating system. Boot sectors are specific to an operating system. In MS-DOS, Windows 1, Windows 2, Windows 3, Windows 95, Windows 98, and Windows ME, the boot sector looks for the IO.SYS file. In Windows NT, Windows 2000, Windows XP, and Windows Server 2003, the boot sector looks for the file NTLDR. In Windows Vista, Windows 7, and Windows Sever 2008, the file WINLOAD.EXE is used. Other operating systems use different files but each has the same function. When these files are loaded, the first thing it does is take control of the computer away from the BIOS. Some allow you the user to specify which operating system to load, which may be hidden by default. After that, the boot files, such as IO.SYS or NTLDR, start to load the core operating system files as needed for the appropriate operating system.
For example, consider Windows NT based operating systems startup process. This is the way Windows NT, Windows 2000, Windows XP, and Windows Server 2003 boot up. Once an operating system is selected, NTLDR loads a file called NTDETECT.COM. This file does some basic hardware detection and returns the information to NTLDR. NTDETECT.COM is not needed on computers with EFI. On older computers, you know this file is running when you see the white bar at the bottom of the screen. Once NTDETECT.COM is finished, NTLDR then calls the NTOSKRNL.EXE file (on some computers, NTOSKRNLA.EXE is called). The is the basic operating system kernel, the core of the operating system. Next HAL.DLL is loaded. This is the Hardware Abstraction Layer, or HAL for short. The HAL is what makes a computer so versitle. Thanks to the HAL, software can use many different types of hardware. The HAL handles all communication between the software and the hardware. After HAL.DLL is loaded, NTLDR then loads KDCOM.DLL and then BOOTVID.DLL. When BOOTVID.DLL is loaded, you then see the Windows logo. Then NTLDR loads driver that NTDETECT.COM said where needed. When those driver files are loaded, then NTLDR loads SMSS.EXE. SMSS.EXE then takes over and starts to finish up the bare minimum boot process. Some of those files is the WIN32K.SYS file, which begins the graphical portion of Windows, and CSRSS.EXE, which allows you the user to interact with the operating system. Finally, SMSS.EXE loads WINLOGON.EXE. This file handles every aspect of logging in and out of Windows. After WINLOGON.EXE allows a user to login, it starts several Windows and user startup programs.
![[Image of Windows XP Boot Process]](/images/xp_boot_process.png)
As you can see, the complete boot process is not easy even in this simplified version of the Windows NT based boot process. Until the computer fully boots up, that is to say when all the mandatory and optional files are loaded into memory, the computer may be a little slow. In some rare cases, even on newer computers, if you do not wait until the operating system fully finishing booting, the operating system may freeze. You must remember that operating systems are very complex and as such cannot be 100% error free.
The EFI
EFI in an ancronym for Extensible Firmware Interface. EFI addresses the limitations of the BIOS because EFI is much more complex and thus much more flexible. EFI was originally designed by Intel for their Itanium line of CPU's. Itanium was a massive failure, but EFI still remains thanks to the Unified EFI Forum (UEFI Forum).
Tt is rare to see EFI for PC's. Even Intel prefers to use BIOS on their motherboards. However, EFI is standard on all Apple Macintoshes. Since Windows XP is incompatible with EFI, Apple released a software called Boot Camp which enabled a user to dual-boot Mac OSX and Windows XP. If deseried, EFI can support a BIOS mode whereby operating systems that need a BIOS are fooled into thinking the EFI is a BIOS.
EFI is very much like an operating system. Because of that, EFI supports a graphical user interface, but more often than not it does not have a graphical interface.
Since EFI offers few real-world advantages over the BIOS, the blog entry will not go into great detail about the EFI. Indeed, the extra complexitity with little benefit is why EFI has not taken off. While the EFI boot process is different than that of the BIOS, the concept is very similar.