farms.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef AVM_FARMS_H
  2. #define AVM_FARMS_H 1
  3. #include <avm/lists.h>
  4. #include <avm/jobs.h>
  5. #include <avm/servlist.h>
  6. #ifdef __cplusplus
  7. extern "C"
  8. {
  9. #endif
  10. /* number of seconds between status checks on running jobs */
  11. #define WAIT (time_t) 60
  12. /* number of seconds between reconnection attempts to unresponsive servers */
  13. #define RETRY (time_t) 300
  14. typedef struct farm_struct *farm;
  15. /* A farm represents a queue of pending jobs whose dependences are
  16. resolved. We start by planting the independent (leaf) nodes in a
  17. job tree and launching them asynchronously via the harvest
  18. function. As each one finishes, its dependent is checked for any
  19. remaining dependences and launched if possible, until the whole job
  20. is completed in an order consistent with its dependence
  21. constraints. */
  22. struct farm_struct
  23. {
  24. job site; /* the quantum of computation assigned to this farm */
  25. server_list runner; /* the remote server working on this job, if any */
  26. flag cache_hit; /* the server is running with a remotely cached copy of the function site->root */
  27. list operand; /* the argument to the site->root function; this is freed when the farm is freed */
  28. farm prev; /* doubly linked list pointers */
  29. farm next;
  30. };
  31. extern void avm_plant (farm *maggie, job top, int *fault);
  32. extern void avm_harvest (farm maggie, flag balanceable, int *fault);
  33. extern void avm_abnormally_terminate (farm *maggie);
  34. extern void avm_initialize_farms ();
  35. extern void avm_count_farms ();
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif /* !AVM_FARMS_H */