ravi.murty at intel.com
Wed Feb 27 02:26:47 UTC 2008
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
More information about the freebsd-current