Skip to main content

System startup and shutdown

System Startup:

1. Bootloader:

The boot process begins with the BIOS (Basic Input/Output System) or UEFI (Unified Extensible Firmware Interface) firmware, depending on your system. These firmware interfaces initiate the bootloader, which is responsible for loading the operating system into memory.

Common bootloaders include GRUB (Grand Unified Bootloader) for Linux systems and NTLDR (New Technology Loader) for Windows systems.

2. Kernel Initialization:

Once the bootloader loads the operating system's kernel into memory, the kernel takes control. It initializes essential hardware components, sets up memory management, and establishes the system's initial state.

3. Init or Systemd (Linux):

On Linux systems, after the kernel initializes, either the traditional init process or systemd (a more modern init system) is started. These init systems initialize system services and user-space processes based on configuration files like /etc/inittab or service unit files.

4. Runlevel or Target:

In Linux, the system can be in a specific runlevel (SysVinit) or target state (systemd) that determines which services and processes are started. Runlevels/targets define the system's operational mode, such as single-user mode, multi-user mode, or graphical mode.

5. Service Initialization:

System services and daemons are started, including networking, disk management, user authentication, and more. These services ensure the system is fully operational for user interaction.

6. User Login:

Once the system reaches an appropriate runlevel or target, it presents the user with a login prompt, allowing users to log in and start their sessions.

System Shutdown:

1. User Initiated Shutdown:

System shutdown can be initiated by users through commands like shutdown, poweroff, halt, or through graphical user interfaces. Users may provide a delay before shutdown or specify a specific time.

2. Initiate System Shutdown:

The shutdown command communicates with the init or systemd process to initiate the shutdown sequence.

3. Terminate User Sessions:

The system sends signals to running processes, notifying them of the impending shutdown. Users are logged out, and background processes are gracefully terminated.

4. Stop System Services:

System services and daemons are shut down in an orderly manner. They save their state and perform necessary cleanup tasks.

5. Unmount Filesystems:

Filesystems are unmounted to ensure data integrity. Special attention is given to the root filesystem to prevent data corruption.

6. Halt or Reboot:

The system is halted or rebooted based on the user's command. In the case of a reboot, the system goes back to the bootloader stage and starts the boot process again.

7. BIOS/UEFI:

If it's a complete shutdown, the BIOS or UEFI firmware may take control, or in the case of a restart, it hands over control to the bootloader to initiate the boot process.