Chapter 11: File-System Interface¶
File Concept and Attributes¶
A file is a named collection of related information stored on secondary storage. Operating systems abstract physical storage into logical files.
File Attributes¶
Common attributes stored in a file’s metadata include:
Name – Human-readable identifier.
Identifier – Unique internal tag (numeric or handle).
Type – Indicates format (text, binary, executable).
Location – Pointer to file location(s) on disk.
Size – Current file size.
Protection – Access permissions (read/write/execute).
Timestamps – Creation, last modified, last accessed.
Owner / Group – Security and accountability.
These attributes are stored in system structures such as FCBs (File Control Blocks) or inodes.
File Operations¶
OS provides system calls to manipulate files:
Create() Allocates space for metadata; establishes a new directory entry.
Open() Loads metadata into memory; returns a file handle.
Close() Writes metadata back to disk; releases handle.
Read() Transfers data from file to memory buffer.
Write() Updates content and may expand file size.
Seek() Moves file pointer to a specific location.
Delete() Removes directory entry and releases storage blocks.
Truncate() Deletes file contents but keeps attributes intact.
The OS tracks file positions and permissions with open-file tables.
Directory Structure¶
A directory contains file names and pointers to file metadata. It provides a user-friendly organizational hierarchy.
Directory Operations¶
Search for a file.
Create/delete files or subdirectories.
List directory contents.
Rename files.
Traverse the directory tree.
Directory Organization Schemes¶
Single-Level Directory Simple but causes name conflicts.
Two-Level Directory Separate directory per user.
Tree-Structured Directory Hierarchical folders; supports pathnames.
Acyclic-Graph Directory Allows shared subdirectories or files via links.
General Graph Directory Allows cycles; requires careful traversal.