Chapter 2.2 - Linux Kernel
Learning Objectives
By the end of this chapter, you will be able to:
- Understand the role of the Linux Kernel
- Explain how the Kernel manages resources
- Understand system calls (syscalls)
- Identify interactions with hardware
What is the Linux Kernel?
The Linux Kernel is the heart of the operating system. It acts as an interface between hardware and software, managing all system resources.
Roles of the Kernel
1. Process Management
The Kernel creates, schedules, and terminates processes:
- Creation: fork(), clone()
- Scheduling: Scheduler (CFS - Completely Fair Scheduler)
- Termination: exit(), kill()
- Communication: pipes, sockets, signals
2. Memory Management
The Kernel manages physical and virtual memory:
- Allocation: malloc() → kmalloc()
- Virtual memory: Paging, swap
- Protection: Separation of memory spaces
- Cache: Buffer cache, page cache
3. File System
The Kernel manages file access:
- VFS: Virtual File System (unified interface)
- Multiple FS support: ext4, xfs, btrfs, etc.
- Permissions: Access rights verification
- Cache: Performance improvement
4. Network Management
The Kernel manages network communications:
- TCP/IP Stack: Protocol implementation
- Network interfaces: eth0, wlan0, etc.
- Firewall: iptables, netfilter
- Routing: Routing tables
5. Device Management
The Kernel manages hardware devices:
- Drivers: Drivers for each device
- Plug and Play: Automatic detection
- Power management: ACPI, suspend/resume
- Interruptions: IRQ management
System Calls (Syscalls)
Applications communicate with the Kernel via system calls:
Examples of system calls:
open(): Open a fileread(): Read from a filewrite(): Write to a filefork(): Create a processexec(): Execute a programsocket(): Create a network socket
Kernel Architecture
The Kernel is organized into modules:
Types of modules:
- Core: Essential features (always loaded)
- Modules: Optional features (loaded on demand)
- Drivers: Hardware drivers
Summary
In this chapter, you learned:
Linux Kernel: Heart of the system, hardware/software interface
Roles: Process, memory, file, network, device management
System calls: Interface between applications and kernel
Architecture: Core + modules + drivers
Modules: Dynamic loading of features
Next Steps
Chapter 2.3: Memory Management and Swap
Chapter 2.4: Virtual File System (VFS)
Chapter created on: December 2024