2. In broad terms, an OS kernel performs
three primary jobs.
1.It provides the interfaces needed for
users and applications to interact with the
computer.
2.It launches and manages applications.
3.It manages the underlying system
hardware devices.
WHAT IS THE PURPOSE OF THE
KERNEL?
3. As Linux alone is just a kernel, it is worth discussing the major
differences between the Linux Kernel and Unix kernel.
There are three types of the kernel :
1. monolithic
2. micro and hybrid (combination of monolithic and micro) The main
difference between these types is the number of address spaces
they support.
Address space is the amount of memory allocated for all possible addresses for a
computations.
4. A microkernel delegates user processes and services and
kernel services in different address spaces.
A monolithic kernel implements services in the same address
space.
A hybrid kernel, such as the Microsoft Windows and Apple
kernels, attempts to combine the behaviors and benefits of
microkernel and monolithic kernel architectures.
5. Microkernels
Microkernels have all of their services in the kernel address space. For
their communication protocol, microkernels use message (system calls)
passing, which sends data packets, signals and functions to the correct
processes. Microkernels also provide greater flexibility than monolithic
kernels; to add a new service, admins modify the user address space for
a microkernel.
Because of their isolated nature, microkernels are more secure than
monolithic kernels. They remain unaffected if one service within the
address space fails.
6. Monolithic kernels
Monolithic kernels are larger than microkernels, because they house
both kernel and user services in the same address space. Monolithic
kernels use a faster system call communication protocol than
microkernels to execute processes between the hardware and software.
They are less flexible than microkernels and require more work; admins
must reconstruct the entire kernel to support a new service.
7. Monolithic kernels pose a greater security risk to systems than
microkernels because, if a service fails, then the entire system shuts
down. Monolithic kernels also don't require as much source code as a
microkernel, which means they are less susceptible to bugs and need
less debugging.
8.
9. LINUXVS UNIX KERNEL (CONT.)
Features Linux Kernel Unix Kernel
Kernel approach Linux follows the monolithic kernel
approach.
Unix kernel can be monolithic,
microkernel or hybrid.
For Example, macOS has a hybrid
kernel, Solaris has the monolithic
kernel, and AIX has a monolithic
kernel with dynamically loadable
modules.
Adding/removing features of the
kernel
Provides a great feature through
which the kernel components like
device drives can be dynamically
added and removed as modules.
This feature is called as loadable
kernel modules (LDM). This
eliminates the need to compile the
whole kernel again. This feature in
turn gives great flexibility to Linux.
Traditional Unix systems kernel
need static linking of new systems
being added.
10. LINUXVS UNIX KERNEL (CONT.)
Features Linux Kernel Unix Kernel
Preemptive vs non-
preemptive
approach
Normally a Linux kernel is non-preemptive.
However, in recent times, Linux real-time OS
has started using preemptive kernels.
Some Unix systems are fully
preemptive.
For example, Solaris 2.x. etc.
Kernel threading Linux uses kernel thread just for running
some kernel code periodically.
Many Unix-like operating systems use
kernel thread for the purpose of
process context switching.
Ways to handle the
multi-threaded
environment
Through multi-threading, more than one
independent execution flows which are called
lightweight processes (LWP) are created.
In Linux, LWP is created by calling clone ()
function. These processes in Linux can share
physical memory, opened files, address
space, etc.
In Unix, the LWP is based on kernel
threads.
Preemptive scheduling allows a process to be interrupted in the midst of its execution, taking the CPU
away and allocating it to another process. Non-preemptive scheduling ensures that a process
relinquishes control of the CPU only when it finishes with its current CPU burst.