File Systems Overview


File Systems Overview

Hope
Alright Maria, we're tackling file systems today. Let's start simple: what exactly is a file from the operating system's perspective?

Maria
Right, a file is just a contiguous logical address space. The key word there is logical — because physically the data might be scattered across the disk, but the OS presents it as a single continuous block of bytes.

Hope
Exactly. And files come with attributes like name, type, size, timestamps, and permissions. On a Mac, for instance, you also get labels, sharing info, and even which app opens it by default.

Maria
Those attributes matter because the OS needs to keep track of everything. For example, when you open a file, the OS records it in an open-file table so it knows who's using it and where they are in the file.

Hope
And if you never close files, that table grows until it crashes. So closing files is just as important as opening them. The OS also handles file locking — exclusive locks stop others from writing, while shared locks allow concurrent reads.

Maria
Right. And file types go beyond just extensions. You've got simple text files, fixed-length records like in a transaction log, variable-length records, and complex binary files that only the application understands.

Hope
Now let's talk access methods. Sequential access is like a tape drive — you read records one after the other. It's slow for random access but cheap for bulk storage. Tapes are still used in huge data centers for backups.

Maria
Direct access lets you jump to any record instantly, like on a disk. But to manage that, you need an index. The problem is that indexes can be huge — imagine bringing a full index for a terabyte drive into memory. So you need hierarchical indexes or keep only part of it in memory.

Hope
And there's indexed sequential access — you still have to sequentially scan the tape, but you use an index to know where to start. That's what ISAM does, and it's still used in commercial databases today.

Maria
Good. Now directory structures. The simplest is a single-level directory — all files in one place. But then you have naming collisions and no organization. Then we got two-level directories, one per user, and finally the tree structure we all use.

Hope
Trees are great for efficient navigation and grouping. You have absolute paths from the root, like C:\Users\Maria\Docs, and relative paths from your current directory. But some systems, like Linux, allow links that turn the tree into a graph.

Maria
Right — hard links and symbolic links can create cycles or multiple names for the same file. That means the OS needs back pointers or reference counts to know when to actually delete a file. And if cycles happen, you might need garbage collection to clean up dangling references.

Hope
On to mounting: before you can use a file system, you have to mount it at a mount point. On Windows, drives get letters automatically. On Linux, you mount devices under a directory like /mnt or /media. Even cloud storage like OneDrive is mounted virtually.

Maria
And then file sharing. The OS enforces permissions based on user IDs and group IDs. On Unix, you have three triples: owner, group, others, each with read, write, execute bits. The command chmod 700 gives the owner full access and everyone else none.

Hope
Windows does it differently with ACLs — you set permissions per user or group with checkboxes for read, write, modify, etc. And for network file sharing, you use protocols like NFS or SMB, plus directory services like LDAP and DNS to resolve names.

Maria
So file systems are all about organizing, accessing, protecting, and sharing data. And the user never sees all that complexity — the OS handles it all behind the scenes.

Hope
Exactly. And that's why understanding these layers helps you design better systems or troubleshoot when something goes wrong. Great session today, Maria.

Ask anything
We've read this whole study set, so questions about it get the best answers.