Course contentsShow
← Computer Science
Lesson 1401 of 2,87232. File SystemsFree lesson

File Allocation Methods: Indexed

Study indexed allocation with index blocks pointing to data blocks, enabling efficient random access.

File Allocation Methods: Indexed

What You'll Learn

You'll discover how indexed allocation uses a dedicated index block to keep track of all data blocks belonging to a file, enabling fast random access without the limitations of linked allocation.

The Core Idea

In indexed allocation, each file has its own index block that contains pointers (block addresses) to all the data blocks that hold the file's content. Think of it like a book's table of contents: instead of reading page-by-page sequentially, you can jump directly to any chapter because the index tells you exactly where it is.

When you create a file, the system allocates an index block and stores the addresses of all data blocks in this index. To access byte n in the file, the OS calculates which data block contains it, looks up that block's address in the index block, and jumps directly there.

Why This Matters

Efficient Random Access: Unlike linked allocation (lesson 1400) where you had to traverse a chain of pointers, indexed allocation lets you access any part of the file immediately—just consult the index.

No External Fragmentation: Like other non-contiguous methods, files can use any available blocks scattered across the disk.

Fixed Access Time: Whether accessing the first byte or the millionth, you always: read index block → find pointer → read data block. No chain traversal needed.

The Trade-off

The index block itself consumes space. For small files, dedicating an entire block to hold just a few pointers is wasteful (pointer overhead). For very large files, you might need multi-level indexing or linked index blocks to hold all the pointers—adding complexity.

Key Takeaway: Indexed allocation uses a dedicated index block containing pointers to all data blocks, providing O(1) random access at the cost of index storage overhead and complexity for extremely large files.