jobs.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef AVM_JOBS_H
  2. #define AVM_JOBS_H 1
  3. #include <avm/lists.h>
  4. #ifdef __cplusplus
  5. extern "C"
  6. {
  7. #endif
  8. typedef struct job_struct *job;
  9. /* A job represents an ensemble of computations and their dependence
  10. relation as a tree. The value of a terminal job tree is its root,
  11. the value of a non-terminal tree with an empty root is the list of
  12. values of its prerequisites, the value of a non-terminal tree with
  13. a single celled root is the flattened list of its prerequisites,
  14. and the value of a non-terminal tree with an otherwise non-empty
  15. root is the root applied to the list of values of its
  16. prerequisites. */
  17. struct job_struct
  18. {
  19. list root; /* this is to be freed when the job is freed */
  20. flag running; /* set when there is a remote server working on it */
  21. int dependence; /* the number of unevaluated prerequisites */
  22. int deficit; /* used temporarily by the rebalancing algorithm */
  23. job dependent; /* the thing that can't get evaluated until this is */
  24. job prerequisites; /* the things that have to be evaluted before this */
  25. job corequisites; /* things that can be evaluated concurrently on which the dependent also depends */
  26. };
  27. extern void avm_free_job (job *front);
  28. extern void avm_new_job (job *front, job *back, list root, job dependent, job prerequisites, int dependence, int *fault);
  29. extern void avm_queue_job (job *front, job *back, job *top, job dependent);
  30. extern list avm_evaluation (job top, flag balanceable, int *fault);
  31. extern void avm_initialize_jobs ();
  32. extern void avm_count_jobs ();
  33. #ifdef __cplusplus
  34. }
  35. #endif
  36. #endif /* !AVM_JOBS_H */