Loading learning content...
Despite the fragmentation challenges we've explored, contiguous allocation remains the optimal choice for specific scenarios. When files never change after creation, fragmentation never develops—and the performance advantages become pure benefit with no downside.
This page explores the real-world applications where contiguous allocation delivers its full potential: read-only media, archival systems, and performance-critical static workloads.
By the end of this page, you'll understand the ideal use cases for contiguous allocation, how read-only media exploits its strengths, and how modern systems use contiguous allocation selectively for optimal performance.
CD-ROM, DVD, and Blu-ray discs use contiguous allocation almost universally. Here's why it's perfect:
No Fragmentation Possible:
Why Contiguous Matters for Optical Media:
| Media Type | File System | Block Size | Use Case |
|---|---|---|---|
| CD-ROM | ISO 9660 | 2 KB | Software distribution, music |
| DVD-ROM | UDF | 2 KB | Movies, games, data archives |
| Blu-ray | UDF 2.50+ | 2 KB | HD/4K video, large datasets |
| Audio CD | Red Book | 2352 bytes | Music (raw audio frames) |
The ISO 9660 file system standard for CD-ROMs was designed with contiguous allocation from the start. Each directory entry contains a Location (starting block) and Data Length—exactly the contiguous allocation model. The standard assumes files are written once and read many times.
OS installers and software distribution benefit enormously from contiguous allocation:
Installation Media Characteristics:
Performance Impact:
| File Type | Size | Contiguous Read | Fragmented Read |
|---|---|---|---|
| Windows ISO | 5 GB | ~50 seconds | ~5 minutes |
| Package Archives | 500 MB | ~5 seconds | ~30 seconds |
| Database Dump | 10 GB | ~100 seconds | ~10 minutes |
USB Boot Drives:
Even USB-based installation media uses contiguous allocation for the boot image. Tools like Rufus and dd create contiguous disk images because:
Long-term data storage systems favor contiguous allocation for its simplicity and reliability:
Tape Storage:
Magnetic tape—still used for cold storage in enterprises—is inherently sequential. Contiguous allocation aligns perfectly with tape's sequential nature, where seeking is measured in seconds, not milliseconds.
Operating systems use contiguous allocation for performance-critical system areas:
Swap Space/Page Files:
Why Swap Must Be Fast:
123456789101112131415161718192021222324252627282930313233343536
/* * Swap Space Allocation Strategy * * Swap should be contiguous for maximum performance * during memory pressure situations. */ typedef struct { uint64_t start_sector; uint64_t sector_count; uint64_t pages_per_sector;} swap_area_t; /* Allocate contiguous swap area */bool allocate_swap_area(swap_area_t *swap, uint64_t size_mb) { uint64_t sectors_needed = (size_mb * 1024 * 1024) / 512; /* Must find contiguous region */ swap->start_sector = find_contiguous_sectors(sectors_needed); if (swap->start_sector == INVALID_SECTOR) { /* Cannot create fragmented swap - too slow */ return false; } swap->sector_count = sectors_needed; swap->pages_per_sector = 512 / PAGE_SIZE; /* Usually 8 */ return true;} /* O(1) page address calculation - contiguous benefit */uint64_t swap_page_to_sector(swap_area_t *swap, uint32_t page_num) { return swap->start_sector + (page_num / swap->pages_per_sector);}Databases often pre-allocate contiguous storage for tables and indexes:
Why Databases Prefer Contiguous:
Modern Database Approach:
Databases pre-allocate storage in large chunks (e.g., 100 MB extents) on an empty disk before data is written. This ensures contiguous allocation even on file systems that otherwise fragment.
Modern file systems don't use pure contiguous allocation, but they incorporate its principles through extents—contiguous runs of blocks that form part of a file.
Extent-Based Allocation:
File Systems Using Extents:
| File System | Extent Support | Max Extent Size |
|---|---|---|
| ext4 | Yes (default) | 128 MB |
| XFS | Yes (native) | 8 EB theoretically |
| Btrfs | Yes | Variable |
| NTFS | Yes (runs) | 16 TB |
| APFS | Yes | Variable |
The Extent Advantage:
Extent-based systems try to allocate files contiguously but gracefully handle fragmentation when it occurs. A 1 GB file on ext4 might be:
You have completed the Contiguous Allocation module! You now understand how contiguous allocation works, its exceptional sequential performance, the challenge of external fragmentation, the costs of compaction, and where this allocation strategy remains optimal. Next, explore Linked Allocation to see how file systems overcome contiguous allocation's limitations.