Hi Axel, On Sat, May 12, 2012 at 12:21 AM, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>wrote: > > On 11.05.2012 15:35, Yongcong Du wrote: > >> > I assume you mean if you remove the timer in case of the idle thread >> > only? >> all thread have the same behavior -- the oldThread and nextThread are >> the same thread. But the phenomenon is obvious when the thread is the >> idle thread. And I found that there is no such phenomenon if I >> commented out the quantumTimer related code >> > > The reason is simply scheduling: preemption is just one case of > scheduling, but if you have longer running threads, they could run more or > less forever without that timer, draining other long running threads (in > this case with the same or a lower thread priority). > > The quantum is used to disrupt the thread, and look if another one should > run next. You could disable the timer for the idle thread, as that one will > always be preempted in order to save energy, but you cannot get rid of the > timer completely. Thanks very much. With your help, now I got the quantumTimer point. I can't imagine haiku scheduler code is so tight(compared with linux thousands of LOCs :D) and works well so far. > > After digging into the source code for one fully day, I still can't >> understand what's reschedule_even used for >> > > That's why you can always ask on this list ;-) > If I didn't manage to write something understandable, please just ask > again. > > HTH, > Appreciate your kind help, Yongcong