Summarized by Dodly:

How Your Computer Boots: The Unseen Magic

Fireship

Audio Summary

Video Summary

Summary

Ever wonder what's happening inside your computer from the moment you press the power button until your desktop appears? It's a complex ballet of software, beginning with the bootloader, like Grub or Bootmagger, which finds and loads the operating system's kernel into RAM. The CPU then operates in different 'privilege rings,' with ring zero for the kernel having full control and ring three for user applications needing permission for most actions. A key innovation is virtual memory, where the Memory Management Unit (MMU) translates fake addresses used by programs into real physical addresses, managed by page tables. This ensures applications can't interfere with each other's memory. The file system organizes raw disk blocks into understandable files and directories using structures like index nodes. Device drivers, specialized code for each piece of hardware, are loaded, allowing the kernel to communicate with components like your graphics card or keyboard. Crucially, interrupts, electrical signals from hardware, alert the CPU to events like a key press or mouse movement. The kernel then creates the first user process, PID1, which is the ancestor of all other programs. When an application needs to perform an action, it makes a 'system call,' transitioning from user space to kernel space to request services like reading a file. To manage multiple processes on limited CPU cores, a scheduler assigns time slices. Threads allow a single program to perform multiple tasks concurrently by sharing memory. Finally, when you shut down, PID1 politely signals other processes to terminate, saving their state and quitting.

Play the full video