Sunteți pe pagina 1din 3

Kernels

Prashant Sonkamble, Shashank Gupta


TYCS 34 Bhavans College
TYCS 10 Bhavans College
prashant_sonkamble@outlook.com
shashankksgupta@gmail.com

Keywords- Kernel, Monolithic, Micro, Hybrid, Scheduling,


Process, Linux, States.

INTRODUCTION
This document is a written representation of what
kernels are and how they work in the Linux
Operating System

I.KERNEL
The kernel is the central module of an operating
system (OS). It is the part of the operating system
that loads first, and it remains in main memory.
Because it stays in memory, it is important for the
kernel to be as small as possible while still providing
all the essential services required by other parts of the
operating system and applications. The kernel code is
usually loaded into a protected area of memory to
prevent it from being overwritten by programs or
other parts of the operating system.
Typically, the kernel is responsible for memory
management, process and task management, and disk
management. The kernel connects the system
hardware to the application software. Every operating
system has a kernel. For example, the Linux kernel is
used numerous operating systems including Linux,
FreeBSD, Android and others.

A. Monolithic kernels
In a monolithic kernel, all OS services run along
with the main kernel thread, thus also residing in the
same memory area. This approach provides rich and
powerful hardware access. Some developers, such as

UNIX developer Ken Thompson, maintain that it is


"easier to implement a monolithic kernel" than
microkernels. The main disadvantages of monolithic
kernels are the dependencies between system
components a bug in a device driver might crash
the entire system and the fact that large kernels can
become very difficult to maintain.
B. Microkernels
Microkernel (also abbreviated K or uK) is the
term describing an approach to Operating System
design by which the functionality of the system is
moved out of the traditional "kernel", into a set of
"servers" that communicate through a "minimal"
kernel, leaving as little as possible in "system space"
and as much as possible in "user space". A
microkernel that is designed for a specific platform or
device is only ever going to have what it needs to
operate.
The microkernel approach consists of defining a
simple abstraction over the hardware, with a set of
primitives or system calls to implement minimal OS
services such as memory management, multitasking,
and inter-process communication. Other services,
including those normally provided by the kernel,
such as networking, are implemented in user-space
programs and referred to as servers. Microkernels are
easier to maintain than monolithic kernels, but the
large number of system calls and context switches
might slow down the system because they typically
generate more overhead than plain function calls.
C. Hybrid kernels
Hybrid kernels are similar to micro kernels, except
they include some additional code in kernel-space to
increase performance. These kernels represent a
compromise that was implemented by some
developers before it was demonstrated that pure
micro kernels can provide high performance. These
types of kernels are extensions of micro kernels with
some properties of monolithic kernels. Unlike
monolithic kernels, these types of kernels are unable
to load modules at runtime on their own. Hybrid
kernels are micro kernels that have some "non-

essential" code in kernel-space in order for the code


to run more quickly than it would were it to be in
user-space. Hybrid kernels are a compromise
between the monolithic and microkernel designs.
This implies running some services (such as the
network stack or the file system) in kernel space to
reduce the performance overhead of a traditional
microkernel, but still running kernel code (such as
device drivers) as servers in user space.

E. Linux Kernel Architecture

D. Monolithic Kernel Vs Microkernel

User Space
The User Space is the space in memory where user
processes run. The system prevents one process from
interfering with another process. Only Kernel
processes can access a user process.
Kernel Space
The kernel Space is the space in memory. The user
has access to it only through the system call.
F. Figure Captions

II.

LINUX KERNEL

The Linux kernel is a Unix-like computer


operating system kernel. The Linux operating system
is based on it and deployed on both traditional
computer systems such as personal computers and
servers, usually in the form of Linux distribution. The
Android operating system for tablet computers,
smartphones and smart-watches is also based atop the
Linux kernel.
The Linux kernel was conceived and created in
1991 by Linus Torvalds for his personal computer
and with no cross-platform intentions, but has since
expanded to support a huge array of computer
architectures, many more than other operating
systems or kernels. Linux rapidly attracted
developers and users who adapted code from other
free software projects for use with the new operating
system. The Linux kernel has received contributions
from nearly 12,000 programmers from more than
1,200 companies, including some of the largest
software and hardware vendors.

Running
The process is either running or it is ready to run.
Waiting
The process is waiting for an event or for a
resource.
Stopped
The process has been stopped, usually by receiving
a signal.
Zombie
This is a halted process which, for some reason,
still has a task_struct data structure in the process
table
G. Process Structure
Each process is represented by a task_struct data
structure. It contains the specifications of each
process such as:
State

Scheduling information
Identifier. Etc.
H. Process Scheduling
O (n) Scheduling
When looking for a new process to run on the
CPU, the kernel has to consider only the runnable
processes.
This algorithm used was quite simple and straight
forward, the scheduler divides time into epochs, and
within each epoch, every task was allowed to execute
up to its time slice.
If a task did not use all of its time slice, then half of
the remaining time slice was added to the new time
slice to allow it to execute longer in the next epoch.
It iterates the queue assigning a goodness value to the
tasks.
Main drawback is that it spends most of its time
scanning the queue selecting the best process to
execute from the runnable queue
Completely Fair Scheduler (CFS)
The Completely Fair Scheduler (CFS) is a process
scheduler which was merged into the 2.6.23 release
of the Linux kernel and is the default scheduler. It
handles CPU resource allocation for executing
processes, and aims to maximize overall CPU
utilization while also maximizing interactive
performance.
The CFS algorithm is based on the idea of an ideal
multi-tasking processor. Such a processor would run
all currently active tasks literally at the same time
while each task gets a portion of its processing
power.
Since it is physically not possible to drive current
processors in that way and it is highly inefficient to
run for very short times due to switching cost, CFS
tries to approximate this behaviour as closely as
possible.
It keeps track of the runtime of each runnable task,
called virtual runtime, and tries to maintain an overall
balance between all runnable tasks at all times.
I. References.

https://youtu.be/7HatJ1t-iQQ?t=21 (Martino Jones).

https://en.wikipedia.org/wiki/Kernel_(operating_sys
tem)#Monolithic_kernels (Wikipedia.com).

https://en.wikipedia.org/wiki/Kernel_(operating_sys
tem)#Microkernels (Wikipedia.com)

https://en.wikipedia.org/wiki/Kernel_(operating_sys
tem)#Hybrid_.28or_modular.29_kernels
(Wikipedia.com)

http://www.slideshare.net/jserv/f9-microkernel
(Slideshare.com).

https://en.wikipedia.org/wiki/Linux_kernel
(Wikipedia.com).

http://flylib.com/books/en/3.475.1.15/1/ (flylib.com).

https://en.wikipedia.org/wiki/O(n)_scheduler
(Wikipedia.com).

S-ar putea să vă placă și