|Describing the Computer System Boot Process
The Process of Booting Up the Average Computer System
This discussion is specific to an OS (such as Unix) and an architecture (such as ix86 PC). But similar steps are valid for other computer systems. So that a
technique is understood, we often gloss over the details, even if it is at the risk of precision, but not at the level of "whole truth."
System Startup: Two states a) Power Off b) Power On
State: Power off.
Q: Is CPU Working?
State: Power On; Hard Disk motor speeds up.
Q: What should CPU do when power is first applied?
A: The moment it is on, CPU Fetches, Decodes and Executes instructions.
Q: So who points to this instruction? Program counter is an internal register of CPU.
Program counter gives this instruction address and its value increases. And this increment of pc value is done in decoding phase so that next instruction can be
Q: What is the first value that the pc has?
A: Value is typically zero but need not be; can also be some other number.
Q: Now how do we make sure that the PC value is zero initially?
A: When powered on the RESET SIGNAL will cause the CPU to make the pc Value to Zero. So CPU should do the Zero instruction first and now the fetch decode,
execute is started. Reset Signal is not only wired to CPU but also to Sub Systems E.g., Monitor. All Sub Systems have to be powered on.
Q: What should be there in Memory location Zero?
A: A valid instruction.
Q: What type of memory is it?
A: Not a RAM.
Q: From the moment the machine is powered on to the moment when you can see the first Character on the screen what happened?
Q: BIOS, what does it do?
A: BIOS contains many routines. When instructions are executed from address zero on wards, BIOS routines are called. E.g., Display a
character onto the screen. All the routines that accomplish this task of printing a character on to the screen can be considered together as a device driver.
The BIOS contains such drivers for many devices: keyboard, HDD, floppy, video, etc. BIOS device drivers are limited. BIOS has minimally functional drivers. Some
OS (e.g., Linux) avoid non re-entrant code and avoid BIOS routines.
The Power On self Test (POST) is a test that BIOS performs from the power-on moment till we begin to see the characters on the screen. Even if a video monitor
is not there to show these messages, it communicate via other means such as it beeps.
Q: OS is not in ROM. It is on the hard disk. How do we choose the starting point to load the OS code?
A: The program counter should be set to that. After the
instruction at zero has loaded the OS code on the starting position then you can jump to the OS code. So somewhere the BIOS routines will read from the hard
disk and put the OS code below the BIOS space. And then the routine jumps to this code.
Note: New OS do not use BIOS routines. Its not necessary that all BIOS routines be executed.
Q: What is the size of OS code that is loaded by the BIOS routine discussed above?
A: 512 Bytes. This code is part of MBR (master boot record) as it is known in
the PC world. Its main job is to bring more data from the hard disk. Now in this 512 Bytes, there should be another program. And this program can bring more
data from the hard disk and will be loaded further below in the mem. The program that is brought in is usually the OS Loader.
Q: What is the size of Kernel?
A: widely ranges. Let us say Ѕ to 2 meg and this has to be brought in and placed below the above mentioned 512 bytes.
Q: How do you identify starting position of MBR? "First" track, first sector.
A: First track is usually numbered zero.
Q: It s the job of OS loader to bring Kernel. Why cant MBR itself bring the Kernel.
A: its not capable of bringing the Kernel because of MBR's small size. So
MBR gets the OS loader and that in turn loads the Kernel. In our OSIS (Operating Systems and Internet Security) Lab machines, the OS Loader is NT Loader.
Loader can bring-in and pass control over to yet another program. Lets say OS loader gets the OS. So now OS is loaded. Now CPU invokes instructions from the
OS will bring its own device drivers and may or may not use BIOS routines. All devices are initialized.
Privileged instruction only when CPU is in the supervised mode. During the process of getting data from initial to OS loader the CPU is in privileged mode. This
is a good place to do bad things.
OS now loaded can change MBR so that next time when system boots up another program runs. And this is called boot sector
A good OS will switch to the user mode as soon as possible. OS Designers try to get privileged mode off , Memory management on as soon as possible.
Contents of OS (not OS Loader):
1) Device Drivers
2) File system. ( it includes algorithms, while file volume is passive stuff on the hdd without algorithms)
4) Process management (creation, destruction and control of processes)
The above four together can be called a Kernel.
OS is now able to create the very first process.
In Unix, it is called Init.
As yet we have not seen the login prompt.
Only choice user had so far was OS loader
asked the user which OS the user wished to boot into, and we choose Linux.