diff options
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 |