Knowing How Linux Works is Interesting

Sachini Navodani
SachiniNP
3 min readMar 6, 2019

--

Abstraction is the most effective way to understand an operating system. The components that makeup a Linux system have many technical details internally. According to abstraction, the internal details have been ignored and mainly focuses on what those components do in relation to the whole system. A level of Abstraction in Linux is a classification of a component according to where it is in between the user and the hardware. Linux has 3 main levels. They are hardware, kernel and processes. Hardware which is the base, mainly consists of the memory and the Central Processing Unit to do computation, read from memory and and to write to memory. Kernel, the core of OS basically manipulates the CPU works acting as an interface between the hardware and the running programs. Processes which are in the system’s upper level are the running programs that are manipulated by the kernel.
The most significant difference between the kernel and the user processes is that the kernel runs in kernel mode and the user processes run in user mode. If we run code in kernel mode it is really powerful as it has unrestricted access to the processor and the main memory. But in other hand it is dangerous as the entire system can be collapsed because of a kernel process. When we consider about user processes, the access is really smaller compared to kernel mode, but the risk of crashing is limited here as it can be cleaned from the limited space it is working.
State is a term that we use when talking about things like memory, kernel which are related to a computer system. A state is simply an arrangement of bits. When describing states, it is easier to use abstract terms instead of explaining using bits, as a single process can have many bits in memory. For example we can simply say that a particular process is working in level 2 like that.

Hardware

The main memory is the most significant hardware in a computer. Many more 0’s and 1’s are stored in a main memory. Simply the main memory is a giant storage for these two bits, 0 and 1. Both the running kernel and processes which are collections of bits, belong to the main memory. Also the inputs and outputs from any peripheral device flow as sets of bits through the main memory. A CPU which acts as an operator on memory, reads instructions and data from it and writes them back to it.

The Kernel

Each and every process gets a share of memory while the kernel is responsible for ensuring that each process keeps to its share. The kernel is responsible for Process Management, Memory Management, Device Drivers Management and System Calls and Support. When considering process management, the kernel determines the processes that are allowed to use the CPU. In memory management, the kernel needs to know about each and every memory partitions. Here what memory is allocated to a particular process, what memory is shared between processes and what memory is not allocated for any process, is mainly considered. Device drivers management is about manipulating and managing the kernel’s functionality as the interface between hardware and the processes. Normally system calls are used by the processes to communicate with the kernel. The system calls are used to perform specific tasks that user processes are unable to accomplish alone. File opening, reading and writing are that kind of tasks which are accomplished by system calls.

User Space

User space is the main memory which is allocated for user processes by the kernel. Simply it is the memory for all the running processes. According to the perspective of the kernel, every process is equal. But they perform different tasks for the users.

--

--