Boot Management & Process Management
Boot Management & Process Management
When we click the power button of our system, several processes are
executing in the background. It's very important to understand the
booting process to learn the working of an operating system. It's a must
to understand how the Linux kernel boots to resolve the booting error. It
is a very curious topic to know, so let's begin with the basics.
o The boot microcode or BIOS of the machine hundreds and executes
a boot loader.
o The boot loader catches the kernel image over the disk and ships it
into memory to begin the computer.
o The kernel boots the devices and drivers.
o The kernel mounts the common filesystem.
o The kernel begins a program called init with a zero method ID.
o Init configures the system processes remainder in motion.
o Init begins a method allowing us to log in for some purpose,
typically at the close or top to the head of the boot order.
Start-up Message
o CPU examination
o Device bus discovery
o Memory examination
o Devices discovery
o Root filesystem mount
o Auxiliary kernel system start-up
o Userspace begin
The CPU examination and memory examination are not so exceptional.
Although, when the kernel provokes devices, the dependencies question
comes. For instance, the disk device drivers may depend on the SCSI
system and bus support. We would not need to be worried about the
dependencies in general, except that a few essential parts are loadable
kernel modules rather than a part of almost all kernels.
Kernel Parameters
GRUB is an acronym for Grand Unified Boot Loader. One of the most
vital capabilities of GRUB is filesystem navigation that lets straightforward
configuration choice and kernel image.
o The GRUB code hundreds.
o The BIOS hundreds and runs it upon searching the boot code. Often,
it is wherever GRUB starts.
o The code initializes. Currently, GRUB will access filesystems and disks
at now.
o GRUB recognizes its boot partition and several configurations there.
o GRUB provides the user the opportunity to differentiate the
configuration.
o GRUB runs the configuration after a user action or timeout.
o In the course of configuration execution, GRUB may load further
code in the boot partition. Also, several modules are preloaded.
o To run and load the kernel, GRUB runs boot commands.
o BIOS
BIOS is an acronym for Basic Input/Output System. In other words,
the BIOS can load and run the MBR (Master Boot Record) boot
loader. When we first turn on our system, the BIOS first implements
a few integrity checks of the SSD or HDD.
After that, the BIOS finds, loads, and runs the boot loader function,
which can be detected in the MBR. Sometimes, the MBR is on a CD-
ROM or USB stick, like with a live Linux installation. Then, the boot
loader function is loaded into memory, and BIOS provides system
control to it once it is detected.
o MBR
MBR is an acronym for Master Boot Record and is liable to load and
run the GRUB boot loader. MBR is placed in the first bootable disk
sector, which is generally /dev/sda, relying on our hardware. Also,
the MBR includes details of GRUB, or LILO is an older system.
o GRUB
GRUB is sometimes known as GNU GRUB, which stands for GNU
GRand Unified Bootloader. It is the classic bootloader for almost
all the latest Linux systems. The splash screen of GRUB is often the
initial thing we see when we boot our system. It contains a general
menu where we can choose some portions.
We can use our keyboard to choose the one we wish our system to
initiate with if we have multiple installed kernel images. The latest
kernel image is chosen by default. The splash screen will delay for
some seconds for us to choose options. It will load the kernel image
(default) if we don't. In several systems, we can see the GRUB
configuration file at /etc/grub/conf or /boot/grub/grub.conf.
o Kernel
Often, the kernel is called the code of an operating system. It
contained full control on everything in our system. In this boot
process stage, the kernel mounts the base file system that was
chosen that is set up in the file, i.e., grub.conf. Then, it runs the
/sbin/init function, which is always the initial function to be run. We
can confirm it with its PID (process id), which should be always 1.
Then, the kernel creates a temporary base file system with the help
of initrd (Initial RAM Disk) until the actual file system is mounted.
o Init
At this stage, our system runs runlevel programs. It would find an
init file, generally detected at /etc/inittab, to determine the run level
of Linux. Modern Linux systems utilize systemd to select a run level
rather. Then, systemd will start running runlevel programs.
There are six run labels in the Linux operating system:
o 0- halt
o 1- single-user mode
o 2- multiuser, without NFS
o 3- Full multiuser mode
o 4- unused
o 5- X11
o 6- reboot
We can check the configuration default run level of our system by running
the following command:
1. $ grep initdefault /etc/inittab
o Runlevel programs
We can see distinct services getting started depending on which
distribution of Linux we have installed. They are called runlevel
programs and are run from distinct directories depending on our
run level. All six runlevels mentioned above contain its directories:
o Run level 0- /etc/rc0.d/
o Run level 1- /etc/rc1.d/
o Run level 2- /etc/rc2.d/
o Run level 3- /etc/rc3.d/
o Run level 4- /etc/rc4.d/
o Run level 5- /etc/rc5.d/
o Run level 6- /etc/rc6.d/
If we look in distinct run level directories, we will find programs that begin
with either a "K" or "S" for kill and startup, respectively. These start up
programs are run at the time of the system startup and kill several
programs at the time of shutdown.
Introduction to Process
Types of Processes
Foreground Processes
Foreground processes are the kinds of processes that require input from the user
and are characterized by their interactivity. For instance, a foreground process
would be like you are running an Office application on the Linux system.
Background Processes
• Running:
The process is currently executing on the CPU.
• Sleeping:
The process is waiting for a resource to become available.
• Stopped:
The process has been terminated by a user
• Zombie:
The process has completed execution but has not yet been cleaned by
the system.
• Orphan:
The parent process of the current process has been terminated.
Process management is the task of controlling and monitoring the processes that
are running on a Linux system. It involves managing process resources,
scheduling processes to run on the CPU, and terminating processes when
required.
Commands for Process Management in Linux
The ps command is used to find the process ID (PID) of the process you want to
manage. As instance, if it’s required to kill a process you need to know
the process ID (PID) of that exact process.
The kill command in Linux is used to terminate processes by their process IDs
(PIDs).
Conclusion