Hello there, my name is Gary Sims from Android Authority. Now, hang around Android long enough, hang around PCs long enough, and you might come across this term, the Linux kernel. Well, what is the Linux kernel?
Why is it important? Where did it come from? Well, let me explain.
The thing that most people forget, in fact, is that computers are incredibly dumb. All they're doing is following instructions. And it's only when those instructions are actually designed to perform a complicated task that computers seem to have some kind of ability.
But actually, all they're doing is repeating one instruction after another instruction ad infinitum. And therefore, they need software to do everything. Even just to boot up, they need to be able to run some software.
Now, when you boot up your Android smartphone, you're used to seeing a launcher and some apps. and maybe the web browser, some games, but there's lots going on underneath the bonnet. For example, underneath the launcher, there is a bunch of Android services, including the Google Play services. Below that, there is things like the Java virtual machine. And below that, there is a thing called a kernel.
It really is the core of what's going on. Now, every multitasking computer system uses a kernel. Windows has a kernel.
OS X has a kernel, iOS has a kernel, and Android has a kernel. Now Windows and Windows Phone, Windows Mobile use a thing called the NT kernel. OS X and iOS use a thing called the Darwin kernel. And Android uses the Linux kernel.
Now these aren't 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. some are open source.
There's the FreeBSD kernel, there's the Contiki kernel, there's the FreeRTOS kernel, there's the kernel from Embed, from EmbedOS that recently released by ARM. There are just so many different types of kernel. Now everything from a wearable, from an IoT device, right up to a supercomputer uses a kernel.
So what is it? Well 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.
When you want to talk to Bluetooth, that goes through the kernel. When you want to use the file system, that goes through the kernel. It really is the lowest layer above the CPU. So for example, on Android, when you start an app, it is in fact the kernel that starts the process for that app and enables the app to be loaded from the flash.
into memory. If that app then needs some memory, it will be the kernel that will allocate it to it. If the app wants to do some networking, it will go through the kernel. If the app wants to do something in the background, create a background service, that's handled by the kernel. Eventually, when the app closes, all the resources that were used will be tied up and collected up by the kernel.
It really is the center of everything that's going on on your smartphone. Now as you can imagine, kernels can be quite complicated. They're doing a lot of essential work. And there are actually some different ways in which kernels can be designed. Now the two main theories today for kernel design are what's called a monolithic kernel and a microkernel.
Now Linux is a monolithic kernel. That means that 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. Now the alternative is a thing called microkernels.
And with microkernels, the kernel itself is in a very, 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. And the kernel talks to them saying, hey, do this, hey, do that for me, please go and get this file, go and get that. And they talk to the kernel. The idea being that if one of those crashes, the kernel itself doesn't crash.
Now, back in 1992, a man called Professor Andrew Tannenbaum, who is very, very famous for his operating system design books and his networking books. If you ever do any studying at university or at higher education about computer science, you will definitely come across an Andrew Tannenbaum book. He had a conversation with Linus Torvalds online, some call it a flame war, about the merits of monolithic kernels versus microkernels.
And of course, what happened is that Linus was writing a monolithic kernel and that's how he stayed doing it. And the monolithic kernel is what we have today. if you are at all interested in micro kernels then go and check out minix 3 it's andrew tannenbaum's unix-like operating system that uses micro kernels now as you can imagine the linux kernel being a monolithic kernel can be quite big and complicated in fact they say there are 15 million lines of code in the Linux kernel. Now not all of that code is used all at once because in there there is support for IBM mainframes, there's support for PCs, there's support for Spark processors, there's support for ARM processors, there's a whole range of different device drivers in there.
In fact they say that 70% of that 15 million lines of code is just device drivers. Now when you build the Linux kernel you say which bits you want. It's got a configuration program, I want this, I don't want that, I want this, I don't want that.
but you can do more than just say what you want included and what you want excluded you can also tweak the way the operating system works and that makes sense because if you're running linux on a mainframe you might want it to behave differently than if you're running it on a wearable if you're running it on a database server you might want to do think differently than if you're running it on a smartphone and this is where we get into the idea of custom kernels because you can download the linux software it opens source under the gpl because you can download android it's very possible to build your own kernel build your own rom which has the your own kernel included inside of it and of course there is a whole community of people that build custom kernels just for your smartphones now a quick word of warning to do that you're going to need root access and you're going to probably need an unlocked bootloader and if you go to a site like xda and there are many others you can find a whole list of different kernels that are available alternative kernels that are available for your smartphone and there are some famous ones including the franco kernel elemental x and so on now there are some pros and there are some cons to using custom kernels first of all you need to have root first of all you need to have your bootloader unlocked and some people don't like to do that it's not in everybody's skill set to do that also you need to recognize that you're using a kernel made by some guy somewhere in the world and there is a question of trust and there are a question of how reliable he is if you start to get problems will he answer your questions will he issue a new version of the kernel there's also the danger that you can break your phone but if you're prepared to go past all of those problems of course you can find you can get a kernel that is highly configurable it even may have extra features built into it it's got extra things that the standard stock kernel doesn't have in it and you may enjoy downloading new kernels tweaking them seeing how they operate with different cpu governors different i o schedulers different priorities for different things and you might say this kernel is better than the stock kernel now as i've said before a lot of this information is anecdotal people say i got more battery life i got better performance and they probably did but remember that companies like samsung and google and lg and sony are spending millions and millions of dollars developing smartphones and if they could get better battery life or better performance just by tweaking a little thing in software you can guarantee they certainly would. Of course you can get better performance but you get less battery life. You can get better battery life but it means you have to run your processor at a slower speed and of course the OEM Samsung, Google, LG and so on are trying to find that happy medium where you get good battery life and yet good performance. And so as a summary, the kernel is really the lowest level of any operating system. It is responsible for the CPU resources, the memory resources, for the file system, for the drivers, for the networking.
It really is the lowest piece of software that comes just above the hardware. Now, Android uses the Linux kernel, which is an open source kernel. Android itself is open source, and all of this software can be downloaded, and you can build custom ROMs separately, or together, a custom kernel.
Now, the kernel can tweak different parameters about how the scheduling occurs, how the I.O. scheduling occurs. how the CPU is controlled.
And those things can be tweaked and put into a custom kernel. You can download that custom kernel onto your phone as long as you have root access and as long as you have your bootloader unlocked. However, how much you benefit you get out of that custom kernel will depend on your usage patterns. My name's Gary Sims from Android Authority and I hope you enjoyed this video. If you did, please do give it a thumbs up.
Also, please use this link here to connect with me over at the Android Authority forums. If you want to talk about kernel technology, then please come over and let's have a chat. Now, I'm probably not going to tell you about how to flash a particular kernel onto a particular handset, but if you're interested in the kernel in general and the technologies around kernels, then come over and let's have a little chat together. Also, please don't forget to subscribe to Android Authority's YouTube channel. You can follow me on Twitter, but most importantly, stay tuned to androidauthority.com because we are your source for all things.