Skip to content

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):

MCU
 ├── UART
 ├── SPI
 ├── GPIO
 ├── Timer
 └── Flash

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:

RTOS + Drivers + Networking + File System

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:

python app.py

User programs cannot directly access hardware.


System Calls

User applications interact with the kernel through system calls.

Common system calls:

open()
read()
write()
close()
ioctl()

Example:

fd = open("/dev/ttyAMA10", O_RDWR);
write(fd, "hello", 5);

Execution flow:

User Application
   System Call
   Linux Kernel
  Device Driver
    Hardware

Everything is a File

A key design principle in Linux is:

Everything is represented as a file.

Examples:

/dev/ttyAMA10
/dev/spidev10.0
/dev/i2c-1
/dev/random

These files represent hardware devices and allow applications to communicate with them using standard file operations.

Example:

echo "hello" > /dev/ttyAMA10
cat /dev/ttyAMA10

Linux Device Model

Hardware devices are usually exposed in user space through device files.

Device files are located in:

/dev

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 Space
Kernel
Hardware

User applications communicate with hardware through:

  • system calls
  • kernel drivers
  • device files