1️⃣ Process Management
Handles creation, scheduling, and termination of processes.
• Creates processes (fork, exec)
• Schedules CPU time (scheduler)
• Context switching between processes
👉 Example:
• When you run top, multiple processes compete for CPU → kernel decides who runs
2️⃣ Memory Management
Controls how memory (RAM) is used.
• Virtual memory (each process gets its own space)
• Paging & swapping
• Memory allocation & deallocation
👉 Key concept:
• Virtual Memory lets processes think they have large continuous memory
3️⃣ File System (VFS Layer)
Manages files and storage devices.
• Provides a unified interface via Virtual File System (VFS)
• Supports multiple filesystems:
o ext4
o xfs
o btrfs
👉 Example:
• /home, /etc, /var all handled through VFS abstraction
4️⃣ Device Drivers
Interface between hardware and kernel.
• Disk drivers
• Network card drivers
• USB drivers
👉 Without drivers:
• OS cannot talk to hardware
5️⃣ Networking Stack
Handles all networking operations.
• TCP/IP protocol implementation
• Packet routing
• Socket interface
👉 Example:
• When you ping or curl, kernel networking stack handles packets
6️⃣ System Call Interface (SCI)
Bridge between user space and kernel space.
• Programs request kernel services via system calls
• Examples:
o read()
o write()
o open()
👉 Think:
System calls = controlled entry points into kernel
7️⃣ Security (LSM Framework)
Provides security mechanisms.
• SELinux
• AppArmor
• Capabilities
👉 Example:
• Restrict what processes can access
8️⃣ Inter-Process Communication (IPC)
Allows processes to communicate.
• Pipes
• Shared memory
• Message queues
• Signals
9️⃣ Resource Management (Cgroups)
Controls resource usage per process/group.
• CPU limits
• Memory limits
• I/O limits
👉 Uses:
• Containers (Docker)
🔟 Namespaces (Isolation)
Provides isolation between processes.
• PID, NET, MNT, USER, etc.
👉 Used heavily in containers
🧩 How It All Fits Together
User Applications
↓
System Calls
↓
---------------------
| Linux Kernel |
|-------------------|
| Process Mgmt |
| Memory Mgmt |
| File System |
| Networking |
| Drivers |
| Security |
---------------------
↓
Hardware
⚡ Quick Real-Life Flow
Example: cat file.txt
1. User runs command
2. System call → open(), read()
3. Kernel:
o Checks permissions (security)
o Uses filesystem to locate file
o Uses disk driver to read data
4. Data returned to user
🧠 Key Takeaways
• Kernel = brain of the OS
• Everything goes through it:
o CPU
o Memory
o Disk
o Network
• Features like namespaces and cgroups enable modern containers
No comments:
Post a Comment