[haiku-gsoc] Re: some questions about haiku kernel

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Fri, 11 May 2012 18:21:29 +0200


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.

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,

Bye,
   Axel.

Other related posts: