IT lexicon › Infra & Ops › First-fit

First-fit

Infra & Ops På svenska → Updated: 2026-11-16

An allocation strategy that takes the first free block large enough — fast but can cause fragmentation to accumulate at the start of the free list.

First-fit is simple: iterate through free blocks, and when you find one large enough for the file, allocate it and stop. Advantage: very fast, O(1) on average. Disadvantage: fragmentation concentrates at the beginning of the list — many small free blocks accumulate early, forcing later allocations to skip over them to find larger blocks.

A classic example: if you allocate files of sizes [4, 2, 3, 2, 3, 2], you're left with holes [1, 1, 1, 1, 1] — many tiny fragments at the start. Next-fit tries to mitigate this by resuming the search from where it stopped last time. Best-fit reduces fragmentation by scanning the whole list, but becomes slow.

← Back to the lexicon