Indexed allocation

 Indexed allocation is a file allocation method used by operating systems to manage how files are stored on disk. The core idea is simple but powerful: instead of storing a file in contiguous blocks or linking blocks one-by-one, the system uses a special index block that contains a list of all the disk block addresses where the file’s data is stored. This removes many limitations of earlier methods like contiguous and linked allocation.

In indexed allocation, each file has its own index block. This index block acts like a table of contents. Every entry inside it points to a data block that belongs to that file. When a file is created, the OS allocates an index block and then fills it with pointers to the actual data blocks as the file grows. These data blocks can be located anywhere on the disk, so the file does not need contiguous space. This makes storage much more flexible and avoids external fragmentation.

When the system needs to access a particular part of a file, it first looks at the index block, finds the corresponding block number, and directly accesses that block. This means random access is very efficient compared to linked allocation. In linked allocation, you would have to traverse multiple pointers to reach a specific block, but here, you can jump directly using the index. This is especially useful for large files and applications where frequent random reads are required.

However, indexed allocation introduces some overhead. The index block itself occupies disk space, even for small files. If a file is very small, the index block may be underutilized, leading to internal fragmentation. Also, if the file becomes very large, a single index block may not be sufficient to store all the block addresses. To handle this, operating systems use techniques like multi-level indexing  where index blocks point to other index blocks.


Pointer overhead means the extra storage space used to store pointers (addresses) instead of actual data.


Comments

Popular posts from this blog

Thrashing

Basics of paging