DistribOS is a peer-to-peer (P2P) distributed execution system built in C. It allows multiple nodes to discover each other on a local network, share their current CPU load, and collaboratively execute computational jobs submitted by clients. Jobs are intelligently routed to the least-loaded peer in the network.
- P2P Node Discovery: Nodes broadcast and discover each other via UDP (Port 8080).
- Intelligent Load Balancing: Jobs are automatically forwarded to the peer with the lowest system load.
- Web Dashboard: Every node provides its own real-time HTTP monitoring dashboard (Port 7070).
- Client Agent: A convenient client tool to easily compile and submit C programs as jobs over TCP (Port 9090).
server.c(The Peer Node): The backbone of the network. It communicates over UDP for peer discovery, TCP for job transmission, and runs an embedded HTTP server to provide its monitoring dashboard.client.c(The Job Submitter): Takes a C source file, compiles it into an executable, and sends it to a node to be executed within the P2P network.
- GCC compiler
- Make
- Linux or macOS environment (Unix-like system)
Simply run make in the project root directoy to build both the server and the client executables.
makeRun the server executable on one or multiple machines on the same local network.
./serverOnce running, the server will output its IP and port information:
[SERVER] My IP: 192.168.1.100 Hostname: node-1
[SERVER] Dashboard: http://192.168.1.100:7070
[SERVER] TCP listening on port 9090
Open a web browser and navigate to the dashboard URL outputted by the server (e.g., http://localhost:7070) to view the real-time status of the cluster. The dashboard shows active nodes, their respective system loads, and a comprehensive job execution history.
You can write any C program and submit it using the client. By default, the client connects to a server running locally (127.0.0.1 on port 9090). Ensure you have a program.c file or specify your custom C program.
# Submit a specified C program
./client path/to/your_file.c
# Or, simply submit the default program.c in the directory
./clientThe node will receive the compiled payload, route it to the optimal node in the network based on CPU load, execute it, and return the stdout text output back to your terminal.
- UDP Broadcast (8080): Used for exchanging
LOAD_REQ,LOAD_RESP, and background job synchronization events (JOB_SYNC). - TCP Data Transfer (9090): Used to send the compiled ELF binary using a
JOB_SENDheader. Servers use this to route executions inter-node (EXEC_HERE). - HTTP Web API (7070): Single-page web dashboard interface polling the
GET /api/statusendpoint to show network activity.