First, let’s look at the picture below:
1. Power-on self-test
Firmware: a combination of hardware and software. Power-on self-test is when we press the power button, it will detect hardware information such as CPU, memory, network card and other information. (Detect whether the hardware is available from the hardware level)
2. Bootloader
After detection Jump to the mbr (master boot record) and read a very important data bootloader (all subsequent work is completed by the bootloader) and partition table, magic number
Recommended online video tutorial: linux video tutorial
3. Bootloader loads the kernel
The concept of kernel: (Linux is a bunch of source code. When booting, you will see booting the kernel, which detects whether the hardware is available from the software level)
It has two main functions: Drive the hardware (the so-called driver means that the system identifies the hardware, allows the operating system to recognize the hardware, and identifies whether the hardware is available from the software). After starting the init process, its task is completed.
4. Start the init process (The first process started by linux)
# Tasks of the init process:
Explanation:
The pid of the init process is 1, and its PPID is 0. The PPID is the parent process ID, and its parent process is the kernel task scheduler.
Linux is a real-time system that allocates processing time according to time. If you have not finished processing this time, you will be processed next time when you continue to allocate time. This requires a CPU time scheduler, that is Kernel scheduler with PID 0.
In Linux, a process derived from a process becomes a child process. If the parent process of a process dies, its child processes cannot exist either. In Linux, if the parent process dies and the child process survives, the process becomes an orphan process. Orphan processes are not allowed to exist in Linux. When Linux scans for an orphan process, it will automatically set the parent process of the orphan process to the init process (the process with PID 1).
When the child process dies, the parent process should switch the connection with the child process. This child process becomes a zombie process, J process, and this kind of process is not allowed to exist.
5. Read the /etc/inittab file
##Summary:
(1) Fireware (firmware) power-on self-test to check whether the hardware device is normal. If it is normal, read the bootloader# in the MBR (Master Boot Record), the first location where data is stored on the hard disk.##(2) The most important thing in BootLoader is that it stores a bootloader (GRUB)
(3) GRUB loads the kernel (kernel), drives the hardware and starts the init process
(4) The init process reads /etc/inittab
First execute the script:/etc/rc.d/rc.sysinit (this script will be executed regardless of any run level), and then find the default according to initdefault Run level and go to
/etc/rc.d/rcN.d to execute the script. The script starting with S is the script to start the service, and the script starting with K is the script to shut down the service(5 ) Finally, the terminal will be established and wait for the user to log in. Display user, name.
Recommended related articles and tutorials:
linux tutorialThe above is the detailed content of linux system boot process. For more information, please follow other related articles on the PHP Chinese website!