The Linux kernel is a program that sits between the hardware and the processes and manages resource allocation (e.g. CPU access) and device drivers (e.g. printers)—among other things.
The kernel’s tasks are challenging and performance is critical because anything you do with your computer will be impacted by performance issues. This is why Linux (and Windows) rely on (one of) the fastest programming language C.
This StackOverflow answer gives some information about why C is THAT fast: (source)
“There is a trade off the C designers have made. That’s to say, they made the decision to put speed above safety. C won’t
- Check array index bounds
- Check for uninitialized variable values
- Check for memory leaks
- Check for null pointer dereference”
Because C does not have a garbage collector or other things that make the lives of developers easier, it’s also quite minimalistic. You can do a lot of things wrong. But you can also use the whole spectrum of optimizations. With more freedom comes greater responsibility.
Can I check out the Android OS code?
If you are interested in how the Android system is implemented, you can dive into Google’s Android Git repository.