What happens when you turn on the computer.
Http://ike.126.com an article that has no intention to find from the network, found that write very wonderful, so he translated it down. But some of the jokes I still translation is not good, please forgive the brothers.
What happens when you turn on the computer.
A computer that runs without software is just a bunch of hot electronic devices. The first thing to start when the computer starts up is to run a special program called the operating system. The function of the operating system is to help other programs to control and access computer hardware.
The steps to mount the operating system are called boot (booting). (Strictly speaking, the process of booting and self-examination is called "self-test"). Your computer knows how to boot because its specific approach has been integrated into a chip called BIOS (or basic input and output system).
The BIOS chip tells the computer to look at a suitable place to boot the system, usually on the smallest numbered disk (the boot disk). A program called a bootstrapper (usually Grub or LILO under Linux) is loaded into memory and started. The role of the bootstrapper is to load the actual operating system.
The bootstrapper then looks for a kernel and loads it into memory to run it. When you start Linux, LILO prints some dots on the system screen, which means it's loading the kernel. (each point means that the cluster that has been directed to the kernel on the disk has been read).
(You may be puzzled as to why the BIOS does not direct the system directly, while the two-step process is divided into straight begging.) In fact, the BIOS is not very intelligent, and can be said to be a bit dull. So the Linux kernel will not use it after booting. This is because the program is written for a eight-byte limited PC and has limited BIOS capacity. Therefore, you may not be able to read the remaining sectors of the disk at boot time. In contrast, the bootstrapper allows you to boot more than one operating system on the disk. (although it can boot to other UNIX systems, this is not usually the way to do it.) )
When the kernel is started, it automatically checks and initializes the hardware and prepares to run the program. It looks for hardware through some I/O ports, a special bus, rather than a generic memory address. This is because these buses usually have a control card to monitor and execute the appropriate commands. Kernel Check hardware is not random, it has a built-in mechanism to deal with it: where to find hardware, how to control the normal use of hardware and so on. This step is called automatic checking (autoprobing).
In the kernel self-test you will see a lot of information on the screen, this is the kernel is through the above I/O port to automatically check the hardware, indicate your machine what the available hardware and organize them. Linux is very good at doing these things, which is relatively better than some other UNIX systems, and DOS or Windows. In fact, many old Linux users will think that the kernel does not need to be so intelligent to check the hardware (even if it is easy to install the system), because they have a good reason to let those who blow Mautius to jump out of the boring free Code experiment.
But the kernel is fully loaded and running is not the end of the boot; This is only the first phase (sometimes called running level one, run levels 1). After running level one, the kernel back transfers control to a program called INIT, which starts some user processes.
The first thing the Init process does is check the integrity of your disk. Disk file systems are very important; if they are due to a hardware problem or a sudden power outage, there is a good reason to check and fix them before the UNIX system boots. We'll wait and discuss in detail why the file system is corrupted.
The next thing Init does is start some daemon processes (daemon), such as a print control control system, a mail listener, or a WWW server. The wizard process runs in the background (background) to monitor what you specify. These special programs often deal with each other's requests to avoid conflicts. They are daemon processes because they are easy to write a collection of programs to answer and process all the services that are needed, rather than launching another new process for the same request. Each process generated by the daemon processes a task and runs at the same time without affecting other processes. The wizard programs that run on each system are different, but there is usually a print monitoring process (a daemon that controls your printer).
The next step is to prepare for the user. Init opens a process called Getty to monitor your console (perhaps a dial-up port). This program will provide a login at your terminal to allow you to log in to the system. When all the daemon and Getty processes are started at each terminal, we are at run level two. At this point, you can log in and run the program at this level.
But things are not over, and the next step is to open up some other useful programs, such as networking and other services. When all this is done, we are in the level three run mode (run levels 3), and the system is fully operational.