You are on page 1of 23

CHAPTER 13

FILES AND DIRECTORIES


IMPLEMENTATION OVERVIEW
 Directories and index structures

 Free space maps


 Locality heuristics
DIRECTORIES
 A directory is a file that contains file name to file
number mappings
DIRECTORIES
DIRECTORY INTERNALS
 Simple linear list of file (name, file number pairs)
DIRECTORY INTERNALS
 List with additional hash based structure

Logical view
DIRECTORY INTERNALS
 List with additional hash based structure

Physical storage
FILE METADATA
 Includes file size, owner, reference count, access
time etc.
 Can be stored in a file header or directory entries

 Storing metadata in directory entries is problematic


if the file system supports multiple hard links to a
file
FILE SYSTEM GOALS
 Sequential data placement
 Efficient random access

 Efficiently support both small and large files

 Store metadata
FAT FILE SYSTEM
 File number is the
index of the files first
entry in FAT
 At most 228 blocks

 32 bit entries

 One entry for each


block
 Max file size 232 -1
bytes
 End of file is indicated
by special value
 Free block is indicated
by 0
FAT FILE SYSTEM
 Poor locality
 Poor random access

 Limited file metadata and access control

 No support for hard links

 Limitations on number blocks and file size


FFS: INDEX STRUCTURE
FFS: CHARACTERISTICS
 Tree structure
 High degree

 Fixed structure

 Asymmetric
FFS: LOCALITY HEURISTICS
 Block group placement
 Files data and metadata are placed nearby
 Different files from the same directory are placed
close to each other
 Files from different directories are placed far from
each other
 Reserved space
 Improve the performance when the disk is almost full
FFS: LOCALITY HEURISTICS
FFS: LOCALITY HEURISTICS
NTFS FILE SYSTEM
 Two main characteristics
 Extents
 Flexible tree
MASTER FILE TABLE (MFT)
 Stores an array of 1KB records
 Each record is a sequence of attributes

 Both data and meta-data are considered


attributes of a file
 Two types of attributes
 Resident
 Non-resident
REFERENCE
Chapter 13
Operating Systems: Principles & Practice
Thomas Anderson and Michael Dahlin

You might also like