Escolar Documentos
Profissional Documentos
Cultura Documentos
Fred Kuhns
(fredk@arl.wustl.edu, http://www.arl.wustl.edu/~fredk)
Washington
WASHINGTON UNIVERSITY IN ST LOUIS
Why a file system
• There is a general need for long-term
and shared data storage:
– need to store large amount of information
– persistent storage (outlives process and
system reboots)
– concurrent sharing of information
• Files meet these requirements
• The file manager or file system within
the OS
Directory
Files
F 1 F 2 F 4
F 3
F n
• Naming problem
• Grouping problem
• Path name
• Can have the same file name for different user
• Efficient searching
• No grouping capability
Fred Kuhns (01/17/09) Cs422 – Operating Systems Organization 14
Tree-Structured Directories
boot block super block free space management inode list root dir files & dirs
block = pointer
index table
outerindex
index table file
0 ⇒ block[i] free
bit[i] =
1 ⇒ block[i] occupied
(hard) links /
sh local etc
/usr/local/bin/bash
bin
bash
Vnode/vfsVnode/vfs
In-memory Vnode/vfsVnode/vfs
In-memory Vnode/vfs
representation In-memory
representation In-memory
In-memory
representation
of file of file representation
representation
of file of file
of file
Fred Kuhns (01/17/09) Cs422 – Operating Systems Organization 48
File Systems
System calls
vnode interface
cylinder
inode name
8 . Di_mode (2)
45 .. di_nlinks (2)
0 “” di_uid (2)
123 myfile di_gid (2)
di_size (4)
di_addr (39)
di_gen (1)
di_atime (4)
di_mtime (4)
2 byte 14byte di_ctime (4)
cks
5
6 blo
7
256
8 k s
l o c
9 b
3 6
10 - indirect 5 , 5
11 - double indirect 6
12 - triple indirect 16,777,216 blocks
Fred Kuhns (01/17/09) Cs422 – Operating Systems Organization 57
BSD - FFS
Free
Hash (device,inode) (LRU)