OS Part 04
OS Part 04
File Systems
4.1 Files
4.2 Directories
4.3 File system implementation
4.4 File system management and optimization
4.5 Example file systems
1
4.1 Files
2
Files
File Concept
3
Files
File Concept
Process/Thread CPU
Files Disk
4
Files
File Concept
file system
5
Files
File Naming
8
Files
File Types
12
4.2 Directories
13
Directories
Single-Level Directory Systems
14
Directories
Hierarchical Directory Systems
1. Create 5. Readdir
2. Delete 6. Rename
3. Opendir 7. Link
4. Closedir 8. Unlink
17
4.3 File System Implementation
18
File System Implementation
19
File System Implementation
Allocation Methods
20
File System Implementation
Allocation Methods: Contiguous allocation (1)
22
File System Implementation
Allocation Methods: Contiguous allocation (3)
23
File System Implementation
Allocation Methods: Linked allocation (1)
block = pointer
24
File System Implementation
Allocation Methods: Linked allocation (2)
25
File System Implementation
Allocation Methods: Linked allocation (3)
• File-Allocation Table
26
File System Implementation
Allocation Methods: Linked allocation (4)
index table
29
File System Implementation
Allocation Methods: Indexed allocation (2)
30
File System Implementation
Allocation Methods: Indexed allocation (3)
An example i-node
31
File System Implementation
Allocation Methods: Indexed allocation (4)
• Combined Scheme: UNIX (4K bytes per block)
32
File System Implementation
Implementing Directories (1)
38
File System Implementation
Virtual File Systems (1)
39
File System Implementation
Virtual File Systems (2)
A simplified view of the data structures and code used by the VFS
and concrete file system to do a read.
40
4.4 File system
Management and Optimization
41
File system
Management and Optimization
Disk Space Management (1)
Block size
44
File system
Management and Optimization
File System Backups (2)
A file system to be dumped. Squares are directories, circles are files. Shaded items have
been modified since last dump. Each directory and file is labeled by its i-node
number. 45
File system
Management and Optimization
File System Backups (3)
46
File system
Management and Optimization
File System Consistency
File system states. (a) Consistent. (b) Missing block. (c) Duplicate block
in free list. (d) Duplicate data block.
47
File system
Management and Optimization
Caching (1)
48
File system
Management and Optimization
Caching (2)
• Some blocks, such as i-node blocks, are rarely
referenced two times within a short interval.
49
File system
Management and Optimization
Reducing Disk Arm Motion
50
4.5 Example File Systems
51
Example File Systems
CD-ROM File Systems (1)
53
Example File Systems
Rock Ridge Extensions (3)
Rock Ridge extension fields:
• PX - POSIX attributes.
• PN - Major and minor device numbers.
• SL - Symbolic link.
• NM - Alternative name.
• CL - Child location.
• PL - Parent location.
• RE - Relocation.
• TF - Time stamps.
54
Example File Systems
Joliet Extensions (4)
55
Example File Systems
The MS-DOS File System (1)
56
Example File Systems
The MS-DOS File System (2)
58
Example File Systems
The UNIX V7 File System (2)
A UNIX i-node
59
Example File Systems
The UNIX V7 File System (3)