Scheduler questions

From: Murty, Ravi <ravi.murty_at_intel.com>
Date: Tue, 26 Feb 2008 18:04:45 -0800
Hello Everyone,

 

I've been looking at the scheduler to understand some finer details and
have a couple of questions I am hoping someone can answer pretty easily.

 

1.	critnest: It appears that the whole point of critical_enter and
critical_exit is to prevent preemption in the kernel by using these
functions. I can see this being useful when kernel preemption is
defined, but I can't seem to figure out why this would matter if kernel
preemption is not defined. I can think of a case - e.g. thread enters
kernel and is in critical section, timer interrupt fires and tries to
preempt thread because it's time quantum expired. But I can't seem to
find how this works. Also, why would critnest be equal to 2 or more?
2.	Again, time quantum related question. When the scheduler (e.g.
ULE) decides (in sched_clock) that it's time to switch a thread out
because its time slice is 0, it sets the NEEDRESCHED flag and expects
the ast() routine (as part of the return from the timer interrupt
handler) to call mi_switch(). Why not call mi_switch right there in
sched_clock()?

 

Thanks
Ravi Murty
Received on Wed Feb 27 2008 - 01:26:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:28 UTC