Gary Thomas <[EMAIL PROTECTED]> writes: > Nick Garnett wrote: > > Gary Thomas <[EMAIL PROTECTED]> writes: > > > >> It seems that timeslicing of equal priority threads is broken > >> in the presence of any other higher priority threads that may > >> cause preemption. > >> > >> I have modified the timeslice test to have an additional thread. > >> This thread is higher priority than the "worker" threads and > >> all it does is wake up at a modest frequency (every 2 ticks). > >> What this does is to preempt one of the worker threads before > >> it has a chance to run the timeslice timer down to zero. When > >> the worker thread is resumed, the timeslice timer is reset and > >> the same worker thread continues running forever, never being > >> rescheduled and letting the other worker threads run. > >> > > As it happens, I also fixed this bug myself a few weeks ago. It has > > been running in our test farm for a while. I think my patch is a > > little more complete since it also deals with the bitmap scheduler and > > kapidata.h. I also think it leaves the scheduler code a little tidier. > > Anyway here it is: > > Obviously cleaner since you're more familiar with the various C++ classes, > etc. within the scheduler. > > Why aren't your functions (and the layout, etc) protected by > CYGSEM_KERNEL_SCHED_TIMESLICE? Does it still build/run with this CDL > option disabled?
I chose to arrange the headers and the bitmap scheduler to always have these functions defined. Where they are non-functional they are just empty inlines. I did this so that the ifdefs can be removed from the main code, which I think makes it cleaner and easier to read, and is more in keeping with the sort of approach one should take with C++. I've tested it by hand with timeslicing disabled and with the bitmap scheduler enabled. It has also been through the various config permutations in the test farm, so I am fairly confident that it is robust. > > Query: did you also write the timeslice2 test? It looks a lot like > mine (cleaner - I didn't spend a lot of time on it)? Obviously great > minds think alike :-) I did write it, it was the obvious thing to do after all :-) If you are happy for me to do so, then I'll check this patch in. -- Nick Garnett eCos Kernel Architect http://www.ecoscentric.com The eCos and RedBoot experts http://www.ecoscentric.com/legal Legal info, address and number
