|
From: Kristian V. D. V. <va...@li...> - 2005-01-11 21:31:26
|
On Tuesday 11 January 2005 17:59, Daniel Gryniewicz wrote: > Overall, this looks quite good. Nice and simple, and straight forward. > It's quite likely that the actual dynamic priority calculation and > quantum sizes could be tweaked for better fairness/whatever, but that's > easy to do. Maybe a macro/function to calculate quantum, so it's easy > to change globally? > > One note: in the dynamic priority calculation, you check that the > reduction won't leave the priority space. I suspect what you want is > this: > > <snip> > > Otherwise, nothing will ever get below 85, and more well-behaved > processes will get penalized worse than badly behaved processes (they'll > get to -85, but the bad ones will only get to -50) Sounds like a good idea to me. > Attached is my few suggestions for changes. It's against current CVS, > so you won't be able to apply it on top of your changes. Basically, it > makes the above change, adds a macro for GET_QUANTUM, and adds > documentation for recalculate_dynamic_priority(). Thanks. One change I've considered is rather than trying to calculate the CPU time over the total life of the thread is to keep a count of the number of times a thread runs to the end of it's quantum. If the quantum expires the counter increments by one. If the thread blocks before the quantum expires the counter is decremented by one. The penalty would then be applied according to the counter value. Threads with a count of five would be scaled back by -10, a count of ten by -20, fifteen by -30 etc. (The real numbers would probably require some tuning) The advantage here is that the calculation is much easier. It also solves the problem where threads which have spent a long time idle suddenly shoot to 100% CPU usage. Under the current calculation based on the total life of the thread the CPU usage would still be calculated as a low percentage and no penalty imposed. Under the new scheme a thread at 100% CPU would quickly acumulate a high count, and be penalized. I'll apply your patches tommorow and I'll try out my counter scheme and let you all know how that works out, too. -- Vanders http://www.syllable.org http://www.liqwyd.com |