Linux Kernel Architecture
1. Introduction
β The Linux Kernel is the core part of the Linux operating system.
β It acts as a bridge between hardware and software applications.
β It manages processes, memory, devices, and system calls.
2. Core Responsibilities
β Process Management β handles process creation, scheduling, and termination.
β Memory Management β allocates and manages virtual and physical memory.
β File System Management β provides access to files and directories through the Virtual File System (VFS).
β Device Management β communicates with hardware via device drivers.
β Network Management β manages network protocols and interfaces.
β System Calls β provides interfaces for user-space programs to interact with the kernel.
3. Kernel Modes
β User Mode: Applications run here with restricted access.
β Kernel Mode: The kernel runs here with full access to system resources.
β The system switches between these modes through system calls and interrupts.
4. Major Components
β 1. Process Scheduler
β Manages process execution order.
β Balances CPU load efficiently.
β Uses algorithms like CFS (Completely Fair Scheduler).
β 2. Memory Manager
β Handles paging, swapping, and memory allocation.
β Manages physical and virtual memory.
β Uses demand paging for optimization.
β 3. Virtual File System (VFS)
β Provides a common interface for different file systems.
β Supports file systems like ext4, FAT, NTFS, etc.
β Offers system calls such as open(), read(), and write().
β 4. Device Drivers
β Allow the kernel to communicate with hardware devices.
β Each device type (block, character, network) has its own driver interface.
β Operates via /dev entries.
β 5. Network Stack
β Implements TCP/IP, UDP, and other protocols.
β Handles data transmission between applications and physical networks.
β Uses sockets for communication.
β 6. System Call Interface (SCI)
β Acts as a gateway between user-space applications and kernel-space operations.
β Converts API requests (e.g., printf, fork) into kernel-level tasks.
5. Kernel Types
β Monolithic Kernel: All services run in kernel space for performance (Linux uses this model).
β Microkernel: Minimal kernel; runs most services in user space.
β Hybrid Kernel: Mixes both for flexibility (used in Windows and macOS).
6. Boot Process Overview
β BIOS/UEFI initializes hardware.
β Bootloader (like GRUB) loads the kernel into memory.
β Kernel initializes devices, mounts the root file system, and starts init.
β System transitions to user space and starts essential services.
7. Interprocess Communication (IPC)
β Enables processes to communicate and synchronize.
β Mechanisms include:
ββ Pipes
ββ Message Queues
ββ Shared Memory
ββ Semaphores
ββ Signals
8. Kernel Modules
β Dynamically loadable components extending kernel functionality.
β Useful for device drivers, file systems, or system features.
β Managed using commands:
ββ insmod β load a module
ββ rmmod β remove a module
ββ lsmod β list loaded modules
9. Security and Permissions
β Uses User IDs (UIDs) and Group IDs (GIDs) for access control.
β Enforces permissions via file modes (read, write, execute).
β Supports advanced systems like SELinux and AppArmor for enhanced security.
10. Tip
β The Linux Kernel is modular, stable, and scalable.
β It efficiently handles hardware, memory, processes, and communication.
β Its open-source nature allows customization, performance tuning, and community-driven improvement.
β
Learn More About Linux, System Architecture, and OS Concepts in This Ebook:
codewithdhanian.gumroad.com/β¦