Linux Architecture, Unpacked: The Four Layers That Explain How Your System Actually Works

·MSA & Architecture·7 min read

Translated from the original Korean post. 한국어 원문 보기 →

The Journey Behind a Single Command

You type ls in a terminal. A list of files comes back. It's so routine nobody thinks about it. But getting that one line to run kicks off a surprisingly long trip through the system — from user space, down through the kernel, all the way to the hardware, and back up again.

I didn't really look at that path until I moved into ops and architecture work. Back when I was writing application code, ls was just ls. Then you start chasing incidents and hunting performance bottlenecks, and every question collapses into the same one: which layer is this request stuck in? That's when the layer diagram stopped being a textbook picture and became a coordinate system for taking problems apart.

So let's walk that path. Linux architecture looks complicated, but the lines between the pieces are cleaner than you'd expect.

Linux in Four Layers

Linux follows a modular, layered architecture. Think of an apartment building: each floor is clearly separated, and floors only talk to each other through defined passageways.

계층 역할 주요 구성요소
4. 사용자 공간 사용자와의 직접적인 상호작용 Shell, 애플리케이션, 명령어
3. 시스템 라이브러리 커널과 애플리케이션 간 중계 glibc, 시스템 호출
2. 커널 시스템 자원 관리 프로세스, 메모리, 파일시스템 관리
1. 하드웨어 물리적 처리 수행 CPU, RAM, 디스크, I/O 장치

Each layer talks only to the layer directly below it. That's why an application can't reach out and touch the hardware. It can feel restrictive, but it's the same instinct behind forcing service-to-service traffic through a gateway in a microservice setup. Block direct calls and you keep isolation; keep isolation and a failure in one layer doesn't spread to everything else.

Layer 1: Hardware, the Foundation

At the bottom sits the physical hardware — CPU, memory, storage, network cards. The parts that actually compute and store things.

The important bit: Linux doesn't talk to hardware directly. It goes through device drivers, which act as translators. That's how the same kernel runs identically on top of different NICs and different disk controllers. From the layers above, the interface looks the same no matter what's underneath.

In the cloud, you get one more layer of abstraction. Virtualization slides in and splits "the real hardware" from "the hardware the OS thinks it has." I've seen plenty of people blur that boundary and go looking for a bottleneck in entirely the wrong place.

Layer 2: The Kernel, the Heart of Linux

The kernel is the core of Linux. It sits between software and hardware and conducts every resource.

Its job breaks down into four areas. Process management: running programs, scheduling them, handling termination. Memory management: allocating RAM, dealing with virtual memory and swap. Device management: acting as the channel to hardware. Filesystem management: storing and reading data, enforcing permissions.

The kernel runs in kernel space, a protected region of memory that user programs can't poke at. Live through one bad incident and you'll understand why that boundary matters: a user process can die and the system survives only because the kernel is still intact. A privilege boundary is a security mechanism, sure, but before that it's a design for shrinking the blast radius of a failure.

Layer 3: System Libraries, the Translator

Talking to the kernel directly is too much ceremony for an application. So there's a system library layer in between, with the GNU C Library (glibc) as the headline example.

When an application says "I want to read a file," the system library turns that into a system call and hands it to the kernel.

Some of the common ones:

read()    // 파일 읽기
write()   // 파일 쓰기
open()    // 파일 열기
fork()    // 프로세스 복제
exec()    // 새 프로그램 실행

Thanks to system libraries, developers never have to touch kernel-level code. Functionally it's a kind of SDK. The internals can change however they like as long as the layer above sees the same interface. That contract holding steady is exactly why decades-old binaries still run today.

Layer 4: User Space, the Linux We Actually Meet

User space is where we do our work. The shell (bash, zsh, whatever) that takes commands and passes them along. Basic utilities like ls, cp, grep. Applications — browsers, editors, server processes.

Type a command in a terminal and the shell parses it, then hands the request to the kernel via system calls when it needs to. The result travels back up to your screen. This one layer is essentially all we touch day to day, with three more quietly holding it up.

Tracing One Command End to End

Here's what happens when you run cat /etc/passwd.

  1. 사용자 공간: 셸이 명령어 파싱
  2. 시스템 라이브러리: open(), read() 시스템 호출 생성
  3. 커널: 파일시스템을 통해 파일 위치 확인
  4. 하드웨어: 디스크에서 실제 데이터 읽기
  5. 역순으로 복귀: 데이터가 터미널에 출력

The whole round trip happens in milliseconds. What makes it interesting from an ops seat is that when something breaks, you walk the exact same path backwards. Output is slow? Find where the time is leaking. Is it stuck in a system call? Is the kernel waiting on I/O? Or is the disk itself just slow? Running strace to inspect syscalls, staring at I/O metrics — all of it is really just pinning the problem to one of those five steps. Know the structure and you guess less. Guess less and incidents get shorter.

What Modularity Buys You

The biggest win in this architecture is modularity. Components get added, removed, and updated independently.

Add a new filesystem or swap a driver, and you don't have to reboot the whole machine.

# 모듈 동적 로드
sudo modprobe ext4

# 모듈 제거
sudo rmmod old_driver

Sounds minor, but if you run systems, avoiding a reboot means avoiding downtime. Keep the core running and replace only the edges. Anyone who's thought hard about zero-downtime deploys will recognize the idea. The kernel has been solving that same problem for decades. It's also why one Linux runs on everything from phones to supercomputers.

Why the Architecture Is Worth Knowing

Once this structure clicks, a lot of previously fuzzy things line up. The permission model starts making sense — why root exists, how user separation actually works. Performance tuning turns into a question of which layer the bottleneck lives in. Reading a log and inferring which layer failed, deciding where to harden when you're tightening security — same coordinate system, different questions.

If you do sysadmin or DevOps work, this fundamental follows you further than you'd expect. Writing automation, designing infrastructure — knowing which layer a given operation happens in is what determines how fast you can make a call. Tools keep churning. The layer model doesn't.

Simple, and That's the Strength

Linux's layered architecture has survived more than 30 years. Clear division of responsibility, standardized interfaces. Those two things got it stability and extensibility at the same time.

Look closely and the principles we now call good architecture — separation of concerns, stable interfaces, isolation, swappable modules — are already sitting in there. Every time a new paradigm shows up, I wonder whether we're just rediscovering the same principles under different names. Once you know this machinery is grinding away quietly every time you hit enter, even a bare ls looks a little different.

Was this post helpful?

One click helps me write the next one

#Linux#System Architecture#Kernel#Operating Systems#System Administration