OS Presentatio Topic
OS Presentatio Topic
Disks offer direct access, meaning any block on the disk can be
accessed directly without following a sequence.
1. Contiguous Allocation
2. Linked Allocation
3. Indexed Allocation
Each method has its own set of strengths and weaknesses, and while
some systems support all three, a typical file system usually adopts just
one method.
1. Contiguous Allocation
Accessing Files:
Advantages:
Fast Access: Minimal disk head movement is required for
sequential access.
Disadvantages:
2. Linked Allocation
File Structure: Only the pointer to the first block is stored in the
directory. The rest of the blocks can be anywhere on the disk, and
they are linked through the pointers in the blocks themselves.
Advantages:
Flexible File Size: The file can grow without having to pre-allocate
space, as new blocks can be added as needed.
Disadvantages:
3. Indexed Allocation
Accessing Files: To access a block in the file, the system first looks
up the index block, finds the correct pointer, and then accesses the
data block.
Advantages:
Disadvantages:
Space Overhead: The index block takes up space, and for small
files, it can waste a lot of space. For instance, if a file only requires 2
blocks, the system might still allocate an entire index block, which is
inefficient.
Complexity: For larger files, the index block might need to be split
into multiple index blocks (called multilevel indexing), which can
make accessing files slightly more complex.
Summary Comparison
Contiguous Allocation: Fast and simple, but suffers from external
fragmentation and space allocation challenges.
Accessing Files:
1. Efficient Access:
o Fast Sequential Access: Since the file occupies consecutive
blocks, accessing the next block is fast, with minimal or no
disk head movement.
1. External Fragmentation:
2. Space Estimation:
3. File Growth:
2. Compaction:
3. Extent-based Allocation:
File Structure: A file is a linked list of disk blocks. Each disk block
contains data, along with a pointer to the next block in the file. The
last block in the chain contains a special marker indicating the end
of the file (e.g., a null pointer).
1. No External Fragmentation:
o Since the blocks of the file can be scattered across the disk,
there is no issue of external fragmentation (i.e., unused gaps
between files), and any available block can be used to extend
a file.
2. Pointer Overhead:
3. Reliability Concerns:
1. Clustered Allocation: