The Way to Think

This lesson discusses two aspects to build a mental model of a file system.

We'll cover the following

To think about file systems, we usually suggest thinking about two different aspects of them. If you understand both of these aspects, you probably understand how the file system basically works.

Data structures

The first is the data structures of the file system. In other words, what types of on-disk structures are utilized by the file system to organize its data and metadata? The first file systems we’ll see (including vsfs below) employ simple structures, like arrays of blocks or other objects, whereas more sophisticated file systems, like SGI’s XFS, use more complicated tree-based structures“Scalability in the XFS File System” by Adan Sweeney, Doug Doucette, Wei Hu, Curtis Anderson, Mike Nishimoto, Geoff Peck. USENIX ’96, January 1996, San Diego, California. The first attempt to make scalability of operations, including things like having millions of files in a directory, a central focus. A great example of pushing an idea to the extreme. The key idea behind this file system: everything is a tree. We should have a chapter on this file system too..

Access methods

The second aspect of a file system is its access methods. How does it map the calls made by a process, such as open(), read(), write(), etc., onto its structures? Which structures are read during the execution of a particular system call? Which are written? How efficiently are all of these steps performed?

ASIDE: MENTAL MODELS OF FILE SYSTEMS

As we’ve discussed before, mental models are what you are really trying to develop when learning about systems. For file systems, your mental model should eventually include answers to questions like what on-disk structures store the file system’s data and metadata? What happens when a process opens a file? Which on-disk structures are accessed during a read or write? By working on and improving your mental model, you develop an abstract understanding of what is going on, instead of just trying to understand the specifics of some file-system code (though that is also useful, of course!).

If you understand the data structures and access methods of a file system, you have developed a good mental model of how it truly works, a key part of the systems mindset. Try to work on developing your mental model as we delve into our first implementation.

Get hands-on with 1400+ tech skills courses.