TaskScheduler.txt 1.7 KB

1234567891011121314151617181920212223242526272829303132333435
  1. TaskManager (or JobScheduler)
  2. - Ensure it only uses 6 threads. Two should be reserved for sim and core thread.
  3. - Potentially a separate ThreadPool class?
  4. - Support for task dependencies
  5. - Support for task priorities
  6. - Callable from multiple threads
  7. - When task is queued a Task object is returned (can be copied)
  8. - You may use that for chaining dependencies
  9. - For waiting on a task
  10. - HOW DO I CHECK WHEN TASKS ARE COMPLETE?
  11. - Check AsyncOp and use that same approach. In fact maybe use AsyncOp itself within the Task
  12. - Ability for threads to wait() until task is complete. And while waiting to complete tasks themselves.
  13. - Only main threads can wait (core and sim threads)
  14. - When they wait they will actually stop, and the task scheduler will start a new thread to run tasks in their place
  15. - Once the task they are waiting for is done, the new thread is returned to thread pool
  16. - When calling wait() and starting a new thread, first check if any active thread is being shut-down and if so, cancel the shutdown instead of creating a new thread
  17. - Tasks should have names (later for visualization and profiling purposes)
  18. ThreadPool
  19. - NEVER start threads manually. Only use ThreadPool.
  20. - This way I can initialize stack allocators and profiler threads just one for the started threads and don't have to worry about user forgetting how to do that.
  21. LATER - Profiler should be able to visualize tasks
  22. ------------------
  23. Non-task-scheduler:
  24. Module does need to be fixed for multi-threading. If it is created on one thread and used on another, a race condition could occurr. But do I use modules on two different threads?
  25. - I will with Debug, and probably others
  26. - Making the shutdown/destroy variables atomic should be enough