Booting in Operating System

Booting is the process of starting a computer. It can be initiated by hardware such as a button press or by a software command. After it is switched on, a CPU has no software in its main memory, so some processes must load software into memory before execution. This may be done by hardware or firmware in the CPU or by a separate processor in the computer system.

Restarting a computer also is called rebooting, which can be "hard", e.g., after electrical power to the CPU is switched from off to on, or "soft", where the power is not cut. On some systems, a soft boot may optionally clear RAM to zero. Hard and soft booting can be initiated by hardware such as a button press or a software command. Booting is complete when the operative runtime system, typically the operating system and some applications, is attained.

The process of returning a computer from a state of sleep does not involve booting; however, restoring it from a state of hibernation does. Minimally, some embedded systems do not require a noticeable boot sequence to begin functioning and, when turned on, may run operational programs that are stored in ROM. All computer systems are state machines and a reboot may be the only method to return to a designated zero-state from an unintended, locked state.

In addition to loading an operating system or stand-alone utility, the boot process can also load a storage dump program for diagnosing problems in an operating system.

Sequencing of Booting

Booting is a start-up sequence that starts the operating system of a computer when it is turned on. A boot sequence is the initial set of operations that the computer performs when it is switched on. Every computer has a boot sequence.

Booting in Operating System

1. Boot Loader: Computers powered by the central processing unit can only execute code found in the system's memory. Modern operating systems and application program code and data are stored on nonvolatile memories. When a computer is first powered on, it must initially rely only on the code and data stored in nonvolatile portions of the system's memory. The operating system is not really loaded at boot time, and the computer's hardware cannot perform many complex systems actions.

The program that starts the chain reaction that ends with the entire operating system being loaded is the boot loader or bootstrap loader. The boot loader's only job is to load other software for the operating system to start.

2. Boot Devices: The boot device is the device from which the operating system is loaded. A modern PC BIOS (Basic Input/Output System) supports booting from various devices. These include the local hard disk drive, optical drive, floppy drive, a network interface card, and a USB device. The BIOS will allow the user to configure a boot order. If the boot order is set to:

  • CD Drive
  • Hard Disk Drive
  • Network

The BIOS will try to boot from the CD drive first, and if that fails, then it will try to boot from the hard disk drive, and if that fails, then it will try to boot from the network, and if that fails, then it won't boot at all.

3. Boot Sequence: There is a standard boot sequence that all personal computers use. First, the CPU runs an instruction in memory for the BIOS. That instruction contains a jump instruction that transfers to the BIOS start-up program. This program runs a power-on self-test (POST) to check that devices the computer will rely on are functioning properly. Then, the BIOS goes through the configured boot sequence until it finds a bootable device. Once BIOS has found a bootable device, BIOS loads the bootsector and transfers execution to the boot sector. If the boot device is a hard drive, it will be a master boot record (MBR).

The MBR code checks the partition table for an active partition. If one is found, the MBR code loads that partition's boot sector and executes it. The boot sector is often operating system specific, and however, in most operating systems, its main function is to load and execute the operating system kernel, which continues start-up. Suppose there is no active partition, or the active partition's boot sector is invalid. In that case, the MBR may load a secondary boot loader which will select a partition and load its boot sector, which usually loads the corresponding operating system kernel.

Types of Booting

There are two types of booting in an operating system.

Booting in Operating System
  1. Cold Booting: When the computer starts for the first time or is in a shut-down state and switch on the power button to start the system, this type of process to start the computer is called cold booting. During cold booting, the system will read all the instructions from the ROM (BIOS) and the Operating System will be automatically get loaded into the system. This booting takes more time than Hot or Warm Booting.
  2. Warm Booting: Warm or Hot Booting process is when computer systems come to no response or hang state, and then the system is allowed to restart during on condition. It is also referred to as rebooting. There are many reasons for this state, and the only solution is to reboot the computer. Rebooting may be required when we install new software or hardware. The system requires a reboot to set software or hardware configuration changes, or sometimes systems may behave abnormally or may not respond properly. In such a case, the system has to be a force restart. Most commonly Ctrl+Alt+Del button is used to reboot the system. Else, in some systems, the external reset button may be available to reboot the system.

Booting Process in Operating System

When our computer is switched on, it can be started by hardware such as a button press, or by software command, a computer's central processing unit (CPU) has no software in its main memory, there is some process which must load software into main memory before it can be executed. Below are the six steps to describe the boot process in the operating system, such as:

Booting in Operating System

Step 1: Once the computer system is turned on, BIOS (Basic Input /Output System) performs a series of activities or functionality tests on programs stored in ROM, called on POST (Power-on Self Test) that checks to see whether peripherals in the system are in perfect order or not.

Step 2: After the BIOS is done with pre-boot activities or functionality test, it read bootable sequence from CMOS (Common Metal Oxide Semiconductor) and looks for master boot record in the first physical sector of the bootable disk as per boot device sequence specified in CMOS. For example, if the boot device sequence is:

  • Floppy Disk
  • Hard Disk
  • CDROM

Step 3: After this, the master boot record will search first in a floppy disk drive. If not found, then the hard disk drive will search for the master boot record. But if the master boot record is not even present on the hard disk, then the CDROM drive will search. If the system cannot read the master boot record from any of these sources, ROM displays "No Boot device found" and halted the system. On finding the master boot record from a particular bootable disk drive, the operating system loader, also called Bootstrap loader, is loaded from the boot sector of that bootable drive· into memory. A bootstrap loader is a special program that is present in the boot sector of a bootable drive.

Step 4: The bootstrap loader first loads the IO.SYS file. After this, MSDOS.SYS file is loaded, which is the core file of the DOS operating system.

Step 5: After this, MSDOS.SYS file searches to find Command Interpreter in CONFIG.SYS file, and when it finds, it loads into memory. If no Command Interpreter is specified in the CONFIG.SYS file, the COMMAND.COM file is loaded as the default Command Interpreter of the DOS operating system.

Step 6: The last file is to be loaded and executed is the AUTOEXEC.BAT file that contains a sequence of DOS commands. After this, the prompt is displayed. We can see the drive letter of bootable drive displayed on the computer system, which indicates that the operating system has been successfully on the system from that drive.

What is Dual Booting

When two operating systems are installed on the computer system, then it is called dual booting. Multiple operating systems can be installed on such a system. But to know which operating system is to boot, a boot loader that understands multiple file systems and multiple operating systems can occupy the boot space.

Booting in Operating System

Once loaded, it can boot one of the operating systems available on the disk. The disk can have multiple partitions, each containing a different type of operating system. When a computer system turns on, a boot manager program displays a menu, allowing the user to choose the operating system to use.