Linux starts full line speed

xiaoxiao2021-03-06  84

The Linux system is a very excellent operating system, but the startup time is one of the shortcomings of the system. So can you shorten the startup time of the Linux system through some settings? of course can. This article will show the reader how to shorten the startup time of the system without sacrificing the availability of Linux system. To achieve this goal, you need to understand all kinds of services between the system and their dependence, which in turn starts simultaneously under conditions allowed, thereby greatly saving system startup time. Preparation If you want to use the method described in this article to set the Linux system, you must first be familiar with the LINUX system setting language. Setting up the system's startup process is a relatively dangerous behavior, which is easy to cause the system unable to start. Once this happens, it is best to restart the system after selecting a single user mode to restore the system and restart. Of course, the most important thing is to back up important data before setting. Second, it is recommended that the user is best to modify the test before modifying the unit system. If the user has only one computer, then this is recommended to use the User Mode Linux System (UML) to test. UML is a kernel patch that allows kernel translation of the Linux system to binary so that users can run the Linux system as using ordinary software. Once an unexpected situation occurs, the loss is only UML, and the original system can be safe. The LINUX system starts sequence and launch of the Runlevel Linux system include multiple steps, which mainly introduces the system startup steps after the kernel load. Users can view the system's current RunLvel by running the / sbin / runlevel command. Runlevel is the number of Linux systems to distinguish between the system advanced startup setting type. These numbers are very common, and the vast majority of them have a clear meaning. Taking the Red Hat Linux system as an example, its RunLvel has the following few (see Table 1): INIT how to initialize the system init can be learned how to change the system's Runlevel. Typically, the setting file can guide the init to perform the /etc/rc.d/rc command to obtain the relevant information of RunLvel. The various system services required by the system service user are started by the RC instruction program. System potential services are complicated. Most Linux systems typically only provide features such as SSHD (SecureShell Service), Syslog (System Log Tools), and LPD (Print Services). Users can find all services from the /etc/rc.d/ directory. If you open this directory, you will find that many services are just a shell, which just boots other programs to complete the work. Maybe someone will ask, how does the RC program know which programs do every runlevel? The answer is in the /etc/rc.d/ directory below with the init.d / directory, and they each correspond to their own Runlevel. Their names are RC * .D /, such as Runlevel 5 is /etc/rc.d/rc5.d/. Two symbolic links are included in each rc * .d / directory, which can be connected to the specified service program in the /etc/init.d/ directory. The startup and termination of hands-on transformation services If the user decides to start the Linux system and enter graphics mode (Runlevel 5), then the RC command program will be / etc / rc when the init boot RC instruction program runs and informs the Runlevel level .d / rc5.d / for view, then it will perform all links from this directory. The process of the RC instruction program executes the link can be divided into two parts. First it will execute all the names of "K" header, pass the "STOP" parameter to all services, and stop all of these links to point to all services. After these services are stopped, the RC instruction program will perform all the names of "S" head, and pass the "start" parameter to them, start the services you point to these links.

In addition, the RC instruction program can determine the execution order of the link and the digital small execution according to the two decimal numbers of the link name. An example will be given to help users have deeply understood. When the user starts the system into Runlevel 5, the first link to be executed is K05SASLATHD, since it is headed by "K", and the latter two decimal numbers are less than other links with "K". The first start link to be executed is S05KUDZU. Finally, the execution will be S99LOCAL. Below is a link to the program in the Runlevel 5 state.

# cd /etc/rc.d/rc5.d# ls -altotal 8DRWXR-XR-X 2 root root 4096 JUL 15 09:29 .drwxr-xr-x 10 root root 4096 jun 21 08:52 ..lrwxrwxrwx 1 root root 19 Jan 1 2000 K05SASLAUTHD -> ../init.d/saslauthdlrwxrwxrwx 1 root root 20 Feb 1 2003 K15POTGRESQL -> ../init.d/postgresqllrwxrwxrwx 1 root root 13 Jan 1 2000 K20NFS -> ../init.d/ NFSLRWXRWXRWX 1 Root Root 14 Jan 1 2000 K24IRDA -> ../init.d/irdalrwxrwxrwx 1 root root 17 Jan 1 2000 K35winbind -> ../init.d/winbindlrwxrwxrwx 1 root root 15 Jan 1 2000 K50SNMPD -> ../ Init.d / snmpd ... lrwxrwxrwx 1 root root 18 Feb 8 11:15 k92iptables -> ../init.d/iptableslrwxrwxrwx 1 root root 19 Feb 1 2003 K95FirstBoot -> ../init.d/firstbootlrwxrwxrwx 1 root root 15 Jan 1 2000 S05kudzu -> ../init.d/kudzulrwxrwxrwx 1 root root 14 jun 21 08:55 s09isdn -> ../init.d/isdnlrwxrwxrwx 1 root root 17 Jan 1 2000 S10Network -> ../init.d / networklrwxrwxrwx 1 root root 16 Jan 1 2000 S12Syslog -> ../init.d/sysloglrwrwrwrwx 1 root root 14 Jan 1 2000 S13portmap -> ../init.d/portmaplrwx RWXRWX 1 root root 17 Jan 1 2000 s14nfslock -> ../init.d/nfslocklrwxrwxrwx 1 root root 18 Jan 1 2000 S17keyTable -> ./init.d/keytablelrwxrwxrwx 1 root root 16 Jan 1 2000 s20random -> ../ Init.d / randomlrwxt 16 jun 21 08:52 S24pcmcia -> ../init.d/pcmcialrwxrwxrwx 1 root root 15 Jan 1 2000 S25Netfs -> ../init.d/netfslrwxrwxrwx 1 root root 14 Jan 1 2000 S26apmd -> ../init.d/apmdlrwxrwxrwx 1 root root 16 Jan 1 2000 S28autofs -> ../init.d/autofslrwxrwxrwx 1 root root 14 Jan 1 2000 S55SHD -> ./init.d/sshdlrwxrwxrwx 1 root root 20 Jan 1 2000 S56Rawdevices -> ../init.d/RawdeviceLRWXRWXRWX 1 Root Root 16 Jan 1 2000 S56XINETD ->

../init.d/xinetdlrwxrwxrwx 1 root root 14 Feb 1 2003 S58NTPD -> ../init.d/ntpdlrwxrwxrwx 1 root root 13 Jun 21 10:42 S60AFS -> ./init.d/afs......... Root root 18 Jan 1 2000 S80sendmail -> ../init.d/sendmaillrwxrwrwx 1 root root 13 Jan 1 2000 S85GPM -> ../init.d/gpmlrwxrwxrwx 1 root root 15 Mar 22 08:24 S85HTTPD -> ../ Init.d / httpd ... lrwxrwxrwx 1 root root 14 jul 15 09:29 s98wine -> ../init.d/winelrwxrwxrwx 1 root root 13 feb 8 17:26 s99db2 -> ../init.d/db2lwxrwxrwx 1 root Root 11 Jun 21 08:52 S99LOCAL -> ../rc.local If the user wants to temporarily terminate a service of a RunLvel, just delete the corresponding link. However, manual settings for links are a heavy and wrong work, but there is a very useful helper, its name is ChkConfig. To distinguish whether the service that is not terminated is to understand which services are not terminated, the user needs to run the / sbin / chkconfig -list command. The display result after the command execution is shown below, and the user can clearly see eight items in each row. The chkconfig command can also be used to open or terminate a service. AFS 0: OFF 1: OFF 2: Off 3: on 4: Off 5: on 6: Offanacron 0: Off 1: Off 2: on 3: On 4: on 5: on 6: Offapmd 0: Off 1: Off 2 : on 3: on 4: on 5: on 6: Offatd 0: OFF 1: OFF 2: Off 3: on 4: on 5: on 6: Offautofs 0: Off 1: Off 2: Off 3: on 4: on 5: On 6: Offcrond 0: OFF 1: OFF 2: On 3: On 4: on 5: On 6: Off ......... The upper left of the first column shows the name of the service, the next second column shows It is the Runlevel and the current state. For example, NTPD (Network Time No Connection Bar Program) Services is set to be turned on only in Runlevel 3 and Runlevel 5, while SSHD services are turned on in Runlevel 2, 3, 4, and 5. Perhaps the user will find that there is no service in Runlevel 0 and Runlevel 6 because Runlevel 0 and Runlevel 6 indicate that the system is terminated, of course, has not been served. The dependence is as mentioned above, and the system will run each Runlevel service when the system starts. Maybe the user is easy to think of, if multiple services can be run at the same time, will inevitably save a lot of system startup time. But unfortunately, this method is not good, the reason is that there is a dependency between services. Traditional Linux systems do not give users a dependence relationship between services. Now explain how to clarify the dependence between the service through a simple example.

转载请注明原文地址:https://www.9cbs.com/read-125023.html

New Post(0)