File Systems - TarisMajor/5143-OpSystems GitHub Wiki
File Structure
The file structure in an operating system defines how data is logically stored and organized. It's crucial for efficient data retrieval and storage management.
File Attributes
Attributes are metadata associated with files, including:
- Name: The file's identifier.
- Type: Indicates the file's content type (e.g., text, binary).
- Location: Where the file is stored on the disk.
- Size: The file's size in bytes.
- Protection: Permissions indicating who can read, write, or execute the file.
- Timestamps: Information on creation, modification, and access times.
File Operations
Common operations include:
- Create: Creating a new file.
- Read: Reading data from a file.
- Write: Writing data to a file.
- Delete: Removing a file.
- Open/Close: Opening a file for access and closing it after operations are complete.
File System Implementation
This involves the methods and data structures used by the operating system to store, manage, and retrieve files on storage media.
Directory Structures
All files are contained in a single directory, simple but inefficient for larger systems.
Each user has a separate directory under a master directory, improving organization.
A hierarchical directory structure where directories can contain subdirectories and files, offering flexibility and scalability.
File Allocation Methods
Files occupy consecutive blocks on the disk. This simplifies access but can cause fragmentation.
Files are composed of linked blocks scattered throughout the disk, reducing fragmentation but potentially slowing access.
An index block points to the file’s scattered blocks, combining efficient access and reduced fragmentation.
Disk Scheduling Algorithms
Processes disk requests in the order they arrive, simple but can lead to inefficiency.
Selects the request closest to the current head position, optimizing seek time but can cause starvation.
The disk arm moves in one direction, fulfilling requests until it reaches the end, then reverses direction.
Like SCAN, but only services requests in one direction, then quickly returns to the start.
Similar to SCAN and C-SCAN but only goes as far as the last request in each direction.
Journaling
A technique ensuring data integrity by keeping a log (journal) of changes, enabling recovery in case of a crash.
RAID Levels
RAID (Redundant Array of Independent Disks) is used for data redundancy and performance improvement. Common levels include:
- RAID 0: Striping, no redundancy.
- RAID 1: Mirroring, data duplication.
- RAID 5: Striping with parity, balance between performance and redundancy.
- RAID 6: Similar to RAID 5 but with extra parity for more fault tolerance.
Access Control Lists (ACL)
ACLs specify which users or system processes are granted access to objects and what operations are allowed on given objects.