What is a Kernel?
The thing that most people forget is that computers are incredibly dumb. All they are doing is following instructions. It is only when those instructions are designed to perform a complicated task that computer seems to have some kind of ability but actually, all they are doing is repeating one instruction after another instruction and therefore they need software to do everything.
When you boot up your smartphone, what you see there is a launcher and some apps and maybe the web browser or some games, but a lot of things are going on inside the machine. For example, underneath the launcher, there is a bunch of android services including the Google play services below that there are things like Java Virtual Machine and below that there is a thing called Kernel (it is the real core of whatever is running in your smartphone).
Now every multi-tasking computer system uses a kernel, windows have a kernel, iOS has a kernel, and android has a kernel. Windows and Windows phones use NT kernel, OS10, and the iOS uses the Darwin kernel, and Android uses the Linux kernel.
These are not the only kernels that are available, there are just a whole plethora of kernels out there for us to try and play with. Some are proprietary and some are open source. The FreeBSD kernel, the Kentucky kernel, there is a free artsy kernel, there is a kernel from embed used in embedOS. Now everything from us wearable from an IOT device right up to a supercomputer uses a kernel. So what is a kernel?
Definition Of Kernel
Basically, the kernel is the thing that manages the CPU resources, the memory resources, and the processes on any computer. It also has device drivers in it, so when you want to do any networking that goes through the kernel, you want to use BlueTooth that goes through the kernel, you want to use the file system that goes through the kernel. It is the lowest layer above the CPU.
For example, When you start an app on an android phone, it is the kernel that starts the process for that app and enables the app to be loaded from the flash into the memory. If that app needs some memory it will be the kernel that will allocate it to it, if the wants to do some networking it will go through the kernel, if the app wants to go to the background to create a background service that is handled by the kernel. Eventually when the app closes that it all resources that we use will be tied up and collected by the kernel. It is really the center of everything that is going on on your smartphone.
Now, you can imagine how complicated kernels can be. It is doing a lot of essential work and there are some different ways in which kernels can be designed.
Types of Kernel
The main theories for kernel design that are used today are:
Linux is a monolithic kernel that means all of these services that are going on, all the drivers, all the stuff handling, memory all occur inside one program that occupies one memory space. A monolithic can be quite big and complicated. There are 15 million lines of code in the Linux kernel. In this code there is support for IBM mainframes, there is support for PCs, support for SPARC processors, ARM processors, there is a whole range of different device drivers. In, fact 70% of the 15 million lines of code are just device drivers.
When you build a Linux kernel you choose which bits you want, it has got a configuration program that allows you to tweak the way the operating system works.
With microkernel, the kernel itself is in a very small piece of memory space and then other things like device drivers and networking and file system drivers are running as user-level programs, the idea behind it is if one the drivers crash the kernel does not crash itself. If you want to use micro kernel then check out MINIX 3, it is a UNIX like operating system that uses microkernels.
Hybrid kernels are used in most commercial operating systems such as Microsoft Windows NT 3.1, NT 3.5, NT 3.51, NT 4.0, 2000, XP, Vista, 7, 8, 8.1 and 10. Apple Inc’s own macOS uses a hybrid kernel called XNU which is based upon code from OSF/1’s Mach kernel (OSFMK 7.3) and FreeBSD’s monolithic kernel. They 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.
A nanokernel delegates virtually all services – including even the most basic ones like interrupt controllers or the timer – to device drivers to make the kernel memory requirement even smaller than a traditional microkernel
Exokernels are a still-experimental approach to operating system design. They differ from the other types of kernels in that their functionality is limited to the protection and multiplexing of the raw hardware, providing no hardware abstractions on top of which to develop applications. This separation of hardware protection from hardware management enables application developers to determine how to make the most efficient use of the available hardware for each specific program.
Exokernels in themselves are extremely small. However, they are accompanied by library operating systems, providing application developers with the functionalities of a conventional operating system. A major advantage of exokernel-based systems is that they can incorporate multiple library operating systems, each exporting a different API, for example, one for high-level UI development and one for real-time control.
What is Custom Kernel?
As you can download the Linux software as it is open-source and you can also download Android, it is possible to build your own kernel and ROM which has your own kernel inside of it. There is a whole community of people that builds custom kernels for your smartphone. You use a custom kernel you need the root access and have to unlock the bootloader. You can go to a site like XDA and find a whole list of different kernels that are available for your smartphone, for example, the Franco Kernel, ElementalX, etc.
There are some pros and cons of using a custom kernel.
First of all, you need root access, and you need to have your bootloader unlocked and not everyone likes to do that.
There is always a question of trust and reliability of using a custom kernel.
==>Common disclaimer that comes with alternative kernels:
I am not responsible for bricked devices, dead SD cards, thermonuclear wars, or you getting fired because the alarm app failed.
Please do some research if you have any concerns about features included in this ROM before flashing it! You are choosing to make these modifications, and if you point the finger at me for messing up your device, I will laugh at you.
If you are prepared to go past all these problems, then you can get a kernel that is highly configurable, it even may have extra features that the standard stock kernel doesn’t have in it and you enjoy downloading different kernels, tweaking them, seeing how they operate with different CPU governors, different IO schedulers, different priorities for different things and you may get a better kernel than the stock kernel.
That’s all with kernels hope you enjoyed reading it!!!