Chapter 12: File System Implementation
Chapter 12: File System Implementation
File System Structure File System Implementation Directory Implementation Allocation Methods Free-Space Management Efciency and Performance Recovery Log-Structured File Systems
12.1
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 le.
12.2
12.3
12.4
Figure 12-3(a) refers to opening a le. Figure 12-3(b) refers to reading a le.
O perating Sy stem Concepts w ith Jav a 12.5 Silberschatz, Galv in and Gagne 2003
implementing le systems.
VFS allows the same system call interface (the API) to be used
le system.
12.6
12.7
Directory Implementation
Linear list of le names with pointer to the data blocks.
simple to program time-consuming to execute
12.8
Allocation Methods
An allocation method refers to how disk blocks are allocated for
les:
Contiguous allocation Linked allocation Indexed allocation
12.9
Contiguous Allocation
Each le occupies a set of contiguous blocks on the disk. Simple only starting location (block #) and length (number of
12.10
12.11
Extent-Based Systems
Many newer le systems (I.e. Veritas File System) use a
12.12
Linked Allocation
Each le is a linked list of disk blocks: blocks may be scattered
block
pointer
12.13
Simple need only starting address Free-space management system no waste of space No random access
12.14
Linked Allocation
12.15
File-Allocation Table
12.16
Indexed Allocation
Brings all pointers together into the index block. Logical view.
index table
12.17
12.18
Q1 LA / (512 x 512) R1
12.19
outer-index le
index table
12.20
12.21
Free-Space Management
Bit vector (n-bit word, represents n blocks) 0 1 2 n-1
68 7
If bit[i ] = 0 block[i ] free 1 block[i] occupied
12.22
Grouping [list of 1st n free blocks in 1st block] Counting [indicate 1st free block and number of consecutive free
blocks]
12.23
Directory Implementation
Linear list of le names with pointer to the data blocks.
simple to program time-consuming to execute
12.24
12.25
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 [only benets processes using this le, reduces memory for general use].
12.26
12.27
Page Cache
A page cache caches pages rather than disk blocks using
12.28
12.29
12.30
10
12.31
Recovery
Consistency checking compares data in directory structure
12.32
committed once it is written to the log. However, the le system may not yet be updated.
The transactions in the log are asynchronously written to the le
system. When the le system is modied, the transaction is removed from the log.
If the le system crashes, all remaining transactions in the log must still
be performed.
12.33
11