Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DistribOS

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.

Features

  • 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).

Infrastructure Overview

  • 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.

Prerequisites

  • GCC compiler
  • Make
  • Linux or macOS environment (Unix-like system)

Building

Simply run make in the project root directoy to build both the server and the client executables.

make

Usage

1. Start a Peer Node (Server)

Run the server executable on one or multiple machines on the same local network.

./server

Once 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

2. View the Web Dashboard

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.

3. Submit a Job (Client)

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
./client

The 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.

Protocol Details

  • 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_SEND header. Servers use this to route executions inter-node (EXEC_HERE).
  • HTTP Web API (7070): Single-page web dashboard interface polling the GET /api/status endpoint to show network activity.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages