Lecture 6
Lecture 6
w.r.t OS what happen when we turn on the computer till bootloader loads the full OS?
Ans :
When you turn on a computer, the sequence of events leading up to the bootloader loading the full
operating system (OS) is crucial for initializing hardware and preparing the system to start the OS.
Here's a detailed breakdown of these steps:
• Power Supply: Pressing the power button activates the power supply unit (PSU), which
delivers power to the motherboard and other components.
• CPU Activation: The Central Processing Unit (CPU) receives power and starts executing
instructions from a fixed location, typically the system's firmware (BIOS or UEFI).
2. BIOS/UEFI Initialization:
• BIOS/UEFI Firmware Execution: The CPU begins executing the BIOS (Basic Input/Output
System) or UEFI (Unified Extensible Firmware Interface) firmware. This firmware is stored in
non-volatile memory on the motherboard.
• POST (Power-On Self Test): The BIOS/UEFI performs a series of checks to ensure that
essential hardware components like the CPU, RAM, and keyboard are functioning correctly.
This step also includes checking for the presence and integrity of the storage devices and
peripherals.
• Boot Device Selection: After POST, the BIOS/UEFI determines which device to boot from.
This is based on a pre-configured boot order list stored in the BIOS/UEFI settings. The boot
device could be a hard drive, SSD, USB drive, CD/DVD, or network device.
• MBR/GPT Examination: The BIOS/UEFI accesses the Master Boot Record (MBR) or the GUID
Partition Table (GPT) on the selected boot device. These are special regions of the storage
device that contain information about the partitions on the disk and the location of the
bootloader.
4. Bootloader Execution:
• Loading the Bootloader: The BIOS/UEFI loads the bootloader program into memory from
the storage device. The bootloader is a small, essential program that is responsible for
loading the full operating system.
o In systems using MBR, the bootloader is located in the first 512 bytes of the disk,
known as the boot sector.
o In systems using GPT, the bootloader is found in the EFI System Partition (ESP), a
dedicated partition on the disk.
• Switch to Protected Mode (in modern systems): The CPU, which starts in real mode (a
simplistic mode for backward compatibility), is switched to protected mode or long mode by
the bootloader. This allows the CPU to use more advanced features and access larger
memory spaces, essential for modern OS operations.
• Kernel Location and Loading: The bootloader locates the OS kernel on the disk. The kernel is
the core component of the operating system that manages resources and hardware
interaction.
• Kernel Initialization: The bootloader loads the kernel into memory. Once loaded, the kernel
takes over control from the bootloader, beginning the process of fully initializing the OS,
including setting up memory management, process scheduling, and hardware abstraction.
6. Transition to OS Control:
• Starting Initial Processes: The bootloader may pass control directly to the kernel or through
an intermediary process (like an initial RAM disk, initrd, or initramfs, which contains drivers
needed for the OS to access the disk and other hardware).
• Bootloader Hand-off: Finally, the bootloader hands over full control to the operating
system's kernel, marking the end of the bootloader's role in the boot process.
At this point, the operating system takes over completely, and the bootloader's job is done. The
system proceeds with further OS-specific initialization, leading to the user interface or command line
being ready for interaction.