Linux Kernel Architecture

A kernel is the core of an Operating System. It provides basic services for all other components of the OS. It is the main layer between the OS and hardware, and it helps with process and memory management, file systems, device control, and networking.

Following is Linux Kernel Architecture:


User Space is the memory area where all user mode applications works and this memory can be swapped out when needed. Userspace process normally runs in its own virtual memory space and unless explicitly requested, cannot access the memory of other processes. Due to the protection afforded by this sort of isolation, crashes in user mode are always recoverable.

Kernel Space is strictly reserved for running the kernel, OS background process, kernel extensions and device drivers. In Linux kernel space gives full access to the hardware, although some extensions runs in the user space. Crashes in kernel mode are catastrophic; they will halt the entire PC.

These two modes are enforced by the CPU hardware. If code executing in User mode attempts to do something outside, example accessing a privileged CPU instruction or modifying memory that it has no access to, then a trappable exception is thrown. Instead of your entire system crashing, only that particular application crashes.

x86 CPU hardware actually provides four protection rings: 0, 1, 2, and 3. Only rings 0 (Kernel) and 3 (User) are typically used.

Ring 0 : Kernel space code or instructions runs here.
Ring 1 : Usually used by Hypervisors, virtual machines, and a few drivers.
Ring 2 : Reserved for device drivers
Ring 3 : Userspace application runs here. It is the least privileged ring, having limited access or access to a subset of the processor instructions.

Comments

Popular posts from this blog

Recover or restore initramfs file in RHEL or CentOS 7

Space reclamation / UNMAP on RHEL or CentOS 7

How to recover /boot partition on RHEL or CentOS 7?