Operating Systems
Fall 2014
File Systems
Myungjin Lee myungjin.lee@ed.ac.uk
1
Operating Systems Fall 2014 File Systems Myungjin Lee - - PowerPoint PPT Presentation
Operating Systems Fall 2014 File Systems Myungjin Lee myungjin.lee@ed.ac.uk 1 Interface Layers Interface Layers Std. App. Disk Runtime OS Code Library Device-type Procedure Dependent Commands Calls Whatever Syscalls 2
1
2
Device-type Dependent Commands Syscalls Procedure Calls Whatever…
3
Array of Blocks Directories, Directory Entries, Files,… Whatever / etc root OS + a tiny bit of file type / structure / etc root
4
/ etc root
Why does the OS define directories? Why not leave that to the library/application layer? (Why would you want to leave it to the app/library?)
5
6
7
8
bash$ cd /usr/local
bash$ cd /usr/local (absolute) bash$ cd bin (relative, equivalent to cd /usr/local/bin)
9
10
fd = open(“/one/two/three”, O_RDWR);
11
12
13
/etc/passwd /home/gribble /home/guest root rw rw rw gribble r rw r guest r principals
ACL capability
14
15
16
17
18
19
20
22
inode_size)
23
bash$ ls -i /home/foo 287663 /home/foo (This is the inode number of “foo”) bash$ ln /home/foo /tmp/foo bash$ ls -i /home/foo /tmp/foo 287663 /home/foo 287663 /tmp/foo
to read or write the file.
24
25
26 1 10 11 12
… … … … … …
27
28
29
30
superblock inode free list file block free list
inode for ‘/’ directory ‘/’ (table of entries) inode for ‘usr/’ inode for ‘var/’ directory ‘var/’ (table of entries) directory ‘usr/’ (table of entries)
‘bigfile.bin’ data blocks
indirection block
data blocks
Indirection block
data blocks
indirection block
31