What is the Booting Process - BunksAllowed

BunksAllowed is an effort to facilitate Self Learning process through the provision of quality tutorials.

Random Posts

We know that multiple Operating Systems (OSs) can be installed on a Computer. Hence, after switching on, the user has to choose one of the several OSs to be loaded. A system having multiple OSs is known as a multi-booting system.

Once, a Linux system is installed, there are several methods for configuring the boot process. The most common methods are shown below:
  • Booting from a bootable disk: Generally from a CD/DVD or Flash drive.
  • Boot using Linux Loader (LILO): This is the traditional method to boot Linux and any other operating system like Windows.
  • Unified Bootloader(GRUB): It's a GNU graphical boot loader.
  • Boot using GRand and a command shell: It's also used to boot Linux and other operating systems. Nowadays GRUB is the most used boot loader.

On an x86-based PC, the first sector of every hard disk is known as the boot sector. The partition table and boot information of the installed operating systems are stored in the boot sector. 

If multiple hard disks are installed, the boot sector of the first hard disk is known as the Master Boot Record (MBR)

When a system is booted, the BIOS (basic input/output system) transfers the control to a program that is kept in that sector along with the partition table. 

Basically, the code is the boot loader and it initiates an operating system.

In a Linux system, each disk and partition is treated as a device. Let us consider a system consisting of two disks, both of these disks will be enlisted under the directory /dev . The first disk will be /dev/hda and the second disk will be /dev/hdb. Similarly, the first and second partitions of the first hard disk will be /dev/hda1 and /dev/hda2 respectively. 

The naming of the devices varies with the type of disks. Moreover, GRUB has its own naming convention. 


System Boot Process


Let's discuss what happens when a computer is switched on.

First, the BIOS checks the Hardware and proceeds to read the boot information on bootable media as discussed above. 

Both the LILO and GRUB are two-stage boot loaders that are generally installed on the hard disk (sometimes it is loaded in some other media like USB device, CD/DVD ROM) and is responsible to call the Master Boot Record (MBR). 

Once the boot information is found in bootable media, the first part of the boot loader is loaded into RAM. 

At this time, the list of available operating systems is shown to the users to choose the operating system to use. If the user does not respond in the stipulated time, the default operating system is booted by the boot loader

If we assume that the LILO boot loader is installed in a system, it shows Linux loading on the screen, then it copies the installed kernel image and set-up code into RAM. After completion of the copy, it executes the set-up code. 

In this process, The BIOS is in action until the OS is initialized. After initialization, it is no longer required. Here OS will initialize the hardware. 


What the kernel does when it starts up?


Here we will discuss the operations performed by the kernel step by step:
  • First, the kernel will be un-compressed and required memory is allocated for the kernel.
  • Then kernel initializes drivers by detecting respective hardware.
  • Then the root file system is mounted by the kernel.
  • And finally, the kernel executes /sbin/init

Now the kernel is ready to serve asynchronous requests from the processes through a system call and events triggered by hardware.

Happy Exploring!

No comments:

Post a Comment