What Exactly Happens When You Turn On Your Computer?
When
you power on a computer, it goes through a “boot up” process– a term that comes
from the word “bootstrap.” Here’s what’s happening in the
background—whether you’re using a Windows PC, Mac, or Linux system.
The Hardware Powers On
When you press the power
button, the computer supplies power to its components—the motherboard, CPU,
hard disks, solid state drives, graphics processors, and everything else in the
computer.
The
piece of hardware that supplies power is known as the “power supply.” Inside a
typical desktop PC, it looks like a box at the corner of the case (the yellow
thing in the picture above), and it’s where you connect the AC power cord.
The CPU Loads the UEFI or BIOS
Now that it has
electricity, the CPU initializes itself and looks for a small program that is
typically stored in a chip on the motherboard.
In
the past, the PC loaded something called a BIOS (Basic Input/OutputSystem.) On modern PCs, the CPU loads UEFI (UnifiedExtensible Firmware Interface) firmware instead. This is a
modern replacement for the old-style BIOS. But, to make it extra confusing,
some PC manufacturers still call their UEFI software “BIOS” anyway.
The UEFI or BIOS Tests and
Initializes Hardware
The BIOS or UEFI
firmware loads configuration settings from a special place on the
motherboard—traditionally, this was in memory backed up by a CMOS battery.
If you change some low-level settings in your BIOS or UEFI settings screen,
this is where your custom settings are stored.
The
CPU runs the UEFI or BIOS, which tests and initializes your system’s
hardware—including the CPU itself. For example, if your computer doesn’t have
any RAM, it will beep and show you an error, stopping the boot process. This is
known as the POST (Power On Self Test) process.
You
may see the PC manufacturer’s logo appear on your screen during this process,
and you can often press a button to access your BIOS or UEFI settings screen
from here. However, many modern PCs fly through this process so fast that they
don’t bother displaying a logo and require accessing their UEFI setting screen
from the Windows BootOptions menu.
UEFI
can do a lot more than just initialize hardware; it’s really a tiny
operating system. For example, Intel CPUs have the Intel Management Engine.
This provides a variety of features, including powering Intel’s Active
Management Technology, which allows for remote management of business PCs.
The UEFI or BIOS Hands Off to a Boot Device
After it’s done testing
and initializing your hardware, the UEFI or BIOS will hand off responsibility
for booting your PC to your operating system’s boot loader.
The
UEFI or BIOS looks for a “boot device”
to boot your operating system from. This is usually your computer’s hard disk
or solid-state drive, but may also be a CD, DVD, USB drive, or network
location. The boot device is configurable from within the UEFI or BIOS setup
screen. If you have multiple boot devices, the UEFI or BIOS attempts to hand
off the startup process to them in the order they’re listed. So, for example,
if you have a bootable DVD in your optical drive, the system might try starting
from that before it tries starting from your hard drive.
Traditionally,
a BIOS looked at the MBR (master bootrecord), a special boot sector at the beginning of a disk. The MBR
contains code that loads the rest of the operating system, known as a
“bootloader.” The BIOS executes the bootloader, which takes it from there and
begins booting the actual operating system—Windows or Linux, for example.
Computers
with UEFI can still use this old-style MBR boot method to boot an operating
system, but they normally use something called an EFI executable instead. These
don’t have to be stored at the beginning of a disk. Instead, they’re stored on
something called an “EFI system partition.”
Either
way, the principle is the same—the BIOS or UEFI examines a storage device on
your system to look for a small program, either in the MBR or on an EFI system
partition, and runs it. If there’s no bootable boot device, the bootup process
fails, and you’ll see an error message saying so on your display.
On
modern PCs, the UEFI firmware is generally configured for “Secure Boot.”
This ensures the operating system that it starts hasn’t been tampered with and
won’t load low-level malware. If Secure Boot is enabled, the UEFI checks
whether the bootloader is properly signed before starting it.
The Bootloader Loads the Full OS
The bootloader is a
small program that has the large task of booting the rest of the operating
system. Windows uses a bootloader named Windows Boot Manager (Bootmgr.exe),
most Linux systems use GRUB, and
Macs use something called boot.efi.
If
there’s a problem with the bootloader—for example, if its files are corrupted
on disk—you’ll see a bootloader errormessage, and the boot process will stop.
The
bootloader is just one small program, and it doesn’t handle the boot process on
its own. On Windows, the Windows Boot Manager finds and starts the Windows OS Loader.
The OS loader loads essential hardware drivers that are required to run the
kernel—the core part of the Windows operating system—and then launches the
kernel. The kernel then loads the system Registry into
memory and also loads any additional hardware drivers that are marked with
“BOOT_START,” which means they should be loaded at boot. The Windows kernel
then launches the session manager process (Smss.exe), which starts the system
session and loads additional drivers. This process continues, and Windows loads
background services as well as the welcome screen, which lets you sign in.
On
Linux, the GRUB boot loader loads the Linux kernel. The kernel also starts the
init system—that’s systemd on
most modern Linux distributions. The init system handles starting services and
other user processes that lead all the way to a login prompt.
This
involved process is just a way of making everything load correctly by doing
things in the correct order.
By
the way, so-called “startup programs”
actually load when you sign into your user account, not when the system boots.
But some background services (on
Windows) or daemons (on
Linux and macOS) are started in the background when your system boots.
The
shutdown process is pretty involved, too. Here’s exactly what happenswhen you shut down or sign out of a Windows PC.
Comments
Post a Comment