You are on page 1of 10

File System

Contiguous Allocation
Linked Allocation
File Allocation Table (FAT)
1 6
2 0
3 5
4 -1
5 7
6 -1
7 11
8 0
Filename Length Index
9 -1
“a” 2 1
10 9
“b” 4 3
“c” 3 12 11 -1

“d” 1 4 12 10
Indexed Allocation
Characteristics of Files
 Most files are small
 Few files are large
 Most of the space is occupied by the big files
Blocksize Trade-Offs

• Assume all files are 2KB in size (observed median files is about 2KB)
 Larger blocks: faster reads (because seeks are amortized & more bytes
per transfer)
 More wastage (2KB file in 32KB block means 15/16 th are unused)
UNIX BSD 4.1
UNIX BSD 4.1
 Key idea:
 Efficient for small files.
 Allow big files as well.
 File Header is called an “Inode”
 “Inode” contain “Metadata of file”
 Owner and Group Ownership
 Timestamp
 Access time
 Modification time
 Inode modification time
 File Size
 File type
 Regular File
 Directory
 Disk address of data block
 It contains 13 pointers
– First 10 pointers are to data blocks.
– Pointer 11 points to “indirect block” containing pointers to 256
data block.
– Pointer 12 points to “doubly indirect block” containing 256 indirect
block pointer for total of 64K data blocks.
– Pointer 13 points to a triply indirect block (16M Data blocks).
UNIX BSD 4.1
 For a sample file:
How many accesses for
block #23 ?
 Two: One for indirect block,
one for data
 How about block #5?
 One: One for data
 Block #340?
 Three: double indirect block,
indirect block, and data
 Pros:
 Simple
 Small files access cheap and easy.
 Files can easily expand (up to a point)
 Cons:
 Lots of seeks
 Very large files must read many indirect blocks (four I/Os per block!)

You might also like