Chapter 1.4 - High-Level Architecture
Learning Objectives
By the end of this chapter, you will be able to:
- Understand the structure of a Linux system
- Identify the components of the Kernel
- Identify the components of User Space
- Understand the communication between components
Introduction
A Linux system is organized into multiple layers that work together. Understanding this architecture is essential for mastering Linux.
System Overview
Basic Structure
Two main spaces:
- User Space: Applications and user programs
- Kernel Space: System and hardware management
User Space
Applications
Programs you use:
- Web browsers
- Text editors
- Development tools
- Games, etc.
Shell
Command line interface:
- Bash: Default shell on most distributions
- Zsh: Modern and powerful shell
- Fish: User-friendly shell
Libraries
Shared functions:
- libc: Standard C library
- Others: Specialized libraries
Services
Background programs:
- systemd: Service manager
- cron: Task scheduler
- sshd: SSH server
Kernel Space
Linux Kernel
The core of the system:
- Process Management: Creation, scheduling, termination
- Memory Management: Allocation, swap, protection
- File System: VFS, file management
- Network Management: TCP/IP stack, interfaces
- Device Management: Hardware drivers
System Calls (Syscalls)
Interface between User Space and Kernel Space:
open(),read(),write(): Filesfork(),exec(): Processessocket(),bind(): Networkmmap(): Memory
Communication Between Layers
Typical Flow
Hardware Components
CPU
- Instruction execution
- Process management
- Scheduling
RAM Memory
- Temporary storage
- Data and code in execution
- System cache
Hard Disk
- Persistent storage
- File system
- Swap (RAM extension)
Network
- Network interfaces
- Communication with other systems
- Network protocols
User/Kernel Space Separation
Why this Separation?
Security:
- Applications cannot directly access hardware
- Protection against errors
- Process isolation
Stability:
- Error in an application does not affect the kernel
- System remains stable even if an app crashes
Performance:
- Kernel optimized for hardware
- Applications can be less optimized
Summary
In this chapter, you learned:
Architecture: User Space + Kernel Space + Hardware
User Space: Applications, Shell, Libraries, Services
Kernel Space: Linux Kernel, System Calls, Resource Management
Communication: Via system calls (syscalls)
Separation: Security, stability, performance
Hardware: CPU, RAM, Disk, Network
Next Steps
Chapter 1.5: Fundamental Concepts
Chapter 1.6: Installation and First Use
Chapter created on: December 2024