



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of file systems, focusing on locality, access methods, and protection. Topics include estimating disk latencies, file organization, types, and basic operations. Access methods discussed include sequential, direct, record, and indexed access. Protection systems ensure file security by controlling access for users and programs.
Typology: Slides
1 / 35
This page cannot be seen from the preview
Don't miss anything!




























-^
The ugly guts of a hard disk.–^
Data is stored on double-sided magnetic disks called platters.
-^
Each platter is arranged like a record, with many concentric tracks.
-^
Tracks are further divided into individual sectors, which are the basic unit ofdata transferdata transfer.
-^
Each surface has a read/write head like the arm on a record player, but allthe heads are connected and move together.
-^
A 1TB Hitachi Deskstar has:–^
2 platters (4 surfaces)
-^
4 heads
-^
512 bytes/sectorL^
i^
l l^
t (^
d^
t^
ti^
ll )
Platters Tracks
-^
Logical layout (mapped automatically):•^
16 heads
-^
63 sectors/track
-^
16 383 cylinders (tracks)
Platter
Sectors
16,383 cylinders (tracks)
Track
3
-^
other trackother track.
-^
track, then seek time is much smaller. In other words, localityis important!
5
Estimating Disk Latencies (rotational latency)Estimating
Disk Latencies (rotational latency)
-^
Once the head is in place, we need to wait until the right sectoris underneath the head.–
This may require as little as no time (reading consecutive sectors)or as much as a full rotation (just missed it).– On average, for random reads/writes, we can assume that the diskspins halfway.
-^
Rotational delay depends partly on how fast the disk plattersspin.Average rotational delay = 0 5 x rotations x rotational speedAverage rotational delay = 0.5 x rotations x rotational speed–
For example, a 5400 RPM disk has an average rotational delay of:
0 5
t ti
/ (
t ti
/^
i^
t )
5 55
0.5 rotations / (5400 rotations/minute) = 5.55 ms
6
Andromeda
Tape /OpticalRobot
10
9
2,000 Years
Disk
10
6
2 Years
Pluto
Memory
100
Olympia
1.5 hr
MemoryOn Board Cache^ On Chip Cache 102 100
This BuildingThis Room
10 min
2
Registers 1
My Head
1 min
© 2004 Jim Gray, Microsoft Corporation
8
-^
9
NT
Unix
hFil B ff
(h^
dl^
)
)
close(fd)• unlink(name)• rename(old, new)
py
(^
)
(^
,^
)
11
Some file systems provide different access methods thatspecify ways the application will access dataspecify ways the application will access data– sequential access
direct access• random access given a block/byte #
y
Why do we care about distinguishing sequential fromdirect access?– what might the FS do differently in these cases?
12
A directory is typically just a file that happens to containspecial metadata– directory = list of (name of file, file attributes)– attributes include such things as:
g
the directory list is usually unordered (effectivelyrandom)• when you type “ls”, the “ls” command sorts the
results for youresults for you
user process to write a directory with ordinary I/O calls,even if the user created/owns it
Why?
even if the user created/owns it. Why?
14
-^
Let’s say you want to open “/one/two/three”^ fd =
open(“/one/two/three”, O_RDWR);
-^
What goes on inside the file system?– open directory “/” (well known, can always find)
h th
di
t^
f^
“^
”^
t l^
ti^
f “^
”
FS spends lots of time walking down directory paths– this is why open is separate from read/write (session state)– OS will cache prefix lookups to enhance performance
15
-^
-^
-^
-^
-^
ugly in the process
-^
17
All Unix disks are divided into five partsAll
Unix disks are divided into five parts
-^
Boot block– can boot the system by loading from this block
-^
Superblock– specifies boundaries of next 3 areas, and contains
h^
d^
f f
li t
f i^
d^
d fil
bl^
k
head of freelists of inodes and file blocks
-^
i-node area– contains descriptors (i-nodes) for each file on the disk;
all i nodes are the same si e head of freelist is in theall i-nodes are the same size; head of freelist is in thesuperblock
-^
File contents area
fixed size blocks; head of freelist is in the superblock
Swap area– holds processes that have been swapped out of
memorymemory
18
User number
-^
Group number
-^
Protection bitsTi
(fil
l^
t^
d fil
l^
t^
itt
i^
d^
l^
t^
itt^
Times (file last read, file last written, inode last written)
-^
File code: specifies if the i-node represents a directory, anordinary user file, or a “special file” (typically an I/O device)
y^
p^
( yp
y^
Size: length of file in bytes
-^
Block list: locates contents of file (in the file contents area)
thi
Link count: number of directories referencing this i-node
20
-^
21