简单一篇文章明白地讲解了计算机操作系统的启动过程
OPERATING SYSTEM CONCEPTS
ABRAHAM SILBERSCHATZ
PETER BAER GALVIN
GREG GAGNE
10.5.2 Boot Block
For a computer to start running—for instance, when it is powered up orrebooted—it must have an initial program to run. This initial bootstrap program tends to be simple. It initializes all aspects of the system, from CPU registers to device controllers and the contents of main memory, and then starts the operating system. To do its job, the bootstrap program finds the operating-system kernel on disk, loads that kernel into memory, and jumps toan initial address to begin the operating-system execution.
For most computers, the bootstrap is stored in read-only memory (ROM).This location is convenient, because ROM needs no initialization and is at a fixed location that the processor can start executing when powered up or reset. And,since ROM is read only, it cannot be infected by a computer virus. The problem isthat changing this bootstrap code requires changing the ROM hardware chips. For this reason, most systems store a tiny bootstrap loader program in the boot ROM whose only job is to bring in a full bootstrap program from disk. The full bootstrap program can be changed easily: a new version is simply written onto the disk. The full bootstrap program is stored in the “boot blocks” at a fixed location on the disk. A disk that has a boot partition is called a boot disk or system disk.
The code in the boot ROM instructs the disk controller to read the boot blocks into memory (no device drivers are loaded at this point) and then starts executing that code. The full bootstrap program is more sophisticated than the bootstrap loader in the boot ROM. It is able to load the entire operating systemfrom a non-fixed location on disk and to start the operating system running. Even so, the full bootstrap code may be small.
Let’s consider as an example the boot process in Windows. First, note that Windows allows a hard disk to be divided into partitions, and one partition—identified as the boot partition—contains the operating system and devicedrivers. The Windows system places its boot code in the first sector on the harddisk, which it terms the master boot record, or MBR. Booting begins by running code that is resident in the system’s ROM memory. This code directs the system to read the boot code from the MBR. In addition to containing boot code, the MBR contains a table listing the partitions for the hard disk and a flag indicating which partition the system is to be booted from, as illustrated in Figure 10.9. Once the system identifies the boot partition, it reads the first sector from that partition (which is called the boot sector) and continues with the remainder of the boot process, which includes loading the various subsystems and system services.