|What Happens when you Boot|
Registration: Open to all.
Date: January 19, 1997
Time: 11:00 am
Venue: Electrical Engineering Department, University of Engineering and Technology (UET), Lahore
Booting a system means starting it. A computer can be booted in two ways. Either you can turn it on from the power knob or you can hit the CTRL+ALT+DEL key combination to restart it. The former method is termed as cold boot and the latter method is called Hot Boot and involves requesting the BIOS (Basic Input Output System) of the computer to restart itself.
Whatever the method, a series of events take place when a computer system starts up. You should keep this in mind that a computer system consists of two things, hardware and software. Hardware comprises all the circuits that make up the system while software is merely a collection of instruction that are executed by the microprocessor. But then these instructions are governing rules of an operating system. An operating system is a set of instructions that let you use the hardware devices you have in your computer. It acts like a bridge between other programs and the hardware of a computer.
Now what about the location of these instructions? This would call for remembering an important part of a computer system that performs the function of storage. Storage devices are generally divided into two parts, Primary Storage and Secondary Storage. Primary Storage involves all the disk drives whereas Secondary Storage is also termed as RAM (Random Access Memory). Disk drives can store computer data permanently until it is removed by the user but RAM loses everything in it when you reboot a computer, be it Hot or Cold Boot. That means an operating system must reside on some disk drive so that it can come into play when the computer is booted.
A computer commonly has two types of disk drives. One is called a floppy diskette. The storage capacity of this floppy diskette is very small as compared to the other type called the hard drive, which stores data on a hard drive. The floppy diskette, unlike the hard disk, is detachable. An operating system, like DOS (Disk Operating System) can be stored on a floppy diskette as well as on a hard disk. But then if a size of operating system too large to fit on a floppy diskette, you have only one choice. You can consider Windows-95 as an example. OK. But how would the computer know of the presence of an operating system on any drive, for all matter the presence of a drive? The answer to this question is the BIOS.
BIOS consists of some specific hardware-related instructions that are meant to be executed when a computer starts. It’ll only come into play when you start a computer. Would you call it software or hardware? Well you can call it software but it stored in a different location than the regular software due to its function. A small memory chip is used lies on the main circuit board and in this rests the BIOS instructions. This memory chip is different than other RAM chips because it cannot be overwritten. That is why it is called a ROM (Read Only Memory) chip. So you started your computer and the BIOS instructions were sought. These instructions carry specific jobs for the microprocessor.
First, the microprocessor checks for hardware peripherals around itself. Depending upon the BIOS instructions the microprocessor would perform a search for the input and output devices, the communications channels and the keyboard is the basic input device, as mentioned earlier, involves the RAM and the disk drives. This operation or phase is termed as POST, or the Power-On-Self-Test.
After POST, the BIOS looks for one specific area of the hard disk or the floppy disk, which is accessed first depending upon the default settings of the BIOS. On my Computer, the floppy drive is first accessed and then comes the hard drive. And I’m sure most of you would have the same setting on your computers. If there is a floppy diskette inside the drive, its first sector would be read, and if there isn’t one, the BIOS would continue for the hard disk and try to read its first sector. Why? Sector is the name of a space that is used to store computer data. A sector on a floppy or a hard disk is equal to 512 bytes. That means it can hold a maximum of 512 bytes (1 byte= I computer character) in it. The first sector of a disk is called the Boot Sector because it holds information essential to boot a computer. And that is why the BIOS looks for this information. In the boot sector a disk which is formatted with DOS, the information includes the root directory of that disk, the FAT (File Allocation Table) and other system-critical data.
After the boot sector is found and found to have the required information and read, the root directory of the disk is read for some particular files. You should keep in mind that we are restricting ourselves to DOS. Other operating systems may work in a different manner after accessing the boot sector.
What is file then? A file is a unit of storage from the users’ point of view. For the computer it is nothing more than a stream of bits or bytes residing in the RAM or the disk sector. For example, the document the document you are reading at the moment is a single computer file that was created in the word processor. Essentially, DOS searches for three files in the root directory of your disk. These are IO.SYS, MSDOS.SYS and COMMAND.COM. The first two of these files are system files and have the hidden attributes with them. That means these won’t be visible under normal circumstances. All of these are binary files. First of all IO.SYS is read which contains information DOS requires for the IO (input- output) of the computer. Then the MSDOS.SYS is read which contains information DOS requires to begin with its own existence and last of the three, COMMAND.COM is read. This file is a command file and is executable. That means it can also be run from the DOS command prompt. It is also called the DOS command line interpreter. Or using the terminology of the bigger operating system, we can also name it the DOS’ shell. A shell is a part of the operating system that interfaces with the user. Shell is linked to another part called the kernel. Kernel is the brain of the core of any operating system. A user working on an operating system does not talk to it directly. All the input from the user is received by the shell, is translated into the form that is understandable by the kernel, is then processed by the kernel and then retranslated into a form that is standard for the shell outbox and more user-friendly. This way the user communicates with any operating system.
When to control is given to the COMMAND.COM, it searches for two more files in the same location i.e. root directory. These files are CONFIG.SYS and AUTOEXEC.BAT,written in the same order they are processed. CONFIG.SYS is a system file, though ASCII in nature, which contains some special commands for DOS regarding its memory configuration. Memory configuration means how DOS would use the RAM for itself and other programs. The study of the subject is beyond the scope of this document.
AUTOEXEC.BAT is processed next. This file is also an ASCII file. It falls into the third category of executable files in DOS called a Batch File. All the Batch files like this one have the extension BAT. The other two types are the EXEcutable (extension .EXE) and the COMmand (extension .COM) files. All these files are handled in a far more different way. The name batch implies that they contain a collection of DOS commands in a single phase. These commands are run every time you boot your computer before the shell is provided to the user. So you should expect to get a shell when the COMMMAND.COM is run. Of course you get an interface with the DOS. What is like a black screen, 80 characters wide and 25 characters high, with something like C:> written on the left top corner of it, with a blinking cursor at the end of the above character. This is the most common and the default face of the DOS shell or the DOS Command Line Interpreter.
For advanced users, I should say it can be changed in some limits. Now what? Well if you are looking at it, it means DOS is now ready for your input. And your input is called a DOS command. A command is essentially the name of an executable file you type on the DOS command prompt and then press ENTER key. The file is then run by DOS and you say DOS is executing the command. But a command may be the name of a method or an executable content that is not stored in the form of a file on the disk, rather stored in the RAM when DOS loads itself at the time of boot. The former is called an External Command and the latter an internal command. The system is now ready for you.
Conduction Physics »