operating-systems file-management
Definition
Blocking
Blocking is the mapping of logical user records onto physical disk blocks. Since the size of a user record rarely matches the fixed size of a hardware sector, the OS must pack or split records to optimise storage.
Blocking Methods
1. Fixed Blocking
Records have a fixed length, and an integral number of records are packed into each block.
- Wastage: Any remaining space at the end of a block is wasted (internal fragmentation).
2. Variable Blocking Spanned
Records have variable lengths and can span across multiple block boundaries.
- Advantage: Zero wastage within the block.
- Disadvantage: Reading a spanned record requires at least two block IO operations.
3. Variable Blocking Unspanned
Records have variable lengths but are never allowed to span a block boundary.
- Wastage: If a record cannot fit in the remainder of the current block, that space is wasted, and the record starts in the next block.