From 1445f8e759a0409f561e2c811960fd65b1b64611 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 17 Jun 2025 15:02:05 +0200 Subject: initial --- shared.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 shared.h (limited to 'shared.h') diff --git a/shared.h b/shared.h new file mode 100644 index 0000000..30c8ffe --- /dev/null +++ b/shared.h @@ -0,0 +1,31 @@ +#ifndef SHARED_H +#define SHARED_H + +#include + +#define MAX_JOBS 100 +#define MAX_PATH 256 +#define MAX_NODES 4 + +#define SHM_NAME "/job_queue_shm" +#define SHM_NODE_STATUS "/node_status_shm" + +typedef struct { + pthread_mutex_t mutex; + char jobs[MAX_JOBS][MAX_PATH]; + int head; + int tail; +} JobQueue; + +typedef struct { + int node_id; + int running_jobs; + float load; // from /proc/[pid]/stat or getloadavg() +} NodeStatus; + +typedef struct { + pthread_mutex_t mutex; + NodeStatus statuses[MAX_NODES]; +} NodeStatusArray; + +#endif -- cgit v1.2.3