file system backend

Complete

Summary

Free space management

FeatureBitmapLinked List
Storage Overhead1 bit per block1 pointer per free block
Ease of Finding Spaceeasy to scan for free or contiguous blocksmust traverse list
Finding Contiguous Blocksefficient (scan for sequence of 0s)difficult
Allocation Speedmoderate (may need to scan bitmap)fast (take from head)
Deallocation Speedfast (flip bit)fast (add block to list)
Memory Usagecompact and predictabledepends on number of free blocks
Disk Locality Awarenessgood (can choose nearby blocks)poor (no global view)

Concept

Free space management

  • need to know which blocks are free
  • stored in the partition details

Bitmap

  • each block is represented as a bit
  • 0 for occupied and 1 for free
  • pros:
    • good set of manipulations
  • cons:
    • need to keep in memory for efficiency

Linked list

  • SLL with number of free blocks in this hole, pointer to next hole
  • pros:
    • easy to locate free block
    • only first pointer stored in memory
  • cons:
    • high overhead

Directory structure

  • map file name to file info
  • keep track of files in directories

Linear list

  • directory is a list of files
  • each file entry is a pointer to file info
  • requires linear search - can be spead up by caching last searches

Hash table

  • hash by file name
  • fast lookup
  • needs a good hash function

File operations

File creation

  1. locate parent dir in directory structure
  2. find free disk blocks
  3. add entry in parent dir with file info

File open

  1. locate file in directory structure
  2. load file into system-wide table
  3. create entry in process table to the entry in the system-wide table
  4. return pointer to this entry