Documente Academic
Documente Profesional
Documente Cultură
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
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
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://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).