File System · 4.2

File Allocation Methods

The allocation method decides how a file’s blocks are placed on disk. Good placement makes files quick to read while leaving enough flexibility for growth and deletion.

Compare the three classic methods
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
file datafree block

Selected method

Contiguous

Data blocks

5 blocks

Main trade-off

External fragmentation

How each method works

Contiguous allocation

Stores all blocks together. It offers fast sequential and direct access, but a growing file may need a new run and free space can become fragmented.

Linked allocation

Places blocks anywhere and stores a pointer in each block. There is no external fragmentation, but following a chain makes direct access slower.

Indexed allocation

Keeps all data-block addresses in an index block. It supports direct access and scattered blocks, with extra space needed for the index.

Real-world analogy: Finding seats

Contiguous allocation gives a group one row of seats, linked allocation gives each person directions to the next seat, and indexed allocation gives you a seating chart with every seat number.
Exam-ready comparison
MethodDirect accessGrowthMain weakness
ContiguousExcellentDifficultExternal fragmentation
LinkedSlowEasyPointer overhead
IndexedGoodEasyIndex-block overhead
Quick quiz

1. Which method stores file blocks in one consecutive run?

2. What does a linked-allocation block usually contain besides data?