Back to series
· 15 min read

How a Computer Boots: From Power Button to Operating System


I. What Happens to the Computer After Pressing the Power Button?

When we press a computer’s power button, the screen may briefly go black, then the manufacturer logo and system boot animation appear, and finally the Windows, Linux, or macOS desktop loads.

It looks like a simple process, but behind it is the coordinated work of many parts: the CPU, motherboard, memory, firmware, storage devices, and operating system.

Booting a computer is not simply a matter of turning on the power and then directly running the operating system; it is a process of gradually establishing a runtime environment.

Before booting:

  • The CPU has not yet started executing the operating system kernel.
  • Memory has not yet been initialized.
  • The operating system files on the storage device have not yet been loaded.
  • Various hardware devices have not yet been initialized.
  • The operating system’s processes, drivers, and services have not yet started.

Therefore, the computer first needs to solve one problem:

When the operating system is not yet running, who is responsible for starting the operating system?

The answer is firmware.

Firmware is usually stored in non-volatile memory on the motherboard, such as SPI Flash. After the computer is powered on, the CPU begins executing firmware code from a predefined boot entry point. The firmware is responsible for initializing hardware, locating a boot device, and handing control over to the bootloader.

The entire boot process can be summarized as:

flowchart TD
    A["Press the power button"] --> B["Power supply and stabilization"]
    B --> C["CPU begins executing firmware"]
    C --> D["Hardware initialization and self-test"]
    D --> E["Select boot device"]
    E --> F["Load bootloader"]
    F --> G["Load operating system kernel"]
    G --> H["Kernel initialization"]
    H --> I["Start system services"]
    I --> J["Enter login screen or desktop"]

    style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style B fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style C fill:#E9E4FA,stroke:#B7A5E0,color:#493B70
    style D fill:#FFF2D8,stroke:#E8C98A,color:#76551F
    style E fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style F fill:#E9E4FA,stroke:#B7A5E0,color:#493B70
    style G fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style H fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style I fill:#F1EAF8,stroke:#C7B2DF,color:#59446E
    style J fill:#E0F0FE,stroke:#93BCE8,color:#1E4976

The following breaks down the computer boot process step by step, starting from pressing the power button.

II. Stage One: How Does the Computer Get Power After Pressing the Power Button?

The first step in starting a computer is not executing code, but establishing a stable power supply.

1. The Power Button Does Not Directly Power All Hardware

Taking a desktop computer as an example, the power supply unit (PSU) converts alternating current (AC) into the direct current (DC) required by computer hardware.

Common output voltages include:

Voltage Main Use
+12V CPU power conversion, graphics cards, fans, and other devices
+5V Some motherboard circuits, storage devices, and USB-related circuits
+3.3V Motherboard logic circuits, some storage devices, and interfaces

The power supply does not simply send all voltages to all devices at once.

Modern ATX power supplies usually have a standby power mechanism.

Even when the computer is powered off, as long as the power supply remains connected to AC power and is switched on, the motherboard may receive a standby power rail, such as +5VSB.

It can support:

  • Power button detection.
  • Motherboard power management logic.
  • Some USB wake functions.
  • Wake-on-LAN and other standby features.

So even though the computer appears to be off, some circuits on the motherboard may still be in standby.

2. What Happens After Pressing the Power Button?

After the power button is pressed, the power management logic on the motherboard detects the startup request.

The motherboard then uses a power control signal to request that the power supply turn on its main output voltages.

A typical ATX power supply startup process involves two important signals:

Signal Function
PS_ON# The motherboard requests that the power supply turn on the main power output; active low
PWR_OK The power supply notifies the motherboard that the main output voltages are stable

This can be understood as:

  • PS_ON#: The motherboard says, “Please start supplying power.”
  • PWR_OK: The power supply says, “The voltage is stable; you can continue booting.”

3. The CPU Can Start Working Normally Only After the Voltage Is Stable

The CPU, memory, and other critical hardware require a stable supply voltage.

The VRM (Voltage Regulator Module) on the motherboard converts the voltage supplied by the power supply into the voltages required by components such as the processor and memory.

For example, the CPU core usually requires an operating voltage much lower than 12V.

Only after the power supply is stable will the platform’s reset control logic release the relevant hardware from the reset state as designed.

Only after the CPU exits reset can it begin executing instructions from the predefined boot address.

flowchart TD
    A["Press the power button"] --> B["Motherboard detects power-on request"]
    B --> C["Motherboard pulls PS_ON# low"]
    C --> D["Power supply turns on main outputs"]
    D --> E["Motherboard VRM converts operating voltage"]
    E --> F["Power supply output reaches steady state"]
    F --> G["Power supply sends PWR_OK"]
    G --> H["Platform releases related reset states"]
    H --> I["CPU begins executing boot code"]

    style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style B fill:#E9E4FA,stroke:#B7A5E0,color:#493B70
    style C fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style D fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style E fill:#FFF2D8,stroke:#E8C98A,color:#76551F
    style F fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style G fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style H fill:#E9E4FA,stroke:#B7A5E0,color:#493B70
    style I fill:#E0F0FE,stroke:#93BCE8,color:#1E4976

Note: This is a conceptual model of a typical ATX platform. Power management, timing control, and reset mechanisms may differ across motherboards, laptops, and server platforms.

3. Stage Two: After the CPU Is Powered On, Where Does the First Instruction Come From?

This is the most critical point for understanding computer startup.

We already know that the operating system has not yet been loaded, and memory has not yet been initialized.

So where does the CPU get the first instruction?

The answer is: the CPU has an architecture-defined reset entry point.

1. After Reset, the CPU Does Not Execute Code from an Arbitrary Address

After the reset state is released, the CPU enters its initial execution state according to behavior defined by the processor architecture.

Taking x86 processors as an example, the first instruction after processor reset is located at a special reset entry point.

On modern x86 platforms, this entry is usually mapped to a high-address region of the system address space, and the corresponding code is provided by the platform chipset and firmware mapping mechanisms.

It does not simply begin execution from memory address 0.

Other architectures also have their own reset entry points and startup mechanisms.

For example:

  • ARM processors have architecture-defined reset entry points or startup mechanisms related to exception vectors.
  • RISC-V platforms enter initial code through a reset address and a platform-defined startup flow.

2. Why Can Firmware Run Before the Operating System?

Because firmware is stored in non-volatile memory.

A common motherboard firmware storage device is SPI Flash.

It has the following characteristics:

  • It can retain data after power loss.
  • It can store firmware code and configuration data.
  • It can provide boot code to the processor during the power-on stage.
  • It is usually connected to the processor-accessible address space through the motherboard platform's address mapping logic.

Therefore, even if DRAM has not yet been initialized, the CPU can still execute firmware code.

Two concepts need to be distinguished here:

Firmware storage media and runtime memory are not the same thing.

Type Purpose Retained After Power Loss
SPI Flash Stores BIOS/UEFI firmware Yes
DRAM Stores runtime program data and code No
SSD Stores the operating system, applications, and user files Yes
CPU Cache Caches instructions and data Usually no

Firmware code can be read from Flash, but during execution it may still need to use CPU internal registers, caches, or temporary memory areas.

3. The Role of Firmware Startup Code

Firmware can be understood as the first layer of software connecting hardware and the operating system.

It is responsible for completing the work that must be prepared before the operating system can run.

For example:

  • Establish the initial execution environment.
  • Initialize the memory controller.
  • Detect and initialize major hardware devices.
  • Configure the platform operating state.
  • Discover bootable devices.
  • Select the boot entry point.
  • Load the next-stage bootloader.

Firmware can be thought of as the computer's startup manager.

4. Stage Three: BIOS and UEFI—What Is Computer Firmware?

Many people see the motherboard logo at startup or enter the BIOS setup interface.

Two important concepts are involved here:

  • BIOS: Basic Input/Output System.
  • UEFI: Unified Extensible Firmware Interface.

Both are related to computer startup firmware, but they are not exactly the same thing.

1. Traditional BIOS

Traditional BIOS is the firmware system used by early PCs.

It is mainly responsible for:

  • Initializing basic hardware.
  • Performing the power-on self-test.
  • Providing some basic hardware services.
  • Finding boot devices.
  • Handing control over to the boot code.

Traditional BIOS usually uses a relatively simple boot method.

In a typical traditional hard disk boot process:

  1. BIOS selects a disk according to the boot order.
  2. Reads the first sector of the disk.
  3. Loads the boot code in that sector into memory.
  4. Transfers execution control to the boot code.
  5. The boot code continues loading subsequent boot programs.

Legacy BIOS boot is usually associated with the MBR partitioning scheme.

2. What is UEFI?

UEFI is a firmware interface specification widely adopted by modern PCs.

It provides a more modern boot environment than legacy BIOS.

Its main features include:

  • Supports GPT partition tables.
  • Supports the EFI System Partition (ESP).
  • Can directly load EFI executable files.
  • Provides standardized firmware services and boot variables.
  • Supports Secure Boot.
  • Supports more flexible boot management.

UEFI firmware usually contains multiple execution phases, such as SEC, PEI, DXE, and BDS.

Different platforms may differ in specific implementation, phase organization, and module division.

3. Main Differences Between BIOS and UEFI

Comparison dimension Legacy BIOS UEFI
Firmware architecture Legacy PC firmware interface Modern firmware interface specification
Boot method Typically loads MBR boot code Loads EFI executable files
Partition scheme Commonly MBR Commonly GPT
Boot file Disk boot sector code EFI file
Boot management Relies on the legacy boot order Supports UEFI Boot Manager
Secure Boot Native mechanisms are limited Supports Secure Boot
Extensibility Relatively limited Stronger modularity and extensibility

Note that although the firmware setup interface on modern motherboards is often still called BIOS, it may already be based on UEFI underneath.

Therefore, what people commonly call "entering the BIOS" is often actually entering the UEFI setup interface.

V. Stage Four: Hardware Initialization and POST Self-Test

After the firmware begins executing, it needs to check and initialize the computer hardware.

This stage usually involves POST (Power-On Self-Test) as well as broader platform initialization work.

1. What is POST?

POST is a hardware check process performed when the computer boots.

Its goal is to confirm whether key hardware has the basic conditions for operation.

Common check items include:

  • Whether the CPU can execute normally.
  • Whether memory can complete basic detection.
  • Whether the display device can be initialized.
  • Whether storage devices can be detected.
  • Whether key controllers on the motherboard can work.

If initialization of key hardware fails, the computer may be unable to continue booting.

2. Why is memory initialization particularly important?

Although the CPU can execute firmware code before DRAM initialization, the operating system and most complex programs require memory.

DRAM cannot simply be powered on and used directly.

It requires an initialization process between the memory controller and the memory module.

Typical DDR memory initialization may involve:

  • Detecting memory module information.
  • Reading SPD configuration.
  • Selecting appropriate operating parameters.
  • Configuring the memory controller.
  • Performing memory training (Memory Training).
  • Setting timings, voltages, and related parameters.

Among these, SPD (Serial Presence Detect) usually stores the specifications and capability information of the memory module.

Memory Training helps the memory controller determine appropriate signal sampling and timing parameters.

For example, when DDR memory is running, the following need to be considered:

  • Clock frequency.
  • CAS Latency.
  • RAS-to-CAS Delay.
  • RAS Precharge.
  • Command and address signal timing.
  • Data read/write training results.

These parameters need to match the actual conditions of the motherboard traces, the processor's memory controller, and the memory module.

3. What happens if memory initialization fails?

If memory cannot complete initialization, the CPU cannot establish a normal system operating environment.

In this case, the following may occur:

  • The computer fails to power on.
  • The monitor has no signal.
  • The motherboard DRAM indicator stays lit.
  • The motherboard emits beep error codes.
  • The computer repeatedly restarts.

This is also why, after replacing memory, adjusting memory frequency, or updating the BIOS, the first boot may require a longer wait.

The motherboard may be re-running memory training.

4. How should hardware initialization failures be handled?

Different vendors may use different error indication methods.

Common diagnostic information includes:

Symptom Possible cause
CPU indicator abnormal CPU installation, power supply, compatibility, or motherboard issue
DRAM indicator abnormal Memory installation, compatibility, or training failure
VGA indicator abnormal Graphics card, display output, or related initialization failure
BOOT indicator abnormal No available boot device found
Continuous beeping Possible hardware issue such as memory or graphics card

Diagnosis should be based on the error codes in the motherboard manual; the cause of the fault cannot be inferred solely from the indicator light color.

flowchart TD
    A["Firmware begins hardware initialization"] --> B["Initialize CPU platform environment"]
    B --> C["Initialize memory controller"]
    C --> D["Detect and train DRAM"]
    D --> E{"Memory initialization successful?"}
    E -->|Yes| F["Initialize chipset and major devices"]
    E -->|No| G["Log error information"]
    G --> H["Show diagnostic indicators or beep codes"]
    H --> I["Halt normal boot or attempt recovery"]
    F --> J["Perform other hardware checks"]
    J --> K{"Critical devices available?"}
    K -->|Yes| L["Proceed to boot device selection"]
    K -->|No| M["Report hardware initialization error"]

    style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style B fill:#E9E4FA,stroke:#B7A5E0,color:#493B70
    style C fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style D fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style E fill:#FFF2D8,stroke:#E8C98A,color:#76551F
    style F fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style G fill:#FCE8E8,stroke:#DDA5A5,color:#783D3D
    style H fill:#FCE8E8,stroke:#DDA5A5,color:#783D3D
    style I fill:#F1EAF8,stroke:#C7B2DF,color:#59446E
    style J fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style K fill:#FFF2D8,stroke:#E8C98A,color:#76551F
    style L fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style M fill:#FCE8E8,stroke:#DDA5A5,color:#783D3D

VI. Stage Five: How Does the Firmware Find the Operating System?

Once hardware initialization is complete, the computer needs to find the device on which the operating system resides.

The operating system may be installed on:

  • A SATA SSD.
  • An NVMe SSD.
  • A mechanical hard drive.
  • A USB storage device.
  • A network boot server.

The firmware needs to determine where to boot from based on the boot configuration.

1. Boot Order

In the UEFI setup interface, you can usually configure the priority of boot devices.

For example:

Boot Option #1: Windows Boot Manager
Boot Option #2: NVMe SSD
Boot Option #3: USB Storage
Boot Option #4: Network Boot

If the first boot entry is unavailable, the firmware may continue trying the subsequent boot entries.

The boot order determines which boot entry the firmware looks for first.

2. How Does UEFI Find the Boot Files?

UEFI typically uses the GPT partition table to manage disk partitions.

Among them is one important partition:

EFI System Partition (ESP).

The ESP usually uses the FAT file system and is used to store UEFI boot programs and related files.

For example, a computer with Windows installed may have:

EFI System Partition
└── EFI
    └── Microsoft
        └── Boot
            ├── bootmgfw.efi
            ├── bootmgr.efi
            └── BCD

A Linux system may have:

EFI System Partition
└── EFI
    └── ubuntu
        ├── shimx64.efi
        └── grubx64.efi

Different distributions and installation configurations may vary.

3. UEFI Boot Manager

UEFI firmware usually provides a Boot Manager for managing boot entries.

Boot entries are usually stored in NVRAM.

For example:

  • Windows Boot Manager.
  • Ubuntu.
  • Fedora.
  • UEFI USB Device.

UEFI can locate the corresponding EFI file based on the configuration in the boot variables and execute it.

NVRAM here is the non-volatile storage area that holds firmware configuration variables, and should not be simply understood as ordinary DRAM.

4. The Relationship Between GPT and ESP

GPT is a disk partition table format, whereas ESP is a partition with a specific type identifier.

The two are not the same concept.

Concept Role
GPT Describes the disk partition structure
ESP Stores UEFI boot files
FAT32 The file system format commonly used for the ESP
EFI file A program that UEFI can load and execute
NVRAM boot variables Store information such as boot entries and boot order

The UEFI firmware reads the GPT, finds the ESP, and then loads the EFI file according to the boot entry.

flowchart TD
    A["Hardware initialization complete"] --> B["UEFI Boot Manager"]
    B --> C["Read boot entry configuration"]
    C --> D["Select target boot device"]
    D --> E["Read GPT partition table"]
    E --> F["Locate EFI System Partition"]
    F --> G["Access ESP file system"]
    G --> H["Find EFI boot file"]
    H --> I["Execute EFI program"]

    style A fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style B fill:#E9E4FA,stroke:#B7A5E0,color:#493B70
    style C fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style D fill:#FFF2D8,stroke:#E8C98A,color:#76551F
    style E fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style F fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style G fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style H fill:#E9E4FA,stroke:#B7A5E0,color:#493B70
    style I fill:#F1EAF8,stroke:#C7B2DF,color:#59446E

7. Stage Six: How Does the Bootloader Work?

After the firmware finds the EFI boot program, it hands over execution control to it.

This program is usually called the Bootloader.

The Bootloader's job is to load the operating system kernel into memory and get ready to hand control over to the kernel.

1. What Is a Bootloader?

The Bootloader is an important component in the operating system boot chain.

It is usually responsible for:

  • Identifying the operating system boot configuration.
  • Loading the operating system kernel.
  • Loading the necessary initial memory file system.
  • Passing boot parameters.
  • Preparing the boot information the kernel needs.
  • Handing control over to the operating system kernel.

Different operating systems may use different bootloaders.

Operating System Common Boot Components
Windows Windows Boot Manager
Linux GRUB, systemd-boot, other bootloaders
macOS Apple platform firmware boot chain and related boot components

2. GRUB on Linux

GRUB is a common bootloader on Linux systems.

It can provide a boot menu that lets the user choose:

  • Which Linux kernel to boot.
  • Whether to enter recovery mode.
  • Whether to select another system.
  • Which kernel boot parameters to use.

For example:

GNU GRUB

Ubuntu
Advanced options for Ubuntu
Memory test

After the user selects Ubuntu, GRUB loads the corresponding Linux kernel and initramfs according to its configuration.

3. What Is initramfs?

initramfs (Initial RAM Filesystem) is the initial memory file system used when Linux boots.

Why is it needed?

Because when the Linux kernel boots, it may not yet be able to directly access the real root file system.

For example:

  • The root file system is on an encrypted partition.
  • The disk uses LVM.
  • The root file system is on RAID.
  • NVMe or other storage drivers need to be loaded.
  • The root file system is on network storage.

These operations may require additional drivers and tools.

Therefore, the Bootloader can load initramfs first.

It provides a temporary initial root file system in memory to help the kernel complete the necessary early initialization.

Once the real root file system is ready, the system switches over to it.

4. The Linux Boot Process

flowchart TD
    A["UEFI 固件"] --> B["执行 GRUB EFI 程序"]
    B --> C["读取 GRUB 配置"]
    C --> D["显示启动菜单"]
    D --> E["选择 Linux 内核"]
    E --> F["加载 vmlinuz 内核"]
    F --> G["加载 initramfs"]
    G --> H["传递内核启动参数"]
    H --> I["跳转到内核入口"]

    style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style B fill:#E9E4FA,stroke:#B7A5E0,color:#493B70
    style C fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style D fill:#FFF2D8,stroke:#E8C98A,color:#76551F
    style E fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style F fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style G fill:#E9E4FA,stroke:#B7A5E0,color:#493B70
    style H fill:#FFF2D8,stroke:#E8C98A,color:#76551F
    style I fill:#DCEFE5,stroke:#8EBFA5,color:#24563F

Note that modern Linux systems may also use systemd-boot, UEFI Stub, or other boot schemes, and do not necessarily go through GRUB.

VIII. Seventh Stage: The Operating System Kernel Begins Running

After the bootloader finishes loading the kernel, the computer enters one of the most important stages of the boot process:

Operating system kernel initialization.

The kernel is the core of the operating system. It manages hardware resources and provides the basic runtime environment for processes, memory, file systems, and devices.

1. Kernel Entry

The bootloader loads the kernel image into memory and prepares the information required for booting.

The processor then jumps to the kernel entry code.

At this point, the CPU is no longer executing the ordinary firmware boot flow; it has begun executing operating system kernel code.

Taking Linux as an example, the kernel completes a series of initialization tasks after booting.

2. What Does Kernel Initialization Mainly Do?

Common tasks include:

CPU and architecture initialization

  • Establish the kernel execution environment.
  • Initialize processor-related state.
  • Set up exception and interrupt handling mechanisms.
  • Configure necessary processor features.

Memory management initialization

  • Establish physical memory management structures.
  • Initialize page tables and the virtual memory mechanism.
  • Establish the kernel memory allocator.
  • Manage memory regions and pages.

Interrupt and timer initialization

  • Initialize the interrupt controller.
  • Configure the system clock and timers.
  • Establish the interrupt handling flow.

Device and driver initialization

  • Discover hardware devices.
  • Initialize necessary device drivers.
  • Establish device management mechanisms.
  • Prepare storage, network, and input/output devices.

File system initialization

  • Register file system types.
  • Prepare to mount the root file system.
  • Establish the file access environment.

3. What Is Kernel Mode?

Modern processors usually provide different privilege levels to isolate operating system core code from ordinary applications.

Taking the common x86 architecture as an example:

  • Ring 0: the highest privilege level, where the operating system kernel usually runs.
  • Ring 3: a lower privilege level, where ordinary user programs usually run.

The kernel can perform protected privileged operations, such as managing page tables, handling interrupts, and configuring hardware resources.

Ordinary applications cannot directly perform all these operations; instead, they request services from the kernel through system calls.

This is also why, after the operating system has booted, ordinary applications cannot arbitrarily modify the memory of other processes or directly control all hardware.

4. How Does the Linux Kernel Start the First User-Space Process?

After the Linux kernel completes the necessary initialization, it needs to start the user-space environment.

In a common Linux system, the kernel ultimately starts the PID 1 process.

It is usually:

/sbin/init

In modern Linux distributions, PID 1 is often systemd.

PID 1 is an important starting point for the user-space initialization process.

It is responsible for organizing system services, mounting file systems, starting necessary components, and gradually establishing a complete runtime environment.

flowchart TD
    A["Bootloader hands over control"] --> B["Linux kernel entry point"]
    B --> C["Initialize CPU and architecture"]
    C --> D["Initialize memory management"]
    D --> E["Initialize interrupts and timers"]
    E --> F["Initialize device drivers"]
    F --> G["Prepare the root file system"]
    G --> H["Switch to the real root file system"]
    H --> I["Start PID 1"]
    I --> J["Enter user space"]

    style A fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style B fill:#E9E4FA,stroke:#B7A5E0,color:#493B70
    style C fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style D fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style E fill:#FFF2D8,stroke:#E8C98A,color:#76551F
    style F fill:#E9E4FA,stroke:#B7A5E0,color:#493B70
    style G fill:#DCEFE5,stroke:#8EBFA5,color:#24563F
    style H fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
    style I fill:#F1EAF8,stroke:#C7B2DF,color:#59446E
    style J fill:#DCEFE5,stroke:#8EBFA5,color:#24563F

IX. Stage Eight: Entering User Space, System Services Begin to Start

The completion of kernel initialization does not mean the user can already use the computer normally.

The basic programs and services in user space still need to be started.

1. What Is User Space?

An operating system usually divides its runtime environment into:

  • Kernel space (Kernel Space).
  • User space (User Space).

Kernel space is responsible for managing the system's core resources.

User space runs ordinary programs, system services, and user applications.

For example:

Type Example
Kernel Linux Kernel
Init system systemd
Login service getty, Display Manager
Network service NetworkManager, network management components
Graphics service Display server, desktop environment
User applications Browser, editor, terminal

2. How Does systemd Start System Services?

In many Linux distributions, systemd is responsible for system initialization and service management.

It starts different units according to the configuration.

Common unit types include:

  • Service: system services.
  • Target: a boot target or a set of runtime states.
  • Socket: socket activation configuration.
  • Mount: file system mount configuration.
  • Timer: scheduled tasks.
  • Device: device-related units.

For example:

systemctl status

View the current system status.

View services that are slow during boot:

systemd-analyze blame

View the startup dependency relationships between services:

systemd-analyze critical-chain

3. Linux Boot Targets (Target)

systemd uses targets to organize system boot states.

Common targets include:

Target Purpose
poweroff.target Power off
rescue.target Rescue mode
multi-user.target Multi-user text mode
graphical.target Graphical interface mode
reboot.target Reboot

For example:

systemctl get-default

View the default boot target.

Set the default to boot into the graphical interface:

sudo systemctl set-default graphical.target

Set the default to boot into text mode:

sudo systemctl set-default multi-user.target

Note that the services and boot targets actually started are affected by the distribution's configuration, service dependencies, and local machine settings.