robust-services-core
robust-services-core copied to clipboard
Proportional scheduling
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.Selectchooses next thread based on timewheel -
InitThreadacts 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
SetEventandWaitEventusing a condition variable: see article