Professional Documents
Culture Documents
Chapter 06
Chapter 06
Chapter 06
File Systems
6.1 Files
6.2 Directories
6.3 File system implementation
6.4 Example file systems
1
Long-term Information Storage
2
File Naming
6
File Attributes
1. Create 7. Append
2. Delete 8. Seek
3. Open 9. Get attributes
4. Close 10.Set Attributes
5. Read 11.Rename
6. Write
8
An Example Program Using File System Calls (1/2)
9
An Example Program Using File System Calls (2/2)
10
Memory-Mapped Files
12
Two-level Directory Systems
13
Hierarchical Directory Systems
1. Create 5. Readdir
2. Delete 6. Rename
3. Opendir 7. Link
4. Closedir 8. Unlink
16
File System Implementation
17
Implementing Files (1)
19
Implementing Files (3)
An example i-node
21
Implementing Directories (1)
Block size
33
File System Performance (2)
Head pointer 53
36
FCFS
llustration shows total head movement of 640 cylinders.
37
SSTF
• Selects the request with the minimum seek
time from the current head position.
• SSTF scheduling is a form of SJF
scheduling; may cause starvation of some
requests.
• Illustration shows total head movement of
236 cylinders.
38
SSTF (Cont.)
39
SCAN/Elevator
• The disk arm starts at one end of the disk,
and moves toward the other end, servicing
requests until it gets to the other end of the
disk, where the head movement is reversed
and servicing continues.
• Sometimes called the elevator algorithm.
• Illustration shows total head movement of
208 cylinders.
40
SCAN/Elevator (Cont.)
41
LOOK/Elevator
• Version of SCAN
• Arm only goes as far as the last request in
each direction, then reverses direction
immediately, without first going all the way
to the end of the disk.
42
C-SCAN
43
C-SCAN (Cont.)
44
C-LOOK
• Version of C-SCAN
• Arm only goes as far as the last request in
each direction, then reverses direction
immediately, without first going all the way
to the end of the disk.
45
C-LOOK (Cont.)
46
Selecting a Disk-Scheduling Algorithm
• SSTF is common and has a natural appeal
• SCAN and C-SCAN perform better for systems that place
a heavy load on the disk.
• Performance depends on the number and types of
requests.
• Requests for disk service can be influenced by the file-
allocation method.
• The disk-scheduling algorithm should be written as a
separate module of the operating system, allowing it to be
replaced with a different algorithm if necessary.
• Either SSTF or LOOK/Elevator is a reasonable choice for
the default algorithm.
47
Log-Structured File Systems
• With CPUs faster, memory larger
– disk caches can also be larger
– increasing number of read requests can come from cache
– thus, most disk accesses will be writes
48
Example File Systems
CD-ROM File Systems
49
The CP/M File System (1)
BIOS had 17 I/O calls, OS in 3584 bytes, Shell in 2K, Zero page for h/w
interrupt handling
51
The MS-DOS File System (1)
52
The MS-DOS File System (2)
Bytes
Bytes
Checksum
55
The Windows 98 File System (3)
56
The UNIX V7 File System (1)
57
The UNIX V7 File System (2)
A UNIX i-node
58
The UNIX V7 File System (3)