Simulation of Edge Computing Gaming Project in C++

Explanation

  1. Class Task:
    • Purpose: Represents a task with an ID and a data size.
    • Attributes:
      • id: Identifier for the task.
      • dataSize: Size of the task’s data.
      • isCompleted: Status of whether the task has been completed.
    • Methods:
      • getId(), getDataSize(): Accessors for task attributes.
      • isTaskCompleted(): Checks if the task is completed.
      • markAsCompleted(): Marks the task as completed.
  2. Class EdgeDevice:
    • Purpose: Represents an edge device capable of processing tasks.
    • Attributes:
      • id: Identifier for the edge device.
      • taskQueue: Queue of tasks to be processed.
    • Methods:
      • addTask(const Task&): Adds a task to the device’s queue.
      • processTasks(): Processes and completes all tasks in the queue.
  3. Class CentralServer:
    • Purpose: Manages task distribution to edge devices.
    • Attributes:
      • tasks: List of tasks to be distributed.
    • Methods:
      • addTask(const Task&): Adds a task to the server’s list.
      • distributeTasks(std::vector<EdgeDevice>&): Distributes tasks randomly among edge devices.
  4. Main Function:
    • Setup: Creates tasks and edge devices.
    • Server Actions:
      • Adds tasks to the central server.
      • Distributes tasks to edge devices.
    • Processing:
      • Each edge device processes its tasks.

Usage

  • Task Distribution: Demonstrates how tasks can be distributed to edge devices from a central server.
  • Processing Simulation: Simulates the processing of tasks on edge devices.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top