DP

L32_Ch12c

Chapter 12: File Management (Part C: Sections 12.6-12.7)

12.6 Record Blocking

  • Definition: Organizing records within blocks on secondary storage.

  • Methods of Blocking:

    • 1. Fixed-Length Blocking:

      • Fixed-length records used.

      • An integral number of records stored in a block.

      • Internal Fragmentation: Unused space at end of each block.

    • 2. Variable-Length Spanned Blocking:

      • Variable-length records packed into blocks with no unused space.

    • 3. Variable-Length Unspanned Blocking:

      • Variable-length records used but spanning isn't employed.

      • Fragmentation: A significant concern here.

  • Units of I/O: Records organized as blocks for input/output operations.

Illustration

  • Figure 12.8: Shows different blocking methods:

    • Red: Fragmentation in Blocks

    • Track representation with various recorded examples.


12.7 File Allocation

  • Basics of File Allocation:

    • On secondary storage, a file is a collection of blocks.

    • The system manages allocation of blocks to files.

    • The choice of allocation strategy influences free space management.

  • Allocation Structure:

    • Space allocated to files in contiguous portions (blocks).

    • Management through a File Allocation Table (FAT).

Pre-Allocation vs. Dynamic Allocation

  • Preallocation:

    • Requires declaration of maximum file size at creation.

    • Tends to be wasteful due to overestimation.

  • Dynamic Allocation:

    • Space allocated in portions as needed.

Portion Size Considerations

  • Trade-offs:

    1. Contiguity: Increases performance (important for transactions).

    2. Small Portitions: Result in larger tables needed for management.

    3. Fixed Size Portions: Simplifies reallocation of space.

    4. Variable-Size Portions: Minimize wasted storage.

Allocation Alternatives

  • Two Major Alternatives:

    1. Variable, Large Contiguous Portions:

      • Better performance with less waste.

    2. Small Fixed Portions:

      • Greater flexibility but may require more complex structures.

File Allocation Table Comparison (Table 12.2)

  • Types:

    • Contiguous (Necessary preallocation, Variable portion size).

    • Chained (Possible preallocation, Fixed blocks).

    • Indexed (Possible preallocation, Variable portion size).


Contiguous File Allocation

  • Advantages:

    • Efficient for sequential file types.

  • Disadvantages:

    • Can lead to fragmentation and unusable short block sequences.

Chained Allocation

  • Feature: Can use any free block on disk.

  • Disadvantage: Files may be scattered, violating locality.

Indexed Allocation

  • Key Point: Distinguish from indexed file types previously covered.

  • Indexes: Can accommodate both indexed and non-indexed files.

Free Space Management

  • Importance: Managing unallocated space is crucial.

  • Disk Allocation Table: Needed alongside File Allocation Table.

Free Space Management Methods

  • Bit Tables: Uses a vector indicating free blocks (0 for free, 1 for in use).

    • Advantages: Compact and compatible with all allocation methods.

  • Chained Free Portions: Uses pointers to link free portions together.

  • Indexing: Treats free space as a pseudo-file with an index.

  • Free Block List: Sequential numbering of free blocks maintained.

Volumes

  • Definition: Collections of addressable sectors in secondary memory.

  • Logical Disk: Presented as a separate disk to users.

  • Physical Layout: Need not be physically consecutive; logical continuity maintained.