Start process and System management

Source: Internet
Author: User

knowing how Linux works , you can understand how Linux works through the startup process of Linux, which requires an in-depth look at every step of the operating system startup, without having to know the details of each boot As long as the system is starting to understand the characteristics of each step is similar. Here is the main introduction of CENTOS6, its approximate process is,post(computer post)->grub(boot operating System program)->kernel(kernel) ->init(Process management program)->bash(user interaction Program)

aa computer startup process1 postProcess

first the computer is power up,the CPU will read the BIOS( Some special instructions built into the CPU, will read the BIOS by default ),the BIOS After reading into memory, check all hardware on the computer and follow the configuration to start the next step. The BIOS consists of two parts : ROM, internal storage of some immutable machine instructions, and RAM, whichstores the set-up characteristics of the boot (this module needs to be continuously powered, and the data will be lost once the power is set). Control BIOS is generally computer power, according to F #(different computers) into the blue and white to the configuration interface, where you can configure the first boot hardware, turn on The CPU virtualization features, sound card and so on.

2 Grub

after the BIOS program runs, the first boot entry is loaded, if the first startup item is a hard disk. At this time the CPU will read the hard disk first track first sector data, read the former 446 bytes of data, this part of the data is called MBR,Grub is relatively large can not be completely placed in the MBR , there is a part of the previous sector, but the previous sector is not open, and some of the data is stored in the/boot directory under Grub stage2 . To summarize, part of the data stored in the MBR called this part of the data called Stage1, and general data on the hard disk in front of the sector called stage1.5, The last part of the data is stored in the /boot/grub directory called Stage2.

3 kernel

in Grub , you can choose which system to start, it's not our boot system, it really starts with the Vmlinuz and Initramfs files in the / boot directory , vmlinuz is required kernel, and Initramfs is not required,Initramfs file has a simple system, embedded part of the driver, is to start the real file system intermediate steps, The main purpose of this design is to prevent the kernel from being too large, and the kernel file vmlinuz only 4M and Initramfs 20M more. Kernel through the Initramfs internal drive to load the real file system, loading a variety of disks, network cards,USB and other drivers, to achieve the advanced functions of the system.

4 Init

It is not a program that the system must have, but the kernel places a subset of the monitoring and administrative privileges on init, allowing the init Agent kernel to implement process management. The kernel gives these permissions because process scheduling is the most wasteful of system time. Process scheduling process: First the CPU receives the interrupt signal,the CPU will put the data of the currently running process into memory, and label the process, it runs to which step, and then the CPU read the kernel in, Restore the state of the kernel, load the last run of the kernel data,the CPU to determine the next need to run the program allocated a good time to leave the field, and finally load the next process. Here's a conceptwhere the CPU 's processing data is much faster than the disk reads. When the kernel is particularly large, a single scheduled I/O volume will be particularly large. This explains that the kernel must be small, the more sophisticated the CPU utilization is higher.

5 Bash

The user interaction tool can look at previous blogs.

twoSystem Remediation1 postStage

Press F # enters the BIOS changes, forgets the BIOS password, can remove the button battery on the motherboard, and the data configured in the BIOS will be lost.

2 GrubStage
    • after the computer is in a black screen state, when the hard disk data is valid, then the general destruction is the Stage1 stage of Grub . Can be rescued through the rescue mode of CD-ROM, the operation process is as follows:

Disc Boot Select the third one to confirm the opening of a shell

grub-install/dev/sd* here the /dev/sd* is the hard drive where the original grub resides

    • Computer black screen after boot but there is an error Erorr # #, then stage1.5 or stage2 was destroyed, and repair the stage repair process similar:

Disc Boot Select the third one to confirm the opening of a shell

Grub-install--root-direcoty=/path/dev/sd*/path is the parent directory of boot,/dev/sd* is the original grub The hard drive where

    • system display grub > This is the grub grub location of the profile /boot/grub/grub.conf grub

Default=0 timeout=5 Grub Interface Wait time Tille CENTOS6 boot name root (hd0,0) The kernel file is located in the disk partition kernel/vmlinuzroot=/dev/sda2 use which kernel, file system directory Initrd/initramfs Initramfs location


3 kernel,Init,BashRemedy

Kernel,init,bash lost, enter the rescue mode to install the corresponding RPM package is available.

the configuration file for Init is located in /etc/inittab

Bash 's configuration file is located in the/ETC/BASHRC and user home directory . BASHRC

threeService Management

when the server starts, the General Service and the system start together, the boot-start service management script is located in the/etc/init.d/ directory, is called through the init step. The format is the Bash script, just the start and close order. You can define some scripts that you want to execute after booting in local .

Servicesername Management of Start|stop|restart|reload|status services

Chkonfigadd name adds the service to the boot management

Chkonfig-l level name On|off set the service boot in which rating

Some programs need to listen to the port, but only occasionally use, so that the service is forever memory waste memory and CPU time slice, but can not stop, then someone wrote a xinted to help a batch of program listening port, The service program runs only when it is called.

Summary

This section focuses on the various stages of computer startup and remedial actions at each stage, and briefly describes the management commands for the service program.


This article is from "Lao Wang Linux Journey" blog, please be sure to keep this source http://oldking.blog.51cto.com/10402759/1879116

Start process and System management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.