File System Layers and Architecture
You'll learn how file systems are organized into distinct layers, each handling a specific responsibility from high-level operations down to physical disk access.
The Layered Approach
A file system isn't one monolithic block of code—it's organized into layers, much like a restaurant's operation splits into front-of-house (taking orders), kitchen (preparing food), and suppliers (delivering ingredients). Each layer has a clear job and communicates only with adjacent layers.
The Typical Layers (Top to Bottom)
Logical File System
This is the user-facing layer. It handles symbolic file names, directories, file descriptors, and permissions. When you call open() or read(), you interact here. This layer knows about paths, access control, and translates your requests into generic file operations.
File-Organization Module
This layer understands file structure and metadata. It manages file control blocks (inodes in Unix), tracks which blocks belong to which files, and handles logical-to-physical block mapping. Think of it as the librarian who knows exactly which shelf holds your book.
Basic File System
This layer issues generic read/write commands to disk blocks using block numbers. It manages in-memory buffers and caches, but doesn't know what data means—just "fetch block 4829" or "write block 1024."
I/O Control Layer
The device driver layer. It translates abstract block operations into actual hardware commands for specific disk controllers. Different disks have different protocols; this layer hides those details.
Physical Layer
The actual hardware: the spinning platters, read/write heads, or flash memory cells.
Why Layers Matter
Separation of concerns means you can improve disk performance without rewriting how files are organized, or change file permissions without touching hardware drivers. Each layer abstracts complexity from the one above.
Key Takeaway:
File systems use a layered architecture where each layer—from logical operations to physical hardware—handles specific responsibilities, enabling modularity, portability, and clarity in design.