What Happens When a Computer is Turned On?


Difficulty: Beginner
Reading Time: 5 min read
Last Updated: June 30, 2025
What Happens When a Computer is Turned On?
When a computer is powered on, it undergoes the boot process, a sequence of steps that initializes hardware, performs diagnostics, and loads the OS into memory, transforming an inert machine into a functional system ready for user interaction.
1. Power-On
Pressing the power button activates the power supply, which sends electricity to components like the motherboard, CPU, hard drive, and fans.
2. BIOS/UEFI Initialization
The BIOS (Basic Input/Output System) or UEFI (Unified Extensible Firmware Interface), stored in non-volatile memory (e.g., ROM), starts executing.
It performs the Power-On Self-Test (POST), a diagnostic check of critical hardware (e.g., CPU, CMOS RAM, video card, storage devices).
POST ensures hardware functionality and initializes devices, creating tables (e.g., ACPI tables) to describe the system’s configuration.
If errors are detected, POST displays error messages or emits beep codes (specific patterns indicating issues).
BIOS Functions and Features
Power-On Self-Test (POST): Diagnoses hardware, initializes devices, and reports errors via messages or beep codes.
Master Boot Record (MBR): Contains the bootstrap loader to kickstart the OS loading process.
System Configuration:
Boot Order: Specifies the sequence of devices (e.g., hard drive, USB, CD/DVD) checked for bootable media.
Time and Date: Maintains system clock settings used by the OS.
Hardware Settings: Allows advanced users to adjust CPU voltage, clock speed, or memory timings for performance optimization.
Security:
Password Protection: Restricts BIOS access or booting to prevent unauthorized use.
Secure Boot: Ensures only trusted boot loaders, drivers, and firmware are loaded, blocking malware.
Trusted Platform Module (TPM): Provides hardware-based security (e.g., encryption, secure key storage) on supported motherboards.
3. Boot Loader Execution
The BIOS searches for the Master Boot Record (MBR), a special boot sector typically located at the start of the primary boot disk (cylinder 0, head 0, sector 1).
The MBR contains the bootstrap loader, which loads the boot loader (e.g., GRUB or LILO in Linux) into memory.
The boot loader’s role is to locate and start the OS.
4. Operating System Loading
The boot loader loads the OS kernel from the storage device (e.g., hard drive, SSD) into RAM.
The OS initializes its components, including drivers and system services.
🔍 Understanding init
, Runlevels, and Daemons in the Linux Boot Process
Once the Linux kernel is loaded into memory and completes its initialization, it needs a process to take over and start the user-space environment. This is where the init
process (or its modern alternatives like systemd
or upstart
) comes into play.
4.1 What Is init
?
init
stands for initialization process.It is the first user-space process executed by the Linux kernel after booting.
It has PID 1 (Process ID 1), meaning it's the ancestor of all other processes.
Its role is to set up the rest of the operating system, including launching background services and preparing the system for user interaction.
How init
Uses /etc/inittab
Traditionally, init
reads the configuration file /etc/inittab
to determine:
What runlevel should the system start in
What processes or services should be launched based on that runlevel
📁 Example from /etc/inittab: id:5:initdefault:
This line sets the default runlevel to 5 (multi-user with graphical interface).
4.2 Modern Alternatives to init
While classic Linux systems used init
with inittab
, most modern distributions now use:
Replacement | Description |
systemd | Used in most modern distros (Ubuntu, Fedora, Arch). Faster, parallel service startup, uses targets instead of runlevels. |
upstart | Legacy alternative used in older Ubuntu versions. Event-driven. |
OpenRC | Lightweight alternative used by Gentoo and Alpine Linux. |
For example, systemd
replaces runlevels with targets (e.g., graphical.target
, multi-user.target
).
4.3 Linux Runlevels (SysV Init System)
A runlevel defines a preset group of services and system states that the OS should be in after booting. Here's a breakdown of common runlevels:
Runlevel | Description |
0 | Halt (shutdown) |
1 | Single-user mode (recovery/maintenance) |
2 | Multi-user mode (no networking) |
3 | Multi-user mode with networking (CLI only) |
4 | Undefined / user-definable |
5 | Multi-user with networking + GUI (X Window) |
6 | Reboot |
💡 On most desktop Linux distros, runlevel 5 starts the graphical interface (display manager and desktop environment).
4.4 Daemons and the X Server
After determining the runlevel, init
(or a replacement like systemd
) launches a series of background processes called daemons.
What are daemons?
Daemons are long-running background services.
Examples: networking (
networkd
), time syncing (ntpd
), printing (cupsd
), display (Xorg
orWayland
).
The X Server
The X server (e.g.,
Xorg
) is the software component that manages the graphical display:- Controls the screen resolution, input devices (mouse, keyboard), and rendering of windows.
It works in coordination with display managers (like GDM, LightDM, SDDM) to present the login screen (greeter).
Once the user logs in, the desktop environment (e.g., GNOME, KDE) starts.
5. How the OS and Boot Process Work Together
The boot process and the operating system are intricately linked:
Boot Process: The BIOS/UEFI and boot loader handle the initial hardware initialization and OS loading, ensuring the system is ready to run the OS.
Operating System: Once loaded, the OS takes control, managing hardware resources, running applications, and providing a user interface. The kernel, as the OS’s core, continues the work started by the BIOS, coordinating hardware interactions and ensuring system stability.
For example:
During boot, the BIOS checks the hard drive’s MBR to load the boot loader, which then loads the OS (e.g., Windows or Linux) into RAM.
The OS’s
init
or equivalent process starts system services (e.g., networking, display management), leveraging the hardware initialized by the BIOS.The OS’s resource management ensures efficient use of CPU, memory, and I/O devices, while its security features (e.g., Kerberos, Secure Boot) build on BIOS security to protect the system.
6. Conclusion
The boot process is the hidden orchestration that transforms inert hardware into a fully functional operating system environment. From powering on the machine to loading the OS kernel, each step—from BIOS/UEFI initialization, POST, and MBR/bootloader, to the launch of init/systemd and daemons—plays a crucial role in system startup.
Understanding these foundational steps demystifies how your system comes alive, enhances your ability to troubleshoot boot issues, and strengthens your knowledge of operating system internals. Whether you're optimizing performance, hardening security, or simply learning how Linux works under the hood, mastering the boot process is an essential milestone in your software engineering journey.
7. Key Takeaways
BIOS/UEFI kicks off the process
Initializes hardware, runs diagnostics (POST), and locates a bootable device.
MBR and Boot Loader are next
MBR loads the bootloader (e.g., GRUB), which loads the OS kernel into memory.
The kernel starts user space via
init
init
(or systemd/upstart/OpenRC) is the first process in user space (PID 1) and configures the system state using runlevels or targets.Daemons and X Server launch essential services
Background services (e.g., networking, display managers) start, and the graphical interface becomes available via the X server or Wayland.
Runlevels define startup modes
Runlevels (0–6) represent system states (halt, single-user, multi-user, GUI, etc.), and are now largely replaced by
systemd
targets.Boot security and configuration are managed in BIOS/UEFI
Features like Secure Boot, TPM, and boot passwords enforce early-stage system security.
Modern systems prefer
systemd
for speed and modularityOffers parallel service startup, dependency management, and replaces classic SysV init in most distributions.
8. References and Further Reading
About the Author
Abdul-Hai Mohamed | Software Engineering Geek’s.
Writes in-depth articles about Software Engineering and architecture.
Subscribe to my newsletter
Read articles from Abdulhai Mohamed Samy directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
