el_es wrote on Tuesday, December 08, 2009:
yes, I should have mentioned that, but it seemed so obvious
This is wholly defined by (sorry if inaccurate) quote : ‘run the highest priority task that is ready to run (i.e. is not blocked or sleeping)’
A vague idea of non-equal time sharing would be :
- add a counter to the task control block
- add a reload value to the task control block
- decide to run the task, if the counter is less or equal to reload-value and the task is at the head of queue
- decrease the counter at each decision to run the task
- when zero, send the task to the back of queue unconditionally
- and reload the counter with reload-value
- (and only the above would add to the hot path)
- also add an OS call to manipulate this reload-value from inside the task (upon creation, the reload-value would automatically be set to 1)
Also some sanity checks (is there another task with same priority? how many tasks altogether? Is it sane comparing to others? possibly, find a lowest common multiplier/denominator and sanitize all of them accordingly?) could be introduced there.
This is only useful if somebody needs a few separate tasks to run all-the-time (non-blocking/sleeping), with some arbitrary capping of the CPU usage. I wouldn’t rather expect them to be running at ‘highest’ OS priority though… quite the opposite. Because the weighed-round-robin taks would totally cut off everything below their priority, i.e. the idle task.