Ex 09
Ex 09
File system typically follow a layered architecture, where each level builds on the one below
it:
- I/O Control Layer: Handles physical data transfer between disk and memory using device
drivers and interrupt handlers.
- Basic File System: Manages reading and writing raw disk blocks via generic commands.
- File-Organization Module: Maps logical file blocks to physical disk blocks, manages free
space, and handles block allocation.
- Logical File System: Manages metadata including directory structures, file-control blocks
(FCB), and access control.
- Volume Control Block: Stores volume information (e.g., block size, free blocks, and number
of files). Called the superblock in UFS and master file table in NTFS.
- System-wide Open-File Table: Tracks all open files across the system.
Image: FCB.png
- Per-Process Open-File Table: Keeps file handles specific to each process, linked to the
system-wide table.
Disks are divided into partitions, each treated as a separate logical disk. A partition may be:
Image: VFS.png
Section 12.3: Directory Implementation
Two primary methods are used to implement directory structures:
- Linear List: A simple list of file names and pointers to file data blocks. It’s easy to
implement but inefficient for large directories due to slow search times.
- Hash Table: Improves lookup speed by hashing file names to quickly locate entries.
- Contiguous Allocation: Files occupy a continuous block range on disk. It supports fast
access but suffers from:
- Linked Allocation: Each file block contains a pointer to the next block. While it eliminates
external fragmentation and simplifies growth:
- A variation, File Allocation Table (FAT), centralizes the block pointers into a table
indexed by block number.
- Indexed Allocation: An index block contains all pointers to a file’s data blocks. It supports
both direct and sequential access and avoids fragmentation. For large files:
- UNIX-based file systems use inodes that store a combination of direct and indirect
pointers.