How an OS maps files to physical disk sectors determines everything — access speed, fragmentation behavior, and storage efficiency. Explore all three allocation strategies and the buffering pipeline that feeds the CPU.
A disk is divided into fixed-size blocks (also called clusters), numbered sequentially from 0 to N−1. Every file must be stored across some subset of these blocks. The allocation strategy decides which blocks a file gets.
Time for disk arm to reach the right track. Scattered blocks = more seeks = slower access.
External: free space in non-contiguous holes. Internal: unused space within allocated blocks.
Sequential reads benefit from contiguous blocks. Random access needs direct block pointers.
Red dashed = external fragmentation hole after File A deleted
| Block# | Next Block | File |
|---|---|---|
| 2 | 8 | notes.txt |
| 3 | -1 | data.csv |
| 8 | 15 | notes.txt |
| 10 | 14 | data.csv |
| 15 | 21 | notes.txt |
| 21 | EOF | notes.txt |
CPUs operate at GHz speeds. Disks operate at millisecond speeds. Buffering bridges this gap — intermediate memory staging areas that decouple the producer and consumer so neither waits unnecessarily.
CPU blocks entirely on every I/O — utilization as low as 10–15% on disk-heavy tasks.
I/O and CPU alternate on one slot — idle time remains whenever one side finishes before the other.
While CPU drains Buffer A, I/O fills Buffer B — near-zero CPU idle for sequential workloads.
Head/tail pointers advance around a ring — maximum throughput for burst I/O; used in audio drivers, network stacks, and video streaming.
| Criterion | Contiguous | Linked | Indexed |
|---|---|---|---|
| Sequential Access | Excellent | Good | Good |
| Random Access | O(1) — Direct | O(n) — Traverse | O(1) — Via index |
| External Fragmentation | High over time | None | None |
| File Growth | Difficult | Easy — append block | Limited by index |
| Overhead | Minimal (start+len) | Pointer per block | Full index block |
| Directory Entry | Start + Length | Start block only | Index block # |
| Real-World Usage | CD-ROM, ISO | FAT12/16/32 | ext2, ext4, UNIX |
Allocate files, watch fragmentation form, traverse FAT chains, and inspect index blocks — all in real time.
Launch BLOCK//STORE Simulator