Booting is a startup sequence that starts the operating system of a computer when it is turned on. A boot sequence is the initial set of operations that the computer performs when it is switched on. Every computer has a boot sequence. The average computer doesn’t understand the boot sequence but is important to know for customizing and troubleshooting your computer.
Computers powered by the central processing unit can only execute code found in the systems memory. Modern operating systems and application program code and data are stored on nonvolatile memories or mass storage devices. When a computer is first powered on, it must initially rely only on the code and data stored in nonvolatile portions of the systems memory. At boot time, the operating system is not really loaded and the computer’s hardware cannot peform many complex systems actions.
The program that starts the “chain reaction” which ends with the entire operating system being loaded is known as the boot loader (or bootstrap loader). The term creatively came from early designiners imagining that before a computer “runs” it must have it’s “boots strapped”. The boot loader’s only job is to load other software for the operating system to start. Often, multiple-stage boot loaders are used, in which several small programs of increasing complexity sequentially summon one after the other, until the last of them loads the operating system.
The boot device is the device from which the operating system is loaded. A modern PC BIOS (Basic Input/Output System) supports booting from various devices. These include the local hard disk drive, optical drive, floppy drive, a network interface card, and a USB device. Typically, the BIOS will allow the user to configure a boot order. If the boot order is set to:
then the BIOS will try to boot from the CD drive first, and if that fails then it will try to boot from the hard disk drive, and if that fails then it will try to boot from the network, and if that fails then it won’t boot at all.
There is a standard boot sequence that all personal computers use. First, the CPU runs an instruction in memory for the BIOS. That instruction contains a jump instruction that transfers to the BIOS start-up program. This program runs a power-on self test (POST) to check that devices the computer will rely on are functioning properly. Then, the BIOS goes through the configured boot sequence until it finds a device that is bootable. Once BIOS has found a bootable device, BIOS loads the bootsector and transfers execution to the boot sector. If the boot device is a hard drive, it will be a master boot record (MBR). The MBR code checks the partition table for an active partition. If one is found, the MBR code loads that partition’s boot sector and executes it. The boot sector is often operating system specific, however in most operating systems its main function is to load and execute the operating system kernel, which continues startup. If there is no active partition or the active parition’s boot sector is invalid, the MBR may load a secondary boot loader which will select a partition and load its boot boot secotr, which usually loads the corresponding operating system kernel.