BOOTSTRAPPING / BOOTING of an OPERATING SYSTEM




Computers are incredibly dumb, all they're doing is following instructions and perform complicated tasks; they seem to have some kind of ability but actually all they're doing is repeating one instruction after another and thus they need softwares to do everything.
Even just to boot up , it needs to have an initial program to run called bootstrap program.

Alternatively referred to as bootstrapping, bootloader, or boot program, a bootstrap loader resides in the computer's EPROM, ROM, or other non-volatile memory.
It is automatically executed by the processor when turning on the computer and in case changes need in bootstrap code then ROM CHIPS are changed eg: EEPROM(Electrically Erasable Programmable ROM). 
Here Advantages of ROM over RAM:
  • ROM can't be changed whereas RAM is highly volatile and static programs i.e bootstrap program must resides in ROM.
  • Rom is convenient as it needs no initialization and can't be affected by virus.
  •  

Why is booting required?


►Main memory provides a fast storage that can be accessed directly by the CPU. For a

program to be executed, it must in the main memory. OS is nothing but are instructions so to execute them we first need to load it into the main memory.

►Hardware doesn’t know where the operating system resides and how to load it.

►Need a special program to do this job called bootstrap program and process is called booting or bootloading.

eg: BIOS: BOOT INPUT  OUTPUT SYSTEM.


►Bootstrap loader locates the kernel, loads it into
main memory and starts its execution.

TASKS PERFORMED AT BOOTUP:


-->> BIOS:
  • POST (Power On Self Test) The Power On Self Test happens each time you turn your computer on. The POST first checks the bios and then tests the CMOS RAM. If there is no problems with this then POST continues to check the CPU, hardware devices such as the Video Card, the secondary storage devices such as the Hard Drive, Floppy Drives, Zip Drive or CD/DVD Drives.If some errors found then an error message is displayed on screen or a number of beeps are heard. These beeps are known as POST beep codes.
-->> Master Boot Record


  • On finding a bootable device, the BIOS loads and executes its boot sector/loader that resides in MBR(Master BOOT Record) on the computer hard drive also refered as master boot block, master partition boot sector, and sector 0.and is often not OS specific. 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.

  • If the POST is successful and no issues are found, the bootstrap loader will load the operating system for the computer into memory. The computer will then be able to quickly access, load, and run the operating system.
-->>init

init is the last step of the kernel boot sequence. It looks for the file /etc/inittab to see if there is an entry for initdefault. It is used to determine initial run-level of the system. A run-level is used to decide the initial state of the operating system.
Some of the run levels are:
Level



  • 0 –> System Halt
  • 1 –> Single user mode
  • 3 –> Full multiuser mode with network
  • 5 –> Full multiuser mode with network and X display manager
  • 6 –> Reboot


  • Secondary boot loaders
    ►If there is no active partition or the active partition's boot sector is invalid, the MBR may load a secondary boot loader and pass control to it and this secondary boot loader will select a partition (often via user input) and load its boot sector.

    ►Examples of secondary boot loaders

    GRUB – GRand Unified Bootloader

    LILO – LInux LOader
    NTLDR – NT Loader


    • Once the kernel( core of an os) is loaded and executing, it can start providing services to the system and its users called system daemons or system processes that run entire time the kernel is running.
    • when system is fully booted, it waits for some event or interrupt to occur either from hardware (sends singnal to CPU by the system bus) or software( system call)
    • when the CPU is interrupted ,it stops everthing what is doing and tranfers execution to a fixed location which contains the addresss where the service routine  for the interrupt is located.
    • after the completion of  execution the system switches back or resumes to its previous state. (Context switching).

    What is the effect on boot sector and boot loader when you install twoOS, for e.g. Windows and Linux in two separate partitions ?


    ► Suppose, you install Windows first. The default boot loader installed in
    MBR is NTLDR and contains information regarding the active partition
    of Windows. When you install Linux on this system, the installation
    prompts to overwrite a new secondary boot loader which identifies both
    Windows and Linux active partitions and therefore we get a choice of
    booting the desired OS when the system is started.

    In contrast, if Linux is installed first and then Windows, the
    Windows Installer overwrites the MBR with its own boot loader which
    doesn’ t recognize the Linux active partition. This creates a problem.
    The problem can be corrected by using a LiveCD or any bootable disc
    which can be used to reinstall a secondary boot loader which identifies
    both the OS and gives true choice.

    Comments

    1. good job
      who designed this ?

      ReplyDelete
      Replies
      1. hey!! thanks for reading and liking the content ...however this article is referred from few books

        Delete

    Post a Comment

    Popular posts from this blog

    NFS-Hard and Soft MOUNT ( JUST LINUX/UNIX THINGS )

    Which has better Network Security? HARDWARE V/S SOFTWARE Firewalls