Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

What is contiguous allocation of disk space?

Khizar Hayat Saani

An allocation method defines how to store a file within the disk.

The operating system uses the file or disk space allocation method to store files in an efficient manner that allows for the utilization of disk space and fast access to the file.

Contiguous allocation

Within the scope of contiguous allocation, each individual file or process is contained in a single contiguous section of the disk memory.

The memory may be divided into fixed-sized or variable-sized partitions to achieve contiguous memory allocation.

Contiguous allocation

Fixed-sized partitions

In this technique, the memory is divided into fixed-sized (or static) partitions. As indicated by its name, the size of the partitions cannot be changed.

Fixed-sized partition of memory may lead to internal fragmentation.

Internal fragmentation occurs if the memory allotted to a particular file exceeds its requirement. The excess memory inside the partition is wasted, as the entire memory block is considered to be occupied and another file cannot be stored within the block regardless of its size.

Internal Fragmentation

Variable-sized partitions

In this technique, the memory is partitioned dynamically as per the size of the file. Variable-sized (or dynamic) partitioning overcomes the problem of internal fragmentation, as each file is allocated memory according to its requirement.

However, dynamic partitioning offers no solution to external fragmentation.

External fragmentation occurs when there is sufficient space available to accommodate a file within the disk but in a non-contiguous manner. It usually occurs after a file has been removed from the memory. The memory outside the dynamically allocated partitions is wasted.

External Fragmentation

Inside the disk

The directory contains a pointer to the starting block of the file and the length of each file.

Let’s look at an example:

Inside the disk

In the above example, our disk stores four files. All four files can be accessed easily using the directory that stores both the physical address of the starting block of a file and the length of the file.

As memory allocation is contiguous, it is possible to directly access any file block.

Pros and cons



Easy to implement


Supports random/direct access

Difficult to increase size of file



Khizar Hayat Saani
Copyright ©2022 Educative, Inc. All rights reserved

View all Courses

Keep Exploring