Purpose of File Systems
- Provide a convenient, efficient, robust way to store and manage programs and data
- File systems also support parts of the OS itself
- Key concepts:
- Fields: smallest logical item of data understood by a file-system
- Records: collection of fields; read/written as a single unit
- Files: collection of records, accessed by a unique name
- Access control: restricts operations for different users/programs
- Database: one or more logically related files; optimized for access and datatypes
The File Management System
- Provides system-call interface to manage files.
- Benefits:
- Centralised disk allocation and access
- Enables process scheduling during file access
- Manages buffers and resources efficiently
- Example file-related system calls:
- Create/Delete:
open(),creat(),close(),unlink() - Access contents:
read(),write(),lseek() - Access attributes:
chmod(),chown(),stat() - Directory ops:
mkdir(),rmdir()
- Create/Delete:
Quote
Ken Thompson, one of the original creators of Unix, was once asked what he’d do if he had it to do over again. He said, “I’d spell creat with an ‘e’.”
User Requirements (Multi-User Systems)
- Files must have a primary owner
- Users need to:
- Access files via symbolic names
- Create, read, write, delete files
- Respect access constraints on others’ files
- Backup/copy files
- Log and notify on unauthorized access
Components of the File Management System
- Device drivers: interface directly with hardware.
- Basic file system: maps blocks to physical locations, buffers data.
- I/O supervisor: schedules devices, allocates buffers.
- Logical I/O layer: manages requests, ownership, access info