A lightweight, C-based distributed computing cluster using UDP sockets. It allows you to offload arithmetic operations (ADD, SUB, MUL) to a network of worker nodes via a central registry.
- Registry (Master): Manages available nodes, dispatches tasks, and routes results back to the client.
- Node (Worker): Registers with the master and executes computational tasks.
- Client: A CLI tool to send tasks to the cluster and receive results.
Compile the three components using gcc:
# Compile the Registry (Master)
gcc registry.c -o registry -lpthread
# Compile the Worker Node
gcc node.c -o node -lpthread
# Compile the Client
gcc client.c -o client_appStart the master server on a specific port (e.g., 5000).
./registry 5000Start one or more workers. Provide the worker's own port and the registry's port.
# syntax: ./node <NODE_PORT> <REGISTRY_PORT>
./node 8001 5000 &
./node 8002 5000 &Use the client to send a calculation request.
# syntax: ./client_app <OPERATION> <OP1> <OP2> [REGISTRY_IP] [REGISTRY_PORT]
./client_app ADD 10 20Output:
[Client] Sending: CLIENT_TASK:ADD:10:20 to 127.0.0.1:5000
[Client] Waiting for response...
[Client] Received: RESULT:30
You can run the provided script to test the full flow:
./client.sh