How computer boot
In this blog, we’ll explore the boot process of a computer, from the moment you press the power button to when the operating system is fully loaded.
Over the past 25-30 years, there haven’t been significant changes in how computers boot. Surprisingly, even today, computers still use the same foundational processes and programs to load the operating system (OS).
Step-by-Step Breakdown of the Boot Process
Step 1: Powering On
When you press the power button on your computer, an electrical signal (pulse) is sent to a specific pin on the Central Processing Unit (CPU) called the "reset pin." This signal tells the CPU to begin the boot process.
Step 2: CPU Initialization
Once the CPU receives the reset signal, it initializes. All of its internal registers are set to zero, except for two crucial registers:
- Code Segment (CS): This register is set to the value
0xF000
. - Instruction Pointer (IP): This register is set to
0xFFF0
.
This combination points to the first memory location 0xFFFF0
, which contains the starting instruction that directs the CPU to the Basic Input/Output System (BIOS).
Step 3: Entering the BIOS
The CPU then jumps to the BIOS, which stands for Basic Input/Output System. BIOS is a small program stored in a chip on the motherboard, typically in read-only memory (Flash/EPROM/EEPROM). The term BIOS was coined by Gary Kildall and was first introduced in the CP/M operating system in 1975.
What Does the BIOS Do?
- Power-On Self-Test (POST): BIOS first performs a self-test to check if essential components like the monitor, keyboard, and mouse are connected and working properly.
- Initialize Video Card: The video card is initialized so that the display can function properly.
- Display BIOS Screen: Once the video card is ready, the BIOS screen (commonly showing the manufacturer’s logo) is displayed.
- Memory Test: BIOS conducts a brief memory test to check if the RAM is functioning correctly.
- Set DRAM Parameters: It configures the DRAM memory parameters.
- Configure Plug-and-Play Devices: Plug-and-play devices are detected and configured.
- Assign System Resources: BIOS allocates system resources like DMA channels and IRQs to devices.
- Identify the Boot Device: It identifies the device from which the OS will be booted (e.g., a hard drive, SSD, or USB).
Step 4: Loading the Boot Loader
The BIOS reads the first sector (sector 0) from the boot device (typically a hard drive or SSD) into memory location 0x7C00
. Sector 0 contains the Master Boot Record (MBR), which holds essential information about the system’s partitions and the location of the operating system.
Memory Location 0x7C00
:
This is a specific location in the low memory region of RAM where the BIOS loads the first 512-byte sector from the boot device. This sector contains the code necessary to load the OS.
Master Boot Record (MBR)
The Master Boot Record (MBR) is a special section at the beginning of the boot device (like a hard drive). It contains vital information required to load the OS and manage system partitions. The concept of the MBR was introduced in 1983 with IBM's PC DOS 2.0.
The MBR contains:
- Master Boot Loader (446 Bytes): The code that helps load the operating system.
- Partition Table (64 Bytes): Information about how the storage is divided (e.g., C: and D: drives).
- Signature (2 Bytes): A unique identifier to confirm the integrity of the MBR.
At this stage, if the computer has multiple operating systems installed, the MBR allows the user to select which OS to boot.
Conclusion
The computer’s boot process starts with a simple electrical signal that triggers a series of events, from initializing the CPU to loading the operating system. While modern computers are faster and more powerful, the boot process has remained fundamentally unchanged for decades, with the BIOS and MBR playing crucial roles in getting the system up and running.
By understanding these steps, you gain a deeper appreciation of how complex yet elegant the boot process is, bringing your machine to life every time you press that power button.
No comments:
Post a Comment