After powering up and running any diagnostics required or requested, the computer's startup code will find a small program called the boot loader. After loading the boot loader to a known place in memory, the startup code will transfer control to it.
The boot loader will then perform a number of simple functions in preparation for loading the actual operating system. Most boot loaders will initialize the CPU to a known state, identify some hardware (not all devices are identified), then locate, load, and execute the kernel.
The boot loader is sometimes designed to be an integral part of the operating system (e.g. Microsoft Windows NTTM and later). In other designs, the boot loader is a separate program, often written by different authors (e.g. GNU GRUB).
Boot loaders can sometimes be chained, with the first boot loader loading and passing control to a second boot loader. This is how GNU GRUB and LILO load the Microsoft WindowsTM boot loader "ntldr" on the x86 PC.