You are on page 1of 23

KERNEL

Kernel
• The kernel is the central module of an operating sys
tem (OS). It is the part of the operating system that
loads first, and it remains in main memory.
Kernel and its importance
• Whenever the system is turned ON, the Operating s
ystem is the first to be loaded into the system, and t
he Kernel is the first program among all the Progra
ms of the OS to get loaded into the main memory, a
nd then the rest programs of the Operating System
are loaded. A system cannot function without the O
perating System, and an Operating System cannot e
xist without the Kernel. Therefore, every Operating
System has a Kernel.
Kernel vs OS
• The kernel is not an operating system (OS); it is a ce
ntral module of operating system. It is the first prog
ram that loaded into protected memory area durin
g the booting process. It remains present in memor
y till the system power is on.
BASIS FOR COMPARISON KERNEL OPERATING SYSTEM

Basic Kernel is an important Operating System is a


part of the operating system program.
system.

Interface Kernel is an interface Operating System is an


between software and interface between user
hardware of the and hardware of the
computer. computer.

Type Monolithic kernels and Single and


Microkernels. Multiprogramming
batch system,
Distributed operating
system, Realtime
operating system.

Purpose Kernel memory In addition to the


management, process responsibilities of
management, task Kernel, Operating
management, disk System is responsible
management. for protection and
security of the
computer.
Types of kernels

A Kernel is classified into two main types:


• Monolithic Kernel
• Micro Kernel
• Hybrid Kernel
System/privilege / supervis
or mode
• A mode bit decides what mode is choosen
• 0 indicates kernel mode
• 1 indicates user mode
• The system starts in supervisor mode when it boots
. This allows various programs complete access to t
he system hardware such as bootloader, BIOS, oper
ating system etc.The operating system selects super
visor mode for the low level tasks that require com
plete access to the system hardware.
User mode
• The less privileged mode
• User programs will execute in this mode.
System call
• A system call is the programmatic way in which a co
mputer program requests a service from the kernel
of the operating system it is executed on. A system
call is a way for programs to interact with the opera
ting system. A computer program makes a system c
all when it makes a request to the operating syste
m’s kernel. System calls are the only entry points int
o the kernel system. All programs needing resource
s must use system calls.
System Call to change the mode bit

• When a user makes a system call to an OS, the mod


e bit is set from 1 to 0. Here 1 to 0 means that after
a system call, the system mode is changed from the
User mode to the Kernal mode.
• When we ON the computer, the system is in kernel
mode. When we run the user application, the syste
m is in user mode.
• In the case of hardware and software-generated int
errupts, the system changes its state from user mod
e to the kernel mode.
Shell
Shell is the interface that allows the users to commu
nicate with the kernel.
What's a "Terminal?"
• It's a program called a terminal emulator. This is a p
rogram that opens a window and lets you interact
with the shell. There are a bunch of different termin
al emulators you can use. Most Linux distributions s
upply several, such as: gnome-terminal, konsole, xt
erm, rxvt, kvt, nxterm, and eterm.
BIOS
• BIOS stands for Basic Input/Output System
• Performs some system integrity checks
• Searches, loads, and executes the boot loader program.
• It looks for boot loader in floppy, cd-rom, or hard drive. You
can press a key (typically F12 of F2, but it depends on your s
ystem) during the BIOS startup to change the boot sequenc
e.
• Once the boot loader program is detected and loaded into t
he memory, BIOS gives the control to it.
• So, in simple terms BIOS loads and executes the MBR boot l
oader.
MBR
• The GRUB (Grand Unified Bootloader) is a bootloader availa
ble from the GNU project. A bootloader is very important as
it is impossible to start an operating system without it. It is t
he first program which starts when the program is switched
on. The bootloader transfers the control to the operating sys
tem kernel.
• The operating system or kernel is loaded into the memory b
y the secondary boot loader.
• The Master Boot Record (MBR) is the information in the first
sector of any hard disk or diskette that identifies how and w
here an operating system is located so that it can be boot (lo
aded) into the computer's main storage or random access m
emory.
• MBR directly cannot load the kernel as it is unaware
of the filesystem concept and requires a boot loade
r with file system driver for each supported file syst
ems, so that they can be understood and accessed
by the boot loader itself.
• Loads a GUI interface i.e. splash image located at /g
rub/splash.xpm.gz with list of available kernels whe
re you can manually select the kernel or else after t
he default timeout value the selected kernel will bo
ot
GRUB
• GRUB stands for Grand Unified Bootloader.
• If you have multiple kernel images installed on your syste
m, you can choose which one to be executed.
• GRUB displays a splash screen, waits for few seconds, if y
ou don’t enter anything, it loads the default kernel image
as specified in the grub configuration file.
• GRUB has the knowledge of the filesystem (the older Linu
x loader LILO didn’t understand filesystem).
• Grub configuration file is /boot/grub/grub.conf (/etc/grub
.conf is a link to this). The following is sample grub.conf of
CentOS.
Kernel
• Mounts the root file system as specified in the “root=” in gr
ub.conf
• Kernel executes the /sbin/init program
• Since init was the 1st program to be executed by Linux Ker
nel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’
and check the pid.
• initrd stands for Initial RAM Disk.
• initrd is used by kernel as temporary root file system until k
ernel is booted and the real root file system is mounted. It
also contains necessary drivers compiled inside, which help
s it to access the hard drive partitions, and other hardware.

You might also like