File Systems, Pt. 1 Flashcards
Two File System Design Problems
- Interface (how file system looks to users)
- Implementation (data structures/algorithms to map logical file systems onto physical devices)
File System: Layered Structure
Application programs -> logical file system -> file-organization module -> basic file system -> I/O control -> devices
Logical File System
- View files as logical blocks
- Maintain metadata
File-Organization Module
Maps logical blocks to physical blocks
Basic File System
View data as physical blocks present on devices
I/O Control
- Device drivers and device-specific instructions
- Read/write bit patterns to device controller
From user’s perspective, file is a…
…storage unit
A file is a named collection of…
…related information recorded on a secondary storage
File Attributes
- Name (only information kept in human-readable form)
- Identifier (unique tag identifies file within file system)
- Type (needed for systems that support different types)
- Location (pointer to file location on device)
- Size (self explanatory)
- Protection (rwx)
- Time/date/user identification (for protection and usage monitoring)
Information about files is kept in a…
…directory, which is maintained on the disk as well
Primitive File Operations
- Create
- Write
- Read
- Reposition within file
- Delete
- Truncate
To perform operations on a file, we must first…
…open it (duh)
Directory
- A logical grouping of files
- Contains an entry for each file under it
- Some systems treat directories just as files
Directory Operations
- Search for a file
- Create a file
- Delete a file
- List a directory
- Rename a file
- Traverse the system
Design the directory architecture to achieve:
- Efficiency (quickly locating files)
- Naming (convenient to users; ie. two users can have the same name for different files, the same file can have different names, etc.)
- Grouping (logical grouping of files by properties)
____ structured directories are the most common
Tree
Links make tree structures complicated. Why?
The directory is no longer a tree because different files can link to each other outside of the hierarchy
Problem with Acyclic Graph Directories
When a file gets deleted, links may still point to it.
Solutions for Dangling Links in Unix
- Symbolic link (let the user figure it out)
- Hard link (keep a reference counter, and only delete the file after all links to it have been deleted)
Problems with General Graph Directories
When searching for a file or backing up the system, we may visit the same directory several times, or even infinite times if there are cycles.
Solution to Cycles in General Graph Directories
Ignore links when traversing the file system
A file system must be ____ before it can be accessed
Mounted
How File System Mounting Works
- OS is given name of the device and a mount point
- OS checks device to make sure it has a valid file system
- OS makes the new file system available
True or False: Multiple file systems can be mounted at the same time
True (typically)