Main Memory: Allocation, Linking & Segmentation

contiguous allocation

Imagine seating families at a long banquet table where each family must sit together in one unbroken run of chairs. A family of four needs four adjacent empty seats — not two here and two over there. Contiguous allocation is this rule applied to memory: each process is given a single, unbroken block of physical RAM, from some starting address up to its size, all in one piece.

Concretely, in the earliest scheme memory is divided into the OS region and a user region, and each process gets one contiguous chunk of that user region. The hardware just needs the base and limit registers per process to relocate and protect it. There are two flavours. Fixed (static) partitioning carves memory into a set of preset-size slots; a process is dropped into a slot big enough to hold it. Variable (dynamic) partitioning has no preset slots: the OS keeps a list of holes (free runs) and carves out exactly the size each new process needs, leaving a smaller hole behind. As processes come and go, the free memory becomes a patchwork of holes.

Why it matters: contiguous allocation is simple and the hardware is cheap (just base and limit), which is why it came first and still appears in simple embedded systems. But because every process must fit in one continuous run, it suffers badly from fragmentation — free memory ends up scattered in pieces too small to use even when the total free amount is plenty. That single weakness is what motivated the dynamic-fit strategies, compaction, and ultimately paging.

Memory has free holes of 100 KB, 30 KB, and 60 KB. A new 90 KB process needs one contiguous run, so only the 100 KB hole can hold it — even though 30 + 60 = 90 KB is free elsewhere, it cannot be used because it is not contiguous.

The 'must be one piece' rule is exactly what makes scattered free memory unusable.

Contiguous allocation requires each process to occupy one continuous block, which directly causes external fragmentation. Paging later removes this requirement, which is its biggest advantage.

Also called
contiguous memory allocation連續記憶體配置