What is Linux and how it works Explained

This tutorial explains what the Linux operating system is and how it works in detail. Learn what Linux is used for, along with the features and benefits of Linux.

A computer system is an electronic machine that understands, processes, and stores all information in electronic format. It does not understand human language. To use a computer system, we need an operating system.

An operating system is a software program that understands both languages. It works as a translator between the user and computer hardware. It takes instructions from the user in human language and converts them into electronic format before executing them on computer hardware. Since computer hardware receives instructions in electronic format, it processes them and returns the output in electronic format to the operating system. The operating system converts the output into human language and displays it to the user. This way, a user always gives instructions and receives output in human language while the computer hardware always receives instructions and returns the output in electronic format.

Linux is an open-source operating system. Open-source means, the source code that is used to create the operating system is freely available for all. Anyone can view, modify, and redistribute it. If you are a developer, you can view and use the source code of any existing Linux distribution to make your own Linux distribution. You can also sell support services for your distribution under your brand name.

How does Linux work?

The easiest way to understand how Linux works is to understand it through the abstraction method. In this method, instead of focusing on the entire object at once, we focus on a small part of the object.

By using the abstraction method, we can divide the Linux into three layers. These layers are the User process, Kernel, and hardware. A layer or level is a categorization or classification of components according to where they work between the user and hardware.

A component is an application or software program or a device that provides particular functionality. Based on what the component does and where it works in the operating system, many terms can be used to refer to the component such as a subsystem, module, or a package.

A component has a tremendous number of technical details in its internal structure. Usually, you never need to learn the internal makeup of a component. You can ignore the technical detail of a component and concentrate on what the component does in relation to the whole operating system.

The following image shows all three layers and the important components of each layer.

layers of linux


The hardware is the first layer. It is the base layer of any operating system. Essential hardware components are the CPUs, RAM, Motherboard, Hard disk, and NICs. From all hardware components, RAM is the most important and highly used component.

The RAM is also known as the main memory or primary memory. When we start an operating system, the boot process loads the operating system into the RAM. Till the system is not shut down or powered-off, the operating works from the RAM. After booting, all input and output from peripheral devices and running processes flow through the RAM.

The CPU is an operator on memory that reads its instructions and data from the memory, performs computation, and writes data back to the memory. The motherboard provides a base for all hardware components. All hardware components connect through the motherboard. The hard disk stores data permanently. Application software and operating system are also installed on the hard disk. Depending on the requirement, a single or multiple hard disks can be installed. The NIC connects the system to the network. It also stores and manages the system's logical and hardware address on the network.


The kernel manages, controls, and operates all hardware components. Since in a running system, all processes flow through the main memory (RAM), memory management is the primary task of the kernel.

The kernel splits memory into many subdivisions and maintains certain state information about those subdivisions at all times. Depending on requirement and priority, the kernel allocates a single or multiple subdivisions to each process and also ensures that each process uses only its allocated subdivisions.

The second important task of the kernel is process management. The kernel determines which processes are allowed to use the CPU and how long an allowed process can use the CPU. The kernel is responsible for starting, pausing, resuming, and terminating the processes.

The third important job of the kernel is device driver management. A device driver is a software that contains and provides all necessary information about how to use and operate the device. Since it’s the kernel's job to operate the hardware, software developers make device drives for the kernel.

The kernel's role with devices is pretty simple. It acts as an interface between hardware and processes. If a process wants to access a device, it can access the device only through the kernel. Besides this, the kernel also provides a uniform or common programming interface to user processes. A programming interface is an interface that user processes use to access the hardware device.

Device drivers created by different software developers usually have different programming interfaces. For example, two NICs made by two different vendors rarely have the same programming interface even if the devices do the same thing.

Without any mechanism, if an application wants to access a device, it has to use the programming interface of the device. Since a device's programming interface is vendor-specific, to access the same device from different vendors, an application needs to use the different programming interfaces.

The kernel solves this issue by providing a common programming interface for each device. If an application accesses a device through the kernel, it does not need to connect to the programming interface of the device. The application connects to the common programming interface of the kernel, and the kernel connects it to the programming interface of the device.

Since the application accesses the device through the common programming interface of the kernel, it does not need to maintain a code for each vendor's programming interface.

The following image shows how an application accesses the two NICs directly.

direct access of driver

The following image shows how the same application accesses the same NICs through the kernel.

driver access through the kernel

The next major job of the kernel is managing system calls. A system call is an interaction between a process and the kernel. System calls perform specific tasks that a user process alone cannot perform. For example, opening, reading, and writing files all involve system calls.

User processes

This is the topmost layer of the Linux operating system. Users interact with this layer. All applications that you access and use work in this layer. For user interactions, Linux contains two popular interfaces: CLI and GUI.

The CLI (command-line interface) provides a text-based environment. Users enter commands on the shell prompt and the shell returns output on the selected output device. The default output device is the monitor.

The GUI (graphic user interface) provides a graphic environment. Users use the graphical interface of applications. Just like the CLI, users can get output from applications on their desired output device. If no output device is specified, the application displays output on the default device.

No matter which interface you use, they both interact with the kernel similarly. You can choose any interface that you like, but you should choose the CLI interface. The CLI interface is available on all versions, modes, and flavors of Linux.

That's all for this tutorial. If you like this tutorial, please don't forget to share it with friends through your favorite social network.

ComputerNetworkingNotes Linux Tutorials What is Linux and how it works Explained