Projects Inventory

Simulation of File Allocation Methods Gaming Project in C++

Explanation

  1. Class FileSystem:
    • Purpose: Simulates a file system with different file allocation methods.
    • Attributes:
      • blocks: Vector indicating the status of each block (allocated or free).
      • Advertisement
    • Methods:
      • allocateContiguous(int fileSize, int& startBlock): Allocates contiguous blocks for a file, if possible, and sets the start block.
      • allocateLinked(const std::vector<int>& fileBlocks, std::vector<int>& fileTable)
        Advertisement
        : Allocates blocks for a file using linked allocation, maintaining a file table.
      • allocateIndexed(const std::vector<int>& fileBlocks, std::vector<int>& indexTable): Allocates blocks for a file using indexed allocation, maintaining an index table.
      • printBlocks(): Prints the status of all blocks in the file system.
  2. Main Function:
    • Setup: Prompts the user for the total number of blocks in the file system.
    • User Interaction: Allows the user to select an allocation method and input file blocks or size.
    • Allocation: Executes the selected allocation method and prints the result.
    • Block Status: Displays the final status of all blocks in the file system.
    • Advertisement

Usage

Exit mobile version