Lec11 - Os - PK - Fs
Lec11 - Os - PK - Fs
ECE344
Lecture 11: File System
Ding Yuan
Big picture: performance
gap
1956: IBM 350, 24 inches, 1980: IBM 3380, first GB 1980: ST-560, first 5.25
3.75MB, 1KB/sec, > $150,000
disk (1.26G), > $100K inch drive, 5MB, $1500
• Disk components
• Platters
• Surfaces
• Tracks
• Cylinders
• Sectors
• Arm
• Heads
ECE344 - Operating Systems - Ding
10
Yuan
Another View of Disk
Rotational
delay
Seek Random disk access:
suffers one seek and
rotational delay
every time!
• File systems
• Implement an abstraction (files) for secondary
storage
• Organize files logically (directories)
• Permit sharing of data between processes,
people, and machines
• Protect data from unwanted access (security)
• • CreateFile(name, CREATE)
creat(name)
• CreateFile(name, OPEN)
• open(name, how)
• ReadFile(handle, …)
• read(fd, buf, len)
• WriteFile(handle, …)
• write(fd, buf, len)
• FlushFileBuffers(handle, …)
• sync(fd) • SetFilePointer(handle, …)
• close(fd) • DeleteFile(name)
• CopyFile(name)
• unlink(name)
• MoveFile(name)
ECE344 - Operating Systems - Ding
23
Yuan
Directories
• Directories serve two purposes
• For users, they provide a structured way to organize files
• For the file system, they provide a convenient naming
interface that allows the implementation to separate logical
file organization from physical file placement on the disk
30
Unix Inodes
• Unix inodes implement an indexed structure for files
• Also store metadata info (protection, timestamps, length, ref count…)
(Metadata)
0
1
…
…
1 (1)
1
2 (2)
1
3 (3)
4 … …
ECE344 - Operating Systems - Ding
31
Yuan
Unix Inodes and Path
Search
• Unix Inodes are not directories
• Inodes describe where on the disk the blocks for a file are
placed
• Directories are files, so inodes also describe where the blocks
for directories are placed on the disk
instructions
of ls.. ..
• Issues
• The file buffer cache competes with VM (tradeoff here)
• Like VM, it has limited size
• Need replacement algorithms again (LRU usually used)
38
Fast File System
• BSD FFS addressed these problems using the notion
of a cylinder group
• Disk partitioned into groups of cylinders
• Data blocks in same file allocated in same cylinder
• Files in same directory allocated in same cylinder
• Inodes for files allocated in same cylinder as file data
blocks