Computer Boot Process

Source: Internet
Author: User

The entire boot process is based on one line per line.
Io. sys
Msdos. sys
Config. sys
Command. com
Autoexec. bat
These five files are the sequence of the five files that should be started.

The computer brain boot process refers to the process from powering a computer to loading an operating system. This process involves a series of operations on computer hardware and software. An understanding of the startup process helps you analyze and determine the process of fault occurrence when a computer fails.

After the computer is powered on and started successfully, it has gone through power-on, power-on self-check, video card BIOS detection, BIOS display, CPU detection, memory detection, standard device detection, plug-and-play device detection, standard device parameters display specify the startup sequence to start the system and execute Io. sys and msdos. sys system file, Execute Command. COM and other system files, read windowns initialization files, and start successfully.

Turning on the power to start the machine is almost a daily task for computer enthusiasts. We will not be unfamiliar with the screen startup screen,, what does the computer do when it displays these boot screens? I believe some of my friends are not very clear. This article will introduce what computers have done when the power is turned on to the appearance of windows blue sky and white clouds.

First, let's understand some basic concepts. First, we are very familiar with BIOS (Basic Input and Output Systems). BIOS is the underlying layer that deals directly with hardware.CodeIt provides basic functions for the operating system to control hardware devices. BiOS includes the BIOS of the system BIOS (commonly referred to as the motherboard BIOS), the video card bios, and other devices (such as the IDE controller, scsicard, or Nic, the system BIOS is the main character of this article, because the Startup Process of a computer is under its control. The BIOS is generally stored in the ROM (read-only storage chip), and the Code will not disappear even after it is shut down or powers down.

The second basic concept is the memory address. Generally, 32 MB, 64 MB, or MB memory is installed on our machine. Each byte of memory is assigned an address, so that the CPU can access the memory. The 32 MB address range is expressed as 0 ~ in hexadecimal notation ~ 1 ffffffh, where 0 ~ Fffffh's low-end 1 MB memory is very special, because the first 8086 processor can access a maximum of 1 MB of memory, which is known as the basic memory at the low end of 1 MB 640kb, while a0000h ~ Bffffh must be retained for the display card. c0000h ~ Fffffh is reserved for the BIOS. The system BIOS usually occupies 64kb or more space ~ At c7fffh, the BIOS of the IDE controller is in c8000h ~ Cbfffh.

Guiding Process

We need to turn on the power to start the machine almost every day. In the face of a screen boot screen, we will not feel unfamiliar at all,, what does the computer do when it displays these boot screens?

After powering on the computer, go to the computer and prepare to accept the commands you issue. The process that the computer runs is called the boot process. We know that when the power is off, the RAM data will be lost. Therefore, the computer does not use Ra to maintain the basic work instructions of the computer, instead, you can use another method to load the operating system file into RAM, and then the operating system takes over the control of the machine. This is a major part of the guiding process. In general, the guiding process involves the following steps:

① Power-on ---- turn on the power switch to power the motherboard and internal fan.

② Start guideProgram---- The CPU starts executing commands stored in the rom bios.

③ Boot self-check ---- the computer diagnoses and tests the main components of the system.

④ Load the operating system ---- the computer reads the operating system file from the disk to ram.

⑤ Check the configuration file and customize the operating system environment-read the configuration file and customize the operating system according to user settings.

⑥ Prepare to read commands and data ---- the computer waits for the user to input commands and data.

(1) power-on

The first step in the boot process is power-on. When the fan starts to run, the power indicator should turn on. Otherwise, the system power supply is faulty, or the motherboard and other components and chassis are short-circuited.

(2) Start the boot program

The CPU runs commands from the memory address ffff0h. From the previous introduction, we can see that this address is actually within the system BIOS address range, no matter which company's BIOS, here is just a jump command, jump to the real startup code in the system BIOS.

(3) self-check on startup

The first thing to do with the startup code of the system BIOS is to perform post (power-on self test, self-check after power-on ), the main task of post is to detect the existence and normal operation of some key devices in the system, such as memory and video card devices. Since post is the earliest detection process, the video card has not been initialized yet. If the system BIOS finds some fatal errors during the post process, for example, if the memory is not found or the memory is faulty (only KB of general memory will be checked), the system BIOS will directly control the speaker voice to report the error. Under normal circumstances, the post process is very fast.

After the post is complete, the system BIOS searches for the BIOS of the video card and calls its initialization code. The video card BIOS initializes the video card. At this time, most video cards will display some initialization information on the screen.

Manufacturer, graphics chip type, and so on. The system BIOS then looks for the BIOS program of another device. After finding the program, you also need to call the initialization code in the BIOS to initialize the relevant device.

After finding the BIOS of all other devices, the system BIOS displays its own boot screen, including the type, serial number, and version number of the system BIOS. Check and display the CPU type and operating frequency, test all ram, and display the Memory Test Progress on the screen.

After the memory test is passed, the system BIOS starts to detect some standard hardware devices installed in the system, including hard disks, CD-Rom, serial ports, parallel ports, and soft drives, in addition, the vast majority of newer versions of the system BIOS also need to automatically detect and set the memory timing parameters, hard disk parameters and access mode.

After the standard device is detected, the system BiOS supports plug-and-play code to detect and configure the plug-and-play devices installed in the system. After each device is found, the system BIOS displays the device name, model, and other information on the screen, and allocates resources such as interrupts, DMA channels, and I/O ports to the device.

After completing the preceding steps, all the hardware has been detected and configured. Most system BIOS will be refreshed and a table is displayed on the top of the screen, it roughly lists the various standard hardware devices installed in the system, the resources they use, and some related working parameters.

Next, the system BIOS updates the escd (extended system configuration data, extended system configuration data) according to the CMOS configuration. escd is a means for the system BIOS to exchange hardware configuration information with the operating system. Generally, the escd data is updated only after the hardware configuration of the system is changed. Therefore, we do not see "Update escd... Success.

(4) loading the Operating System

After the post is successful, the startup code of the system BIOS performs the last task, that is, starting from the floppy disk, hard disk, or optical drive according to the boot sequence specified by the user, locating and loading the operating system files. First, the computer looks for two operating system files: Io. sys and msdos. sys. If the two files do not exist, the boot process displays the following information: "non-system disk or disk error" or "invalid System Disk ".

Tip: If the set boot sequence is a floppy disk and then a hard disk, check whether the system disk (including the above system files) is in the soft drive when the above prompt appears ). If it is not a system disk, you can remove the floppy disk. After pressing any key, the computer will find the system file from the next drive (hard disk.

Then, the microprocessor will try to load another operating system file command.com. If loading fails (the command.com file does not exist or the version is incorrect), the following error message is displayed: "bad or missing command interpreter", and all the command computers you send cannot execute, command.com is used to explain these commands.

(5) Check the configuration file and customize the Operating System Environment

In the early stage of the boot process, the computer initializes the hardware by checking the information in CMOS. However

In different operating systems, the computer also needs more configuration information to correctly use all devices and create a personalized running environment.

We take DOS and Windows as examples. In dos, we usually create and edit autoexec. after the BAT file is started, some commands are automatically executed, such as setting the hard disk buffer size and automatically starting the Chinese character environment. sys can load dos drivers for the mouse, optical drive, sound card, and other devices, so that these devices can be used in DOS. In Windows, you can configure the running environment in more ways, such as modifying the registry and editing the system. INI, win. INI and other system configuration files, or put the content that you want to execute immediately after Windows is started into the Windows Startup Group.

(6) prepare to receive commands and Data

The boot process ends when the computer is ready to receive commands. Usually, after the boot ends, the computer displays an operating system screen or prompt. If you are using Windows, you will see the Windows desktop; if you are using DOS, you will see the operating system prompt (such as c: \>;: \> ).

The whole process described above is the boot work that the computer needs to complete when the power switch (or press the reset key) is turned on for cold start. If we press CTRL + ALT + DEL in DOS to perform Hot Start (or restart the computer from Windows), the post process will be skipped, in addition, the CPU and memory test will not be performed. We can see that both cold start and hot start, the system BIOS repeats these things that we do not pay too much attention to at ordinary times, however, these monotonous steps provide a foundation for us to use computers normally.

Directory

1. Pre-boot stage
2. Guiding phase
3. kernel Loading
4. initialize the kernel
5. Login

1. In the pre-boot phase, press the computer power to start the computer,
And before Windows XP is started,
We call it the pre-boot phase,
In this phase, the computer first runs power on self test (post ),
Post checks the overall memory of the system and the status of other hardware devices.
If the BIOS of a computer system (Basic Input/Output System) is out-of-the-box,
The computer hardware will be inspected and configured.
The computer's Basic Input/Output System (BiOS) locates the computer's boot device,
Then the MBR (Master Boot Record) is loaded and run.
In the pre-boot phase, the computer will load the ntldr file of Windows XP.

2. the Windows XP Professional boot phase contains four small phases.
First, the computer must go through the initial Boot Loader stage (initial Boot Loader ),
In this phase, ntldr converts the computer microprocessor from the real mode to the 32-bit flat memory mode.
In real mode, the system reserves KB of memory for the MS-DOS, and the rest of the memory is considered as extended memory,
In 32-bit flat memory mode, the system (Windows XP Professional) regards all memory as available memory.
Then, ntldr starts the built-in mini-file system drivers,
This step enables ntldr to identify each partition formatted with the NTFS or fat file system,
To discover and load Windows XP Professional,
Here, the initial Boot Loader stage is over.
Then the system came to the operating system selection stage,
If more than one operating system (or multiple systems) is installed on the computer ),
In addition, if boot. INI is correctly set to enable the system to provide the OS selection,
The computer display displays an operating system menu,
This is the result of ntldr reading boot. ini.

Iii. loading the kernel is in the kernel loading phase. ntldr is called ntokrnl.exe for Windows XP.
The system loads the Windows XP kernel but does not initialize it.
Then, ntldr loads the hardware abstraction layer (Hal, Hal. dll), and then,
The system continues to load the HKEY_LOCAL_MACHINE \ System key,
Ntldr reads the select key to determine which control set will be loaded.
The control set contains the driver of the device and the services to be loaded.
Ntldr loads the driver of the underlying device whose start key value is 0 under HKEY_LOCAL_MACHINE \ SYSTEM \ service.
When the current control set of the image serving as the control set is loaded,
Ntldr passes control to the kernel and the kernel initialization starts.

4. During kernel initialization,
The color Windows XP logo and progress bar are displayed in the center of the screen,
At this stage, the system has completed the following four tasks:
The kernel uses the data collected during hardware detection to create the HKEY_LOCAL_MACHINE \ hardware key.
The kernel creates a clone control set by referencing the default value of HKEY_LOCAL_MACHINE \ SYSTEM \ current.
The clone control set configuration is a backup of computer data, and does not include changes during startup.
The system initializes and loads device drivers. The kernel initializes the underlying drivers that are loaded during kernel loading,
Then the kernel scans the device driver with the START key of 1 under HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ service.

These device drivers are initialized when they are loaded. If an error occurs, the kernel uses the errorcontrol key value to determine how to handle the problem,
When the value is 3, the error is marked as crisis/critical. When the system encounters an error for the first time, it will be restarted with lastknowngood control set,
If an error still occurs when you start with lastknowngood control set, the system reports that the startup failed and the error message is displayed,
The system stops starting. If the value is 2, the error is serious. The system fails to start and restarts with lastknowngood control set,
If the value of lastknowngood is already used for system startup, it will ignore the error and continue to start;
When the value is 1, the error is normal and the system will generate an error message,
However, this error is still ignored and started. If the value is 0, the system will not display any error information to continue running.
Session Manager starts Windows XP advanced subsystems and services,
Session Manager starts Win32 sub-systems and Winlogon processes that control all input and output devices and access the display screen,
Kernel Initialization is complete.

5. log on to winlogon.exe and start Local Security Authority,
Windows XP Professional welcome screen or Login Dialog Box,
At this time, the system may continue to initialize the unfinished driver in the background.
Prompt to enter a valid user name or password.
The service controller finally executes and scans HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ servives to check whether there are other services that need to be loaded,
Service controller searches for services whose start key value is 2 or higher,
The service is loaded according to the value of START and the value of dependongroup and depandonservice.
Windows XP startup is considered complete only after the user successfully logs on to the computer,
After successful login, the system copies the clone control set to the lastknowngood control set. After completing this step,
The system is successful.

Related Article

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.