File Allocation Table
File Allocation Table(FAT)是 D-OS-Ch14db-Linked_Allocation 的變形:file 仍是 block chain,但 next pointers 集中在 volume 的 FAT table。
directory entry: start block = 217
FAT[217] = 618
FAT[618] = 339
FAT[339] = EOFTable Meaning
FAT[x] = y:block x 的下一個 file block 是 y。FAT[x] = EOF:block x 是最後一個 block。FAT[x] = free:block x 尚未配置。
Directory entry 只要記 first block;讀取時從 FAT chain 走到 EOF。
Tradeoff
- 優點:data block 不用放 pointer;FAT 可 cache 在 memory;free-space accounting 可整合。
- 限制:large volume 的 FAT 很大;random access 仍要沿 chain 走,不是 O(1);若 FAT 沒 cache,HDD 可能在 FAT 區與 data 區來回 seek。
FAT 適合簡單 media;現代 general-purpose file systems 多偏好 extents 或 indexed/extent trees。