Booting a PC seems as simple as eating a cake. But are you aware of all that goes on behind-the-scenes to bake a delicious cake or seamlessly boot a PC?
Emma, an aspiring young baker, decided to bake a cake. She cracked open a few eggs into a bowl and whisked them until they were light and frothy. She then sifted the flour, ensuring there were no lumps. Into this mixture, she carefully measured and added baking powder, sugar, a pinch of salt, and a dash of vanilla essence. For a twist, she decided to add cocoa powder. Emma mixed all the ingredients, blending them to form a smooth, velvety batter. She then prepared her baking pan, generously greasing it with butter and dusting it with flour, ensuring the cake would not stick. She poured the batter into the pan, smoothing the top with a spatula. Emma carefully placed the pan inside the oven and set the timer. Finally, the timer dinged, and Emma pulled out the perfectly baked cake. It was a masterpiece. Her friends devoured the delicious masterpiece in mere seconds, enjoying every bite without knowing the effort and passion that went into its creation.
This scenario is quite like the process of booting a PC, where Emma takes on the role of a diligent system admin and her friends represent the average PC user.
To the average user, pressing the computer’s power button seems like a simple action that magically brings the machine to life, granting access to its many features, just as they enjoyed the cake without pondering over the baking process. However, behind this seemingly effortless task lies a series of intricate steps, much like the cake’s journey from batter to dessert. As a seasoned system admin, Emma understands the complexity of what happens when the power button is pressed. Here’s a glimpse into this behind-the-scenes process.
Power button pressed
The moment the power button is pressed, it sends an electrical signal to the CPU. The CPU starts with no initial instructions to follow. It then signals the ROM (read-only memory), where a crucial piece of software called the BIOS (basic input/output system) or its modern counterpart, UEFI (unified extensible firmware interface), resides. This firmware is responsible for initiating the boot sequence.
POST sequence
Just like mixing the ingredients of the cake, the system checks its components during POST. This is the first step in the computer booting process. The BIOS/UEFI begins the POST (power-on self-test), an essential diagnostic process that checks the computer’s hardware components, such as the RAM, keyboard, and storage devices. In case of failure to initiate the hardware, each component responds with a specific beep code, allowing Emma to diagnose any potential issues. If everything is okay, it proceeds to the next step.
Emma always investigates issues by navigating into the BIOS portal in her system. This can be viewed on pressing system-specific keys such as the most common F7 key multiple times while the computer is booting, as shown in the window in Figure 2.
This window shows the priority for bootloader code known as ‘boot device’ priority. Here, Ubuntu is the first priority, which means on booting successfully the kernel of Ubuntu will be loaded by the bootloader directly. Emma can change the priority from her BIOS settings as and when she needs to change operating systems.
Bootloader initialisation
Similar to preheating the oven, the bootloader prepares the system for the OS. Once the POST sequence is successfully completed, the BIOS/UEFI firmware proceeds to load the master boot record (MBR), which contains information in the form of bytes located at the very beginning sector of a storage device such as HDD or SSD, into the RAM. The MBR contains the very first instruction called the bootloader and initialises the bootloader code to start things up. The bootloader’s primary task is to locate the kernel and hand over control, setting the stage for the operating system to take over.
Loading the operating system
Finally, the cake rises, symbolising the kernel’s central role in managing hardware resources and providing essential services. The bootloader activates the kernel from the storage devices into the RAM. The kernel is an interface between the applications in an operating system and the hardware interfaces such as the CPU, memory and devices, as shown in Figure 5.
The kernel handles all operating system processes such as memory management, task scheduling, I/O and overall system control. This sets up interrupt handlings and allows driver modules to be fully loaded from memory. This in turn loads up the operating system disk image from storage by mounting it and loading the drivers, much like how the cake is ready to be enjoyed after all the steps of mixing, baking, and decorating. The OS further decorates the system, allowing applications (like sprinkles) to run smoothly.
Emma’s friends might never fully grasp the complexity of what goes on when they press that power button, just as they may never understand the intricacies of baking a cake. But Emma takes pride in her role, ensuring everything runs smoothly behind the scenes, whether she’s baking a cake or managing a computer system. Both processes require precision, patience, and a touch of magic that only she knows how to wield.