Posts

Showing posts from March, 2026

Indexed allocation

Image
  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 fir...

linked list allocation

Image
In linked allocation , a file is divided into blocks (just like other methods), but instead of storing them contiguously, the blocks can be scattered anywhere on the disk . These blocks are connected using a linked list , where each block contains: The data A pointer to the next block The OS only stores the starting block address of the file. From there, it follows the pointers to access the entire file. Suppose a file F needs 4 blocks. Instead of storing them together, the OS may allocate: To read the file:  1. Start from first block 2. Read data 3. Follow pointer to next block 4. Repeat until NULL

File system and storage allocation types.

Image
A file system in an operating system is the component responsible for managing how data is stored, organized, accessed, and protected on a storage device like a disk. What a File System Deals With Types of storage allocation In contiguous allocation , a file is stored in continuous (adjacent) blocks on disk. The disk is already divided into fixed-size blocks, and when a file is created, the operating system allocates a sequence of consecutive blocks to store that file. So instead of scattering data, everything is placed next to each other. The OS only needs to store two things for each file: the starting block (base) and the length (number of blocks). For example, suppose a file F needs 4 blocks. The OS may allocate blocks 10, 11, 12, 13. So the file is stored as:  Start = 10 , Length = 4 . If the CPU wants to access the 3rd block of the file, it can directly calculate:  Physical block = Start + Offset = 10 + 2 = 12.  This makes access very fast, especially for sequenti...