blob: 05f85c64a47d756bc891c81cfcb386c31f881731 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#ifndef SHARED_H
#define SHARED_H
#include <pthread.h>
#define MAX_JOBS 100
#define MAX_PATH 256
#define MAX_NODES 2
#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 job_nodes[MAX_JOBS]; // NEW
int head;
int tail;
} JobQueue;
typedef struct {
int node_id;
int lport;
int running_jobs;
float load; // from /proc/[pid]/stat or getloadavg()
} NodeStatus;
typedef struct {
pthread_mutex_t mutex;
NodeStatus statuses[MAX_NODES];
} NodeStatusArray;
#endif
|