Linux Architecture & It’s Component

By | March 16, 2022
Linux Architecture

Linux is an Operating System Kernal that is the core of many distributions and Operating systems. Its development started in the early 1990s and has been developing regularly since then. It is a free and Open Source software. Although it has relatively less market share than other major Operating Systems like Windows, it is the most used Operating System in the development world. In this article, we will first go through the overview of Linux, its features, and then the detailed architecture of the system.

What is Linux

Linux is an open-source kernel developed by Linus Torvalds for efficiently managing various operations in computers. A kernel is a piece of software that allows computer hardware and software to communicate with one another. It transports input to the CPU for processing and output to the hardware for display. This is the most fundamental function of a Linux and operating system combined. Linux communicates with users through Application Programming Interface (API). APIs are assembly-level codes that act as the intermediate between users and Kernel. APIs provide an abstraction of large and complex low-level instructions for the users.

Features of Linux

1. Multitasking

Multiple processes can be run concurrently by scheduling them and not leaving the CPU idle for long periods of time.

2. User Management

Multiple users can work together on a single Operating System without interfering with others. They cannot read or write other users’ data without permission. This feature is very helpful for companies and organizations since multiple people may work on a single OS.

3. Multiple Desktop Environments

We have a wide variety of Desktop Environments available in Linux Operating Systems. These include Gnome, Mate, Cinnamon, KDE Plasma, etc.

4. Open Source

It is open-source software that can be configured by everyone. This ensures quick bug removals and the introduction of innovative features in the tool.

5. Hierarchical File System

The filesystem is distributed in the form of a tree data structure which ensures fast search, deletion, and insertion of files.

Vamware

6. Multithreading

A thread of execution is the shortest succession of programmed instructions, each with its own set of program counters and registers. Threads enable many tasks to be completed in the same program. For example, we can use Google Chrome to both download and surf the web.

Why Study Linux Architecture

Understanding the architecture of an operating system ensures that work is done in an efficient and secure manner. You are aware of anything that may provide a security risk to your computer, as well as what is compatible with your existing architecture. This also saves a significant amount of online surfing time. A solid grasp of the architecture also allows you to configure the system based on your use case and even contribute to the source code. As a result, it is usually suggested that you are familiar with the architecture of the system on which you are working.

Vamware

Architecture of Linux

The below diagram shows how architecture is distributed in Linux.

Architecture Of Linux

User programs operate in a non-privileged manner. They must make a system call to the kernel for each job. This system call is made indirectly, using a library or an Application Programming Interface (API). The API includes assembly code that serves as an abstraction for users to interface with hardware. The API instruction is subsequently sent to the Kernel, which has full access to physical devices. The mode changes from user mode to kernel mode at this time. A system call is then implemented by the kernel. The kernel is in charge of scheduling processes based on their priority. Let’s take a closer look at the components of the Linux architecture.

1. Utilities/Applications

These are the applications and software that are running on the screen. These can be Browsers, Video Games, etc. These do not have direct access to the hardware for security concerns and requests to access hardware devices through system calls.

2. Shell

Shell is a program that is used in UNIX-like systems to implement various instructions. It gives a computer user access to the Unix/GNU Linux system, allowing the user to perform various commands or utilities/tools with some input data.

Vamware

When the shell finishes executing a program, it displays the result to the user on the standard output device, the screen. As a result, it is known as the “command interpreter.” The default shell in Linux is “Bash,” which stands for “Bourne Again Shell” and is a successor for Bourne Shell.

3. Application Programming Interface (API) or Libraries

An Application Program Interface (API) is a set of instructions that enables software applications to communicate with one another. It specifies how to create a program that seeks services from an operating system or another application. Function calls are used to implement APIs.

In general, it is a set of explicitly specified communication mechanisms between diverse software components. It encapsulates the underlying functionality and only exposes the objects or activities required by the developer, minimizing the workload on programmers. When you make a system call, it is passed through the APIs defined in every Operating System.

What is a System Call in Linux architecture?

System calls allow user applications (running in user mode) to request a service from the operating system. In other words, system calls enable user applications to request that the operating system perform certain tasks on their behalf.

For example, read and write file operations that necessitate I/O from/to the storage device. Such system call actions are available to the end-user through basic library calls/APIs such as read(), write(), open(), and so on. The OS kernel code executes the meat of such actions after switching the mode (TRAP instruction) from user to kernel.

These and other system call procedures often access/manipulate OS kernel data structures such as the buffer cache, process control block, global open file table, and many more.

Such kernel-level data structures are crucial to the system’s overall functionality. This is why programs running in the kernel should be allowed to access them instead of users themselves.

4. Kernel

A kernel is a software that controls the hardware and offers services to other programs in order to mediate all access to the hardware (including memory allocation). As a result, the kernel serves as the hub of all activity for all applications executing on that operating system. Kernels and microkernel designs are typical for multi-user and multi-tasking systems and may therefore enforce resource constraints to safeguard the OS and other applications from any program (or user) that is either defective or malicious.

The Linux kernel is monolithic, which implies that all of the kernel’s services execute concurrently with the main thread. It is easier to implement a monolithic kernel but it suffers major issues if even a single device driver fails.

a. Monolithic Kernel

It handles all of the core system services, including processes and their scheduling, interrupts handling and access to the hardware, file system, and so on itself. It is designed in layers, beginning with basic process management and progressing to interfaces with the rest of the operating system including the libraries and the applications.

b. Microkernel

This kernel employs the bare minimum of configuration for scheduling, memory management, and inter-process communication. This significantly decreases the amount of memory needed for kernel use. Because the kernel is as small as possible, the amount of communication that is needed by the device drivers limits the flow of data via the kernel while simultaneously decreasing kernel reaction time to interruptions. Microkernels are common in real-time systems.

c. Hybrid Kernel

The kernel is bigger than a microkernel but smaller than a monolithic kernel. Typically, you’ll receive a stripped-down monolithic kernel with the bulk of device drivers eliminated but all of the system services remaining there in the kernel space. These kernels are commonly found on desktop computers running Windows, Mac, or Linux.

Below is the image from Wikipedia showing the distinction between the monolithic kernel, micro, and hybrid kernel.

5. Hardware

This comprises all physical equipment linked to the computers, such as hard discs, RAM, CPUs, and so on. The kernel uses these devices for a variety of hardware-related operations like reading and writing files, CPU processing, creating and stopping processes. This is the final stage of the Linux instruction flow, where the operation is carried out.

6. Bootloader

A bootloader is a piece of code/program that runs prior to the start of an operating system. When a computer is turned on, it loads an operating system. When you start things up, it instructs the hardware where to look and how to begin going.

The bootloader essentially packages the instructions to boot the operating system kernel, and most of them also include their own debugging or modification environment.

Conclusion

This article goes over the details of Linux architecture. Because of its essential characteristics such as security, identity and access control, configuration, and variety, Linux is a kernel that is extensively used for development today. Linux’s architecture consists of hardware, the Kernel, APIs, the Shell, and applications. The Kernel is the fundamental component of an operating system that implements user-requested system calls. The APIs act as middlemen between user and kernel level modes. The hardware is the end device with which the Kernel communicates in order to perform different tasks.

People are also reading:

Author: Vinay Singh

I am a Full Stack Developer with a Bachelor's Degree in Computer Science, who also loves to write technical articles that can help fellow developers.

Leave a Reply

Your email address will not be published.