Allocation Methods

Allocation method 決定 file logical block 要放在哪些 physical blocks。

file logical block i → physical device block ?

Classical Choices

MethodCore ideaFast atMain cost
D-OS-Ch14da-Contiguous_Allocationone file = one contiguous runsequential + direct accessexternal fragmentation、growth 難
D-OS-Ch14db-Linked_Allocationblocks form linked listsimple sequential growthrandom access 差、pointer risk
D-OS-Ch14dc-Indexed_Allocationpointers collected in index/inodedirect access、dynamic growthindex metadata overhead

現代 file systems 常混合:extentsFAT、direct/indirect pointers、extent trees。

Allocation method 會和 D-OS-Ch14e-Free_Space_Management 綁在一起:前者決定「怎麼記錄 file 的 blocks」,後者提供「哪些 blocks 可用」。效能比較見 D-OS-Ch14dd-Allocation_Method_Performance