Basic Linux operation


* Booting Sequence: (For any OS)

Always manufacturer provides computer with just BIOS on it (BIOS- Basic input output system). OS is installed on the computer. Booting is a process or set of operation that loads and hence starts the OD, starting it from the time when the user switches on the CPU button. Let us see the Booting sequence.



* Hardware doesn't know where the OS lies, so BIOS locates it through Bootloader.

* Function of BIOS is to power on the computer, start the hardware devices, then Bootloader. Bootloader or Bootstrap loader locates the Kernel, loads it into main memory and starts its execution.

* Kernel: OS kernel is part of OS that responds to system calls, interrupts and exceptions. OS as whole includes the Kernel and may include other related programs that provide services for applications.

* Kernel is a program. It has code and data like any other program. It is isolated from the processes. Just this small information is enough for now as Kernel is itself a big thing. We just remember this that Kernel is a program which cannot be changed in all OS platforms. Linux is exception(it is changeable in linux).

* Bootloader searches for Kernel and loads it. Further Kernel takes the control. But Bootloader locates kernel loads it in main memory and then starts its execution. Some bootloaders just locate the boot program which is complex and from Hard Disk and then it loads the kernel. This type of loading is called chain loading(carried in linux). The initial mentioned type of loading is called direct loading which usually happens in the Windows or DOS.

*Boot process occurrence:

* Reset event on CPU (power up, reboot) causes instruction register to be loaded with a predefined memory location. It contains a jump instruction that transfers execution to the location of the Bootstrap program.

* This program is form the ROM, since RAM is in unknown state at system startup. ROM is convenient as it needs no initialization and cannot be affected by virus.

* Tasks performed during booting:

* Power on self test is done after run diagnostics. This is process of checking if all the states are working. Then BIOS checks if all the Hardware devices are connected or not. If not then it gives the errors. (In embedded systems this is done by the JTAG).

* After this if all is well then BIOS initializes CPU registers, device controllers and contents of main memory after this it loads the OS.

* For Hard-drive on finding the bootdrive, i.e. BIOS it checks for boot recorder. This boot recorder has instructions of how to load bootloader. This boot recorder is known as MBR (Master boot recorder). MBR loads secondary bootloader e.g. LILO(Linux loader), GRUB(Grand unified bootloader) and NTLDR(NT Loader).

* Bootstrap code resides in ROM, this code execution is slower so its copied to RAM for faster execution.


   MBR is in the first sector pointed.

* After this Bootloader points Kernel then Kernel initialization starts. After Kernel initialization, a process called init is created.

* init runs startup scripts (shell scripts) to perform specific tasks, i.e. setting hostname, time zone etc. checking and mounting disks configuring Network interfaces. Starting up Daemons and Network services.

* Startup scripts run based on run levels:

0 - shutdown

1 - single user mode

2 - multiuser

3 - full multiuser.

4 - Unused

5 - XII

6 - Reboot

Daemon is a computer program that runs as a background process, rather than being under direct control of an interactive user.

*Linux is not unix. Its advantages are stable versions, free of cost, flexible, no viruses etc. Kernel is an OS program which controls resources of computer and form an interface between user and hardware. user doesn't interact directly with kernel. Shell is an interface between user and operating system eg. Bash, Sh etc.

Comments

Popular posts from this blog

Embedded systems and Microcontroller basics