In this lesson,
you're going to explore some key concepts
and components that make up the Linux kernel
that you need to be able to troubleshoot
and provide solution to, as you work through the system.
Now there's some aspects of Linux that are consistent
but those are typically handled by the kernel.
Now, the kernel is the core of the Linux operating system
and it handles various crucial functions,
such as, the system initialization, process scheduling
and memory and hardware management.
The core of the operating system is called the kernel,
like I just said,
and all the other components are going to rely upon it.
The kernel manages, file system access, it's memory,
its processes, its devices
and the other resource allocation on the system.
The kernel also controls all the hardware devices
that are plugged into a given system.
It is one of the first elements to be loaded up on startup
and it remains the main thing in memory
during your computer's operation.
The kernel also contains system level commands
and other functions that are normally hidden from users.
Now kernel's tend to divide software,
that's running in memory into two spaces.
Namely, the kernel space and the user space.
The kernel space is simply where the kernel
executes the services that it provides.
The user space, on the other hand, is the area of memory
that includes everything outside of the kernel space.
This can include everything from high level applications
that the users interacting with directly, to processes
that are running in the background,
to various low level system libraries.
The split between these two memory regions is useful
because it provides greater stability
and security for our system.
Software in one space cannot necessarily interfere
with software in the other space.
Now kernels can be classified as monolithic
or microkernels.
In a monolithic kernel all system modules,
such as device drivers or file systems run inside
the kernel space.
As a result, a monolithic kernel can interact quickly
with all the different devices.
However, its main disadvantage is its size,
which tends to lead to higher consumption of Ram.
In addition, a failure and a device driver can actually
lead to system instability if you're using
a monolithic kernel.
So, instead a lot of people like to use
a microkernel architecture.
Now when you're using a microkernel architecture,
the kernel itself runs the minimum amount of resources
that are necessary to actually implement
a fully functional operating system.
Compared to a monolithic kernel,
microkernels have smaller kernel spaces
and instead have much larger user spaces.
This means that microkernels are smaller and overised size
and they actually consume much less memory.
In addition, they're actually considered much more stable
and secure.
However, microkernels also tend to offer worse performance
than a monolithic kernel because there's a lot more
switching of things into or out of memory.
The next thing we need to talk about is device drivers.
Essentially, when we talk about
a Linux Kernel device driver, this is a software program
that enables a computer's operating system to identify
the characteristics and functions of a given hardware device
to be able to communicate with it
and control its operations.
The device driver acts as an interface
between the operating system and the hardware devices.
This can include things like, your storage drives,
your printers, your scanners, your monitors, your keyboards
and your network devices.
Device drivers can be included in the operating system
or you can install them on demand afterwards.
Now, when we talk about the Linux kernel, it's important
to remember it's a free and open source monolithic kernel
in general and it manages all the resources
on the operating system.
As a monolithic kernel, device drivers run within
the kernel space and they have full access to the hardware.
The architecture of the Linux Kernel, does provide
for many useful features, including,
virtual memory management,
support for TCP/IP networking, shared libraries
and much more.
Another important quality of the Linux Kernel
is its modularity.
This enables users to configure and extend kernel
functionality to meet their specific needs.
Now there are a lot of changes and new features
merged into the Linux Kernel.
For versions 2.6.39 and prior,
the kernel number format was w.x.y.z.
Where "W" is the major version, such as, version 2.
"X" was the major revision version, such as, 2.6.
"Y' is the minor revision number, 2.6.39
and "Z" is the patch number.
But after version 2.6.39 they actually decided
to shorten the version number format.
And so the next version was version 3.0 after 3.19
rather than going to 3.20, they jumped up to 4.0
and this was for readability purposes,
not due to any real major technical advances
like we used to have with major versions.
Newer versions of the kernel will continue this trend
of avoiding large minor numbers with multiple decimals
like 2.6.39.2 and instead using something like 3.20 or 4.0.
So, how can you figure out what kernel you're running?
Well to do that you use a command known as, uname.
By default, uname will print the name of the kernel Linux
but you can also view the kernel version of the number
to the system you're using by typing in uname-r.
If you enter uname-i, you can view the hardware platform
and to print all the information on the system.
Type in uname-a at the command prompt.
Now going back to our kernel, remember that our kernel
performs various functions to control and manage
the operations of a system.
It's going to be composed of several layers that operate
in the kernel space.
We call this the SCI kernel layer, and this is,
the System Call Interface kernel layer.
It's going to handle the system calls, sent from user
applications that need to go to the kernel.
This enables the user space applications to request services
from the kernel space, things like processing time
and memory allocation and enables the kernel to schedule
and process system calls
and manage multiple system calls simultaneously.
The process management kernel layer,
handles different processes by allocating
separate execution space on the processor
and ensuring that the running of one process
does not interfere with the other processes.
Our memory management kernel layer is going to manage
the computer's memory, which is one of the most
complex tasks that's performed by the kernel.
Just like processor sharing,
the system's memory also needs to be shared
among different user space resources.
The file system management kernel layer,
is going to manage the file system.
This involves storing, organizing and tracking files
and data on a given computer.
The kernel also supports a virtual file system
or VFS that provides this abstraction layer
of the underlying data that's being organized
under complex structures.
So it appears to be a single structure.
The device management kernel layer is going to manage devices
by controlling device access
and interfacing between user applications
and hardware devices on the computer.
When a user space application sends a system call
the kernel is going to read the request and then pass it on
to the drivers that manage the activities
of that particular device.
As you can see,
the kernel really is at the center of everything
and it's where we're going to do all of
the major device handling and processing for our systems.