wtf is a Linux kernel?

wtf is a Linux kernel?

Are you struggling to wrap your head around what a Linux Kernel is? Don't worry - you're not alone! Here's everything you need to know about Linux Kernel, the core of the popular Linux operating systems.

The Linux kernel was created by Linus Torvalds in 1991 as a free and open-source alternative to proprietary operating systems.

Initially, it was a simple operating system for personal computers, but over time, it has evolved into a highly scalable and versatile platform used by individuals, companies, and governments around the world.

what does it do?

The Linux kernel acts like a middleman between hardware and software, managing and allocating all the resources of your computer, such as the CPU, RAM, and other devices.

Football Sport GIF by ElevenSportsBE

This central component makes it incredibly easy for programmers to write and use other programs.

Imagine having to manually manage and allocate resources every time you wanted to write a program - talk about a hassle!

But with the Linux kernel, all of that is taken care of for you.

It provides a software layer that acts as the middle man, handling all the resource management and freeing up the programmer to focus on what's important - writing great code.

what are the tasks performed by the kernel?

process scheduling

Linux is a preemptive multitasking operating system.

  • multiple processes can simultaneously reside in memory and each may receive the use of the CPU. (multitasking)

  • the rules governing which processes receive use of the CPU and for how long are determined by the kernel process scheduler. (preemptive)

So, preemptive multitasking is a fancy way of saying that an operating system can run multiple tasks at the same time and switch between them as needed, allowing for more efficient use of the computer's resources.

memory management

Linux employs virtual memory management, a technique that has two main advantages.

  • processes are isolated from one another and the kernel, so, the process can't read or modify the memory of another process or the kernel.

  • only part of the process needs to be kept in memory, which allows more processes to be held in RAM simultaneously.

provision of file system

The kernel provides for the provisioning of a file system which allows access to the resources stored on the disk and makes them available to the user.

creation and termination of the process

The kernel can load a new program into memory, providing it with the required resources.

An instance of a running program is termed a process.

The kernel ensures that the resources it uses are freed after a process has completed execution.

access to devices

The kernel provides an interface that standardizes and simplifies access to components of a computer system, such as memory, storage, processors, and other hardware devices.

It serves as a bridge between software applications and hardware components, allowing hardware devices to be used without any knowledge of their inner workings.

The kernel allows for efficient, reliable, and secure communication between hardware and software components, making it easier for users to access and control these components.

networking

The kernel implements the physical layer, the data link layer, the network layer and the transport layer of the Transmission Control Protocol/Internet Protocol (TCP/IP) layered model.

Each of these layers is responsible for a different portion of the communication process.

The physical layer manages the transmission of raw data across physical media such as cables. The data link layer defines the method for physically addressing nodes, as well as controlling the flow of data transmission.

The network layer is responsible for organizing and routing data across multiple networks and hosts.

The transport layer enables processes to communicate directly with each other and manages the delivery of data from source to destination.

provision of system call API

Processes can request the kernel to perform various tasks using kernel entry points known as system calls.

These tasks can include managing files, creating and deleting processes, allocating memory, and other system operations.

System calls provide an interface between a process and the kernel, allowing user-level programs to interact with the operating system.

So in summary, the Linux kernel helps decide which things your computer should do at the same time, takes care of your computer's memory, helps you use your files, starts and stops programs, and talks to your computer's parts so they work together, helps you connect to the internet, and gives instructions to the programs you use.

All this makes sure your computer is happy and works well!

wait, what about Linux distributions?

The terms "Linux kernel" and "Linux distribution" are often used interchangeably, but they refer to two distinct components of a Linux operating system.

The Office What GIF

Think of the Linux kernel as the foundation of a house. It's the backbone of the operating system, managing resources like the CPU and RAM, and providing a connection between hardware and software.

Now, imagine building a whole house on top of that foundation. That's what a Linux distribution is!

It takes the Linux kernel and adds all the extra components that make it a complete and usable operating system, such as a graphical user interface, text editor, and more.

A Linux distribution is what an end-user interacts with, and it is what gives a Linux operating system its unique features and capabilities.

One of the key factors in the success of the Linux kernel is its open-source nature, which allows developers to freely access, modify, and distribute the source code.

This has led to the creation of many different distributions, or "distros," each with its unique features and applications.

So, to sum it up - the Linux kernel is the foundation, while a Linux distribution is the complete house built on top of that foundation.

conclusion

So there you have it - the Linux kernel is a crucial component that not only increases the power and flexibility available to programmers but also leads to a more stable and efficient system.

Who would have thought that such a small piece of software could have such a big impact?

Me Too Help GIF by nounish ⌐◨-◨

In summary, the Linux kernel is a remarkable success story and a testament to the power of open-source development.

sources

Kerrisk, M. (2018) “Chapter 2,” in The linux programming interface a linux und UNIX system programming handbook. San Francisco, CA: No Starch Press, pp. 21–24.