RTUComputer ScienceYr 2023 · Sem 52023

Q6Operating System

Question

4 marks

Describe the file allocation methods.

Answer

An architectural review of File Allocation methodologies, contrasting the massive fragmentation flaws of Contiguous Allocation against the optimized pointer architecture of Linked and Indexed Allocation.

When a user saves a 50MB file to a physical Hard Disk Drive, the File System does not just dump the data randomly. It must mathematically determine exactly which physical disk blocks (sectors) will store the binary data, and how the OS will track those blocks. This is dictated by three primary allocation architectures.

1. Contiguous Allocation

The most primitive architecture. - Mechanism: The file is violently forced to occupy a single, continuous, mathematically unbroken sequence of physical blocks on the disk (e.g., blocks 50 to 100). - Merit: Blisteringly fast read speeds because the HDD Read/Write head moves linearly without jumping. - Demerit: It suffers from catastrophic External Fragmentation. Over time, as files are deleted, the disk shatters into microscopic holes. You might have 100MB free, but if it is not completely contiguous, you cannot save a 10MB file.

2. Linked Allocation

Engineered to completely annihilate external fragmentation. - Mechanism: The file is violently shattered into independent blocks scattered completely randomly across the disk. Every single block contains a hidden architectural pointer (a physical disk address) mathematically pointing to the exact location of the next block in the chain. - Demerit: Catastrophic random-access speeds. To read block 50, the OS must physically traverse the first 49 blocks one by one to follow the pointer chain.

3. Indexed Allocation

The highly advanced architecture utilized in modern systems (like Unix i-nodes). - Mechanism: For every single file, the OS creates a dedicated "Index Block." This massive array mathematically stores the exact physical disk addresses of every single block belonging to the file. To randomly access block 50, the OS simply reads array index 50 inside the Index Block and jumps directly to the physical disk location.

Back to Paper