robust-services-core icon indicating copy to clipboard operation
robust-services-core copied to clipboard

Proportional scheduling

Open GregUtas opened this issue 8 years ago • 0 comments

InitThread and Thread now schedule all threads as the result of #126 and #127. The remaining work items are

  • provide a default timewheel
  • add a command for creating a timewheel (based on the percentage of time allotted to each faction)
  • add a command for switching to another timewheel
  • Thread.Select chooses next thread based on timewheel
  • InitThread acts as clock interrupt to advance timewheel
  • track the time spent in each faction and display it in >sched show
  • can apply this design recursively, to an element manager that supervises multiple executables, giving each one a guaranteed percentage of the CPU

Each thread now waits on a per-thread Windows event to be signalled to run; this would probably be implemented using a condition variable on other systems.

  • conditions variable supported in C++11; see documentation
  • "spurious wakeup" problem means that, when awoken, thread must check that the underlying condition is actually true
  • implement SetEvent and WaitEvent using a condition variable: see article

GregUtas avatar Nov 04 '17 00:11 GregUtas