Here is the video version, if you prefer it:
Let’s review what we learned.
Here is how your computer boots up:
- A boot loader is ran by machine’s BIOS or boot firmware
- The boot loader finds the kernel image on disk, loads it into memory, and starts it
- The kernel initializes the hardware devices and its drivers
- The kernel mounts the root filesystem
- The kernel starts a program called
init
;init
has PID equal to 1 init
starts all of the other necessary system processes- At some point at or near the end of this entire process, you get the option to log in to your system
Here is how the user space starts up:
init
- Essential low-level services which enable managing hardware devices and system logging
- Network configuration
- Mid and high-level services (such as
cron
(used for scheduling tasks) and printing) - Login prompts, GUIs, and other high-level applications
When shutting down your computer, the following goes on:
init
asks every process to shut down- If some processes (or a process) don’t respond,
init
initiates a kill with aTERM
signal - If some processes (or a process) don’t respond still,
init
initiates a kill with aKILL
signal - The system makes preparations for a shutdown
- The system unmounts all of the other filesystems other than root
- The system remounts the root filesystem in read-only mode (meaning you can’t write, only read)
- The system writes out all of the data left over in the buffers to the filesystem (this happens during the remounting process)
- The kernel reboots or stops the system
Other things to mention:
- Boot loaders job is to load the kernel into memory and start it with a set of parameters
demsg
command is used to display kernel messages, or you can look at/var/log/kern.log
init
is the process which starts all system servicesshutdown
command is used to shut down or restart your system
Talk soon!
NewsletterUpdates on interesting things I am doing
Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.