File Management
This article outlines the fundamentals of file management within operating systems, including how file systems track storage blocks and inodes, maintain cache performance, and implement access strategies in both user-space and kernel-space environments.
Kernel Architectures
A monolithic kernel handles everything within a single, unified (hence the name) process. A microkernel, by contrast, consists of several processes responsible for the essential system tasks: allocating memory, managing processes, and maintaining permanent data storage such as hard disks or floppy drives. This article specifically focuses on the design and role of File Systems within operating system architectures.
File System Service
The File System Service manages how data is stored and organised on storage media and is responsible for keeping the file system on a floppy disk or hard drive up to date (and eventually for handling pipes and related mechanisms). The most fundamental task of the file system service is to track allocated and deallocated blocks and, in the case of ext2, inodes - the files to which blocks are assigned.
Caching and Performance
Another common task performed by the file system service is maintaining a cache of recently used blocks in memory. Accessing data from memory is significantly faster than retrieving it from disk storage, so the file system service implements a block cache.
Paging and Address Space Separation
Now, consider a system using paging where the file system service exists as a user-space process. It fetches disk blocks and retains them within its own address space.
This setup introduces overhead: transferring the data of a retrieved block to the user process performing the read() call - or conversely, accepting data from a write() call - requires extra work.
Kernel-Space Implementation
An alternative would be to implement a task within kernel space to manage the block cache and perform direct reading and writing operations more efficiently.