Professional Documents
Culture Documents
Chapter 11: File System Implementation: Silberschatz, Galvin and Gagne ©2009 Operating System Concepts - 8 Edition
Chapter 11: File System Implementation: Silberschatz, Galvin and Gagne ©2009 Operating System Concepts - 8 Edition
Implementation
11.2
Objectives
To describe the details of implementing local file systems and directory
structures
11.3
File-System Structure
File structure
11.4
11.5
11.6
11.7
11.8
file systems.
VFS allows the same system call interface (the API) to be used for different
The API is to the VFS interface, rather than any specific type of file system.
11.9
11.10
Directory Implementation
Linear list of file names with pointer to the data blocks.
simple to program
time-consuming to execute
collisions situations where two file names hash to the same location
fixed size
11.11
Allocation Methods
An allocation method refers to how disk blocks are allocated for files:
Contiguous allocation
Linked allocation
Indexed allocation
11.12
Contiguous Allocation
Each file occupies a set of contiguous blocks on the disk
Simple only starting location (block #) and length (number of
Random access
Wasteful of space (dynamic storage-allocation problem)
Files cannot grow
11.13
Contiguous Allocation
Mapping from logical to physical
Q
LA/512
R
11.14
11.15
Extent-Based Systems
Many newer file systems (I.e. Veritas File System) use a modified
11.16
Linked Allocation
Each file is a linked list of disk blocks: blocks may be scattered anywhere on
the disk.
block
pointer
11.17
LA/511
Q
R
11.18
Linked Allocation
11.19
File-Allocation Table
11.20
Indexed Allocation
Brings all pointers together into the index block.
Logical view.
index table
11.21
11.22
of index block.
words and block size of 512 words. We need only 1 block for index
table.
LA/512
Q
R
11.23
Q1
LA / (512 x 511)
R1
Q2
R2
11.24
Q1
LA / (512 x 512)
R1
Q2
R2
11.25
outer-index
index table
11.26
file
11.27
Free-Space Management
Bit vector (n blocks)
0 1
n-1
bit[i] =
0 block[i] free
1 block[i] occupied
11.28
Example:
block size = 212 bytes
disk size = 230 bytes (1 gigabyte)
n = 230/212 = 218 bits (or 32K bytes)
No waste of space
Grouping
Counting
11.29
Bit map
Solution:
Allocate block[i]
11.30
Directory Implementation
Linear list of file names with pointer to the data blocks
simple to program
time-consuming to execute
collisions situations where two file names hash to the same location
fixed size
11.31
11.32
Performance
11.33
Page Cache
A page cache caches pages rather than disk blocks using virtual memory
techniques
11.34
11.35
11.36
11.37
Recovery
Consistency checking compares data in directory structure with data
Use system programs to back up data from disk to another storage device
11.38
system
If the file system crashes, all remaining transactions in the log must
still be performed
11.39
11.40
NFS (Cont.)
Interconnected workstations viewed as a set of independent machines with
independent file systems, which allows sharing among these file systems in
a transparent manner
The mounted directory looks like an integral subtree of the local file
system, replacing the subtree descending from the local directory
11.41
NFS (Cont.)
NFS is designed to operate in a heterogeneous environment of different
11.42
11.43
Mounting in NFS
Mounts
Cascading mounts
11.44
Export list specifies local file systems that server exports for
mounting, along with names of machines that are permitted to
mount them
Following a mount request that conforms to its export list, the server
The mount operation changes only the users view and does not affect
11.45
NFS Protocol
Provides a set of remote procedure calls for remote file operations. The
NFS servers are stateless; each request has to provide a full set of
arguments
(NFS V4 is just coming available very different, stateful)
Modified data must be committed to the servers disk before results are
11.46
Virtual File System (VFS) layer distinguishes local files from remote ones,
and local files are further distinguished according to their file-system types
11.47
11.48
separate NFS lookup call for every pair of component name and directory
vnode
To make lookup faster, a directory name lookup cache on the clients side
11.49
File-blocks cache when a file is opened, the kernel checks with the remote
Cached file blocks are used only if the corresponding cached attributes
are up to date
Clients do not free delayed-write blocks until the server confirms that the
11.50
11.51
11.52
Snapshots in WAFL
11.53
11.02
11.54
End of Chapter 11