-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcoordinator.h
66 lines (46 loc) · 1.45 KB
/
coordinator.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef __COORDINATOR__
#define __COORDINATOR__
#include <pthread.h>
#include <time.h>
#include <ucontext.h>
// info_t is the worker descriptor.
typedef struct info_t{
// context of the running application on a safe point.
// It is mainly used in order to implement a smart soft
// checkpoint.
struct ucontext context;
pthread_t my_id;
pthread_attr_t attributes;
// unique runtime provided id for this worker
unsigned int id;
// variable used by approximate workers.
// It is mainly used as a safe-guard protecting the
// execution of the task function. If flag=0 then
// the task function is not used.
volatile int flag;
//synchronization variables.
pthread_mutex_t my_mutex;
pthread_cond_t cond;
// work is set to zero when the worker has no
// tasks to pending for execution.
unsigned int work;
// reliability of the worker.
unsigned char sig;
// arguments of the task function
void *execution_args;
// task function.
void (*execution) (void *);
//arguments of the tasks result check function
void *sanity_args;
// result check function
int (*sanity) (void *, void*);
// return value of result check function.
unsigned int return_val;
unsigned int checked_results;
// number of re-executions of task.
unsigned int redo;
// Not used variable
unsigned int reliable;
}info;
void init_system(unsigned int reliable_workers , unsigned int nonrel_workers);
#endif