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;inithas PID equal to 1 initstarts 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:
initasks every process to shut down- If some processes (or a process) don’t respond,
initinitiates a kill with aTERMsignal - If some processes (or a process) don’t respond still,
initinitiates a kill with aKILLsignal - 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
demsgcommand is used to display kernel messages, or you can look at/var/log/kern.loginitis the process which starts all system servicesshutdowncommand is used to shut down or restart your system
Talk soon!
Leave a Reply