diff options
author | Your Name <you@example.com> | 2025-06-17 15:02:05 +0200 |
---|---|---|
committer | Your Name <you@example.com> | 2025-06-17 15:02:05 +0200 |
commit | 1445f8e759a0409f561e2c811960fd65b1b64611 (patch) | |
tree | 5074bbd1786fe167298bd372817966db735ee94b /shared.h |
initial
Diffstat (limited to 'shared.h')
-rw-r--r-- | shared.h | 31 |
1 files changed, 31 insertions, 0 deletions
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 <pthread.h> + +#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 |