<![CDATA[LetsTechTalk]]>https://sumanthvadde.liveRSS for NodeThu, 06 May 2021 11:31:19 GMT60<![CDATA[Computer Science Fundamentals- How system boot works?]]>Let's get started with computer science fundamentals. We would be discussing system boot.

A cliche definition picked straight out of google would be something like this

Booting is a startup sequence that starts the operating system of a computer when it is turned on. A boot sequence is the initial set of operations that the computer performs when it is switched on.

This startup sequence associated with a system is totally abstract. The chaos that is happening behind the scenes is incredibly captivating and when you understand the design behind this process, you would be even more satisfied.

Let's hit the ground running and understand what happens behind the scenes.

  • It first starts executing a program called the BIOS (Basic Input Output System). The BIOS resides in a non-volatile memory on the motherboard. To put it in a simple words it loads the BIOS from the Read Only Memory(ROM).

  • The BIOS is responsible for setting up the hardware and accesses the boot sector of the boot disk. The boot sector contains a program called the boot loader, whose job is to load the rest of the operating system.

The ROM is highly secure since the data and instructions written here cannot be edited/changed from an external source and hence BIOS is stored on the ROM.

  • With rising complexity of modern hardware and kernels, the boot loader is responsible for loading a bigger boot loader (GRUB in UNIX systems) from the hard disk. This bigger boot loader is responsible for locating and locating kernel executable. It also makes sure that instructions start to execute on the CPU.

  • The first instruction which is executed is called POST (Power-on Self-test) and it takes place when the system is powered on. It is a test instruction and also performs certain checks.

  • First check would be to confirm if there is sufficient battery to initialize the system boot or not. And if the first check succeeds then second check would be performed. The second check basically confirms the proper functioning of the secondary/peripheral devices.

After successful completion of these tests, BIOS seeks to load the operating system.

  • The Master Boot Record (MBR) is a small program that starts when the computer is booting, in order to find the operating system. The BIOS searches for the MBR on the Hard Drive, which is generally located in the first sector.

  • The BIOS is then responsible for making copies of essential files into memory. From this step onward, Operating System controls the rest of the bootup process. It goes through the system memory to find the appropriate device drivers to load so as to allow user to control peripheral devices.

  • When the OS boots up, it creates the first process called the init process. This init process then forks off many child processes, which in turn fork other processes, and so on. In some sense, the init process is the ancestor of all processes running on the computer. These forked off child processes run several executable to do useful work on the system.

That's it. I hope you understand system boot now. It is a highly essential computer science fundamental and usually asked in interviews. Make sure you cover it well.

Stay tuned for upcoming articles on computer science fundamentals!

Feel free to contact @ Linkedin : https://www.linkedin.com/in/sum0nthvadde/ Email : sumanth368@gmail.com

https://sumanthvadde.live/computer-science-fundamentals-how-system-boot-workshttps://sumanthvadde.live/computer-science-fundamentals-how-system-boot-worksTue, 01 Sep 2020 03:43:02 GMT