Firmware/Bios
When starting a computer your bios will run after POSTing (basically a check that happens before the bios to make sure hardware is running). This is what is called firmware. Essentially it’s code that is written directly onto the hardware that lets it start up. From there it then passes on to the bootloader:
-
PC BIOS Settings - YouTube ⇐ Explains some basic settings
-
BIOS, CMOS, UEFI - What’s the difference? - YouTube (useful to know about CMOS if you need to troubleshoot hardware)
Bootloader
This then is what starts the kernel. Most importantly this is the system that when the bios talks to it can actually provide the memory location of where to start the kernel. This is important because it allows you to setup multiboot systems where more than 1 OS, and even OS’s with different kernels can be loaded:
-
GRUB: GNU GRUB - Wikipedia, GNU GRUB - GNU Project - Free Software Foundation (FSF)
-
Windows 10 boot manager Windows 10 Boot Manager - YouTube
Kernel
The kernel is what allows your operating system to talk to hardware. Generally speaking this is high-level interfaces, while all the complicated portions of the communication are handled by the drivers:
-
What is a Kernel and what does it do? Explore the Kernels of Linux, Windows, and MacOS. - YouTube
-
Write Your Own 64-bit Operating System Kernel #1 - Boot code and multiboot header - YouTube
Drivers
This is where the magic happens. Typically drivers are talked about as seperate from the kernel because they are installed seperately, though they are typically kernal “modules”. Some drivers are part of userspace, but people often think of it as blurring the lines between kernel and userspace, not to mention some implementations actually skip the kernel entirely and just access drivers directly.
Generally speaking each device is going to be different, and therefore will need a different driver. Some will just work with generic drivers, but it’s usually best to run a device with it’s specific driver.
The flow of data
To start a system it looks like:
Hardware ⇒ Talks to Firmware/bios ⇒ talks to bootloader ⇒ talks to kernel
⇒ Starts operating system
once started the flow looks more like:
Hardware ⇒ Kernel ⇒ Userspace (what you see and all the processes you see running including windows managers, desktop environments, user management, etc.)
So for example if you have a frame from a video game first the hardware would generate the frame, it would then send it via the graphics driver to the display server, which would then render it through the Desktop environment/window manager