File System Implementation OS
File System Implementation OS
• File-System Structure
• File-System Implementation
• Directory Implementation
• Allocation Methods
• Free-Space Management
• Efficiency and Performance
• Recovery
• Log-Structured File Systems
• NFS
• Example: WAFL File System
Objectives
• To describe the details of implementing local
file systems and directory structures
• To describe the implementation of remote file
systems
• To discuss block allocation and free-block
algorithms and trade-offs
File-System Structure
• File structure
– Logical storage unit
– Collection of related information
• File system resides on secondary storage
(disks)
• File system organized into layers
• File control block – storage structure
consisting of information about a file
Layered File System
A Typical File Control Block
In-Memory File System Structures
• The following figure illustrates the necessary
file system structures provided by the
operating systems.
• Contiguous allocation
• Linked allocation
• Indexed allocation
Contiguous Allocation
• Each file occupies a set of contiguous blocks on the
disk
• Random access
LA/512
block = pointer
Linked Allocation (Cont.)
• Simple – need only starting address
• Free-space management system – no waste of space
• No random access
• Mapping
Q
LA/511
R
index table
Example of Indexed Allocation
Indexed Allocation (Cont.)
• Need index table
• Random access
• Dynamic access without external fragmentation, but
have overhead of index block.
• Mapping from logical to physical in a file of maximum
size of 256K words and block size of 512 words. We
need only 1 block for index table.
Q
LA/512
R
Q1
LA / (512 x 511)
R1
Q1 = block of index table
R1 is used as follows:
Q2
R1 / 512
R2
outer-index
0 block[i] free
bit[i] =
1 block[i] occupied
• Performance
– disk cache – separate section of main memory for
frequently used blocks
– free-behind and read-ahead – techniques to optimize
sequential access
– improve PC performance by dedicating section of
memory as virtual disk, or RAM disk
Page Cache
• A page cache caches pages rather than disk
blocks using virtual memory techniques