A summary of Sysvinit
The advantage of Sysvinit is that the concept is simple. Service developers only need to write the start and stop scripts, the concept is very clear, when the service is added/removed to a runlevel, only need to perform some basic operations to create/delete soft connection files, these do not need to learn additional knowledge or special definition syntax (upstart and SYSTEMD all require the user to learn the new language that defines the system initialization behavior.
Second, another important advantage of sysvinit is the determination of the order of execution: the script executes strictly according to the size of the boot number, and one execution completes the next, which is very useful for troubleshooting. Upstart and SYSTEMD support concurrent start-up, resulting in no one knowing the exact boot sequence, which is not easy to debug.
But the serial execution of the script causes the sysvinit to run slowly, and in the new IT environment, the startup speed becomes an important issue. In addition, the new Linux features such as dynamic device loading also expose some problems with sysvinit design. In response to these problems, people began to find ways to improve sysvinit in order to speed up startup time and solve Sysvinit's own design problems.
System V init boot process
Generally speaking, the Linux/unix system usually has two different ways of initiating startup .
1) BSD system init
2) System V Init
Most distributions of Linux use init, the SYS v INIT, similar to System V INIT, which is easier and more flexible than the traditional BSD system INIT, and the main idea of System V init is to define different "runlevel" ( RunLevel) ". The configuration file/etc/inittab defines the RunLevel at which the system boots, and what to do when entering or switching to a runlevel. Each run level corresponds to a subdirectory/ETC/RC.D/RC N.D.
The following is an approximate system V init process:
(1) The first script executed by the INIT process is /etc/rc.d/rc.sysinit, (in doubt, according to Bird brother,/etc/rc.d/rc.sysinit is called by Etc/inittab, That nature the first script is Inittab, by Imjacob) it mainly does the initialization work at each runlevel, including: Start the swap partition, check the disk, set the hostname, check and mount the file system, load and initialize the hardware module.
(2) Execution of the default run level mode
The content of this step is primarily reflected in/etc/inittab, where the Inittab file tells the Init process what runlevel to enter and where to find the configuration file for that runlevel.
(3) Execute/etc/rc.d/rc.local script file
This is also the last script file executed during the INIT process, so the user can add in this file some commands that need to be executed before logging in.
(4) Execution of/bin/login procedures
Linux system V