Linux Architecture¶
This note summarizes the basic architecture of a Linux system and the relationship between user applications, the kernel, and hardware.
Linux System Architecture¶
A Linux system can be divided into three main layers:
+----------------------+
| User Space |
| Applications / Shell |
+----------------------+
| Kernel |
| Drivers / Scheduler |
+----------------------+
| Hardware |
| CPU / RAM / Devices |
+----------------------+
Hardware Layer¶
The hardware layer includes the physical components of the system.
Examples:
- CPU
- RAM
- UART
- SPI
- I2C
- Network interfaces
- Storage devices
For embedded systems, this is typically an SoC (System-on-Chip) containing the CPU and peripherals.
Example (MCU concept):
Kernel¶
The Linux kernel is the core of the operating system.
It manages hardware resources and provides services to user applications.
Main responsibilities:
- Process scheduling
- Memory management
- Device drivers
- File systems
- Networking stack
- Inter-process communication (IPC)
For embedded developers, the kernel can be roughly compared to:
However, Linux is much more complex and supports multi-user and multi-process environments.
User Space¶
User space contains applications and system utilities.
Examples:
- bash
- ssh
- python
- systemd
- user applications
Example command:
User programs cannot directly access hardware.
System Calls¶
User applications interact with the kernel through system calls.
Common system calls:
Example:
Execution flow:
Everything is a File¶
A key design principle in Linux is:
Everything is represented as a file.
Examples:
These files represent hardware devices and allow applications to communicate with them using standard file operations.
Example:
Linux Device Model¶
Hardware devices are usually exposed in user space through device files.
Device files are located in:
Examples:
- UART →
/dev/tty* - SPI →
/dev/spidev* - I2C →
/dev/i2c-* - Storage →
/dev/mmcblk*
These device files are handled by kernel drivers.
Summary¶
Linux architecture consists of three main layers:
User applications communicate with hardware through:
- system calls
- kernel drivers
- device files