This project simulates remote program execution using the OMNeT++ Discrete Event Simulator. In the simulation, a client node divides a computational task (for example, determining the maximum element in an array) into several subtasks and distributes them among other client nodes for parallel processing. The overall result is determined by aggregating the maximum received for each subtask. Additionally, client nodes do gosip message to all other clients after getting the task done.
- Task Partitioning:
- Divide an array of x integer elements (with x ≥ 2) into n approximately equal segments, ensuring each segment contains at least two elements.
Note: It is assumed that x is always at least 2.
- Dispatch each subtask to a client based on clientid = subtaskid % num_of_clients
- Divide an array of x integer elements (with x ≥ 2) into n approximately equal segments, ensuring each segment contains at least two elements.
The network consists of N client nodes arranged in a ring topology. Each client has a unique ID starting from 0 and is connected to its successor and predecessor in the ring. Additional connections are established to optimize message exchange complexity from O(N) to O(logN), inspired by the CHORD Distributed Hash Table protocol.
- A client node initializes a task (e.g., finding the maximum element in an array).
- The client divides the task into x subtasks, where x > N.
- For each subtask with ID i:
- The subtask is assigned to client with ID (i % N).
- The client routes the subtask to the target client using O(logN) message exchanges.
- Each client executes its assigned subtasks and sends results back to the requesting client.
- The requesting client consolidates results (e.g., finds the maximum among all returned values).
- After completing the task, the client sends gossip messages to all other clients.
- Once a client receives gossip messages from all N clients, it terminates.
- When a client completes a task, it generates a message in the format:
<self.timestamp>:<self.IP>:<self.ClientID#> - This message is transmitted to all adjacent nodes.
- When a node receives a message for the first time:
- It makes an entry in the Message Log (ML) to track the message.
- It forwards the message to all peers except the source peer.
- Subsequent receipts of the same message are ignored to prevent loops.
- Each client logs the result of each subtask it receives from other clients, both to the console and an output file.
- Each client displays the consolidated result of each task.
- Every gossip message received for the first time is displayed on the console and written to the output file, along with:
- A local timestamp
- The IP address (node ID) of the source node
README.md: This comprehensive documentation file.Makefile: Contains the build instructions for compiling the simulation project.topo.txt: Defines the network topology configuration parameters.- Source code files (e.g.,
*.ccand*.h) that implement the simulation logic. - OMNeT++ NED files (e.g.,
*.ned) that define the network topology or enable dynamic module creation. - The
config.pyfile, which dynamically generates the NED file based on the network topology specified in topo.txt.
The topology file defines the network structure including the number of clients and their connections.
This script reads the topology file and dynamically generates the NED file that defines the network structure for the simulation.
-
OMNeT++ Installation:
Ensure that OMNeT++ is installed on your system. For installation instructions, please refer to the OMNeT++ Install Guide. -
C++ Compiler:
A compatible C++ compiler is required to build the simulation project. -
Python:
Python is required to run the provided configuration script. -
Environment Setup:
Configure the necessary environment variables for OMNeT++.
-
Open a terminal and navigate to the OMNeT++ installation root directory.
-
Launch OMNeT++ by executing: bash
omnetpp -
Within the OMNeT++ IDE, select the CNAssignment2 project.
-
Update the network topology in the topo.txt file as needed, and run the provided Python script (e.g., config.py) to generate the Network.ned file: bash
python config.py -
Finally, start the simulation by executing the omnetpp.ini file, which initiates the simulation process.