SGG 13 – File System Interface

Chapter 11 (through 11.1 really) has a brief introduction to mechanical hard drives and nonvolatile memory (NVM) like SSDs and flash drives. A good and brief introduction to have in mind as we move to file systems below. So then…

 

13.1 File Concept

  • How do we define a file, in the most abstract possible manner?
  • What distinguishes the following file types: text file, source file, executable file, library file?
  • Files have attributes (some people will call them meta-data). Understand what the most common attributes are and think of what impact they have for the common user.
  • As users, we all know several common operations on files. What we need to learn from this section is how the operating system supports and implements these operations. For instance, how does a seek or delete operation work? What are the data structures affected by them? (Don’t limit yourself to studying only these two!)
  • There are several pieces of information associated with an open file. We need to know what they are and how they are stored (that is, where: disk, memory, both?)
  • What happens if two different processes try to write to the same file in Unix? Does the operating system provide mutual exclusion on files by default, so that they processes operations are serialized? You should write a little test program to see what happens.
  • How are file types known in Unix? Part of the name? In an extension? Something entirely different? How does the file(1) Unix command know the type of a file?

13.2 Access Methods

  • Files can contain multiple instances of a structured data type. How can one know where one structure ends and another begin? That is, if you are going to work with a file to read or write structured data (aka. records), how can you tell one record apart from the previous and the next?
  • Files can be accessed sequentially or randomly. Beware that random doesn’t mean by chance in this context! If your system only gives you sequential access, can you build an API to simulate random access? Or vice-versa?

13.3 Directory Structure

  • What are the typical operations that users will perform on directories? These are use cases that drive the design and the implementation of the file system.
  • Contrast the following types of directory structures, identifying their pros and cons, as well as scenarios when each one is the best option to implement: single-level, two-level, tree-structured, acyclic-graph, general graph.
  • It important that we are able to explain the concept of link and that we are able to distinguish between soft link (symbolic) and  hard link. What happens when I have multiple links to one file object and remove the actual file? Does the same thing happen regardless of the type of links to the file? What happens if I have only one hard link to a file and I remove that link?

13.4 Protection

  • How does Unix implement protection for files and directories?
  • If I issue command chmod 0644 myfile.txt, what are the permissions for user, group, and other?
  • Say a file called otherfile.txt has permission bits 0111 (in octal). What are the permission bits (in octal), after I issue command chmod a+rw otherfile.txt?
  • Explain the concept of access control list for a file and describe a scenario to illustrate how useful it might be for a user to be able to specify the contents of this list.