Understanding Linux System Architecture: Kernel, Memory, Processes, and More
This article provides a comprehensive Q&A guide covering Linux system components, kernel subsystems, memory addressing, process concepts, scheduling algorithms, interrupt handling, system calls, synchronization mechanisms, file system structure, and device driver classifications, offering clear explanations for each topic.
Linux System Overview
The Linux operating system is divided into four main parts: user processes, the system call interface, kernel subsystems, and hardware. The kernel sits between user processes and hardware, providing the system call interface and core services.
Kernel Subsystems and Functions
Process scheduling – decides which process runs on the CPU.
Memory management – handles virtual memory, sharing, and hardware‑dependent aspects.
Virtual File System (VFS) – offers a uniform interface to many file‑system types.
Network – supports protocol stacks and network drivers.
Inter‑process communication (IPC) – includes shared memory, message queues, pipes, etc.
Memory Addressing
Physical address: the actual location of a memory cell on the hardware.
Virtual address: the address space seen by applications, often expressed as segment:offset.
Linear address: a contiguous 0‑4 GB address space used after segment translation.
In protected mode, the MMU translates a virtual address to a linear address via segmentation, then to a physical address via paging. Two‑level page tables are used to keep the page‑table size manageable (≈4 MB for a full 4 GB space).
Process Management
A program is a static file containing code and data; a process is the dynamic execution of that program, represented by a process image.
The process control block (PCB), called task_struct in Linux, contains over 80 fields covering state, links, identifiers, IPC info, timers, scheduling data, file system info, virtual memory, and CPU context.
Process states include running, ready, blocked, sleep, stopped, and zombie, with possible transitions among them.
PCB organization can be a process list, hash table, run queue, or wait queue.
Common scheduling algorithms: round‑robin, priority (preemptive and non‑preemptive), multilevel feedback queue, and real‑time algorithms. Good schedulers aim for fairness, efficiency, low response time, good turnaround, and high throughput.
Interrupts and Exceptions
Interrupts are asynchronous signals from hardware or software; exceptions are synchronous events caused by the executing instruction.
Interrupt vectors (0‑255) identify the source; vectors 0‑31 are exceptions/non‑maskable, 32‑47 are device interrupts, 48‑255 are software interrupts (Linux uses vector 0x80 for system calls).
The Interrupt Descriptor Table (IDT) replaces the real‑mode interrupt vector table; each entry is a gate descriptor (interrupt gate, trap gate, or system gate).
System Calls
System calls provide a portable interface for user‑mode processes to request services from the kernel, improving programmability, security, and portability.
Kernel Synchronization
Critical sections are code regions accessing shared data; concurrent entry leads to race conditions. Synchronization mechanisms (e.g., semaphores) prevent races.
Semaphores are sleeping locks with atomic down() (P) and up() (V) operations.
Deadlock causes include mutual exclusion, non‑preemptibility, hold‑and‑wait, and circular wait; avoidance strategies break one of these conditions.
File System
Linux uses a single unified directory tree rooted at /, unlike Windows which has separate trees per drive letter.
File types: regular, directory, device, pipe, and symbolic link.
The Virtual File System (VFS) abstracts various concrete file systems, exposing a common set of system calls. VFS objects include superblock, inode, dentry, and file.
Device Drivers
Linux treats devices as files. Devices are classified as block devices (transfer data in blocks, e.g., disks) and character devices (byte‑wise I/O, e.g., keyboards). Device drivers are kernel code that manages hardware controllers.
I/O ports consist of control, status, and data registers and can be accessed via memory‑mapped or I/O‑mapped addressing.
Reference: https://my.oschina.net/u/4526289/blog/4651990
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
