<br><br><div class="gmail_quote">On Sat, Feb 9, 2013 at 3:51 PM, anish kumar <span dir="ltr"><<a href="mailto:anish198519851985@gmail.com" target="_blank">anish198519851985@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Sat, 2013-02-09 at 14:57 +0800, Peter Teoh wrote:<br>
><br>
><br>
> On Sat, Feb 9, 2013 at 1:47 PM, anish kumar<br>
> .<br>
> Timer interrupts is supposed to cause scheduling and scheduler<br>
> may or<br>
> may not pick up your last process(we always use the term<br>
> "task" in<br>
> kernel space) after handling timer interrupt.<br>
> ><br>
><br>
><br>
><br>
> Sorry if I may disagree, correct me if wrong. Timer interrupt and<br>
> scheduler is two different thing. I just counted in the "drivers"<br>
> subdirectory, there are at least more than 200 places where<br>
> "setup_timer()" is called, and these have nothing to do with<br>
> scheduling. For eg, heartbeat operation etc. Not sure I<br>
> misunderstood something?<br>
</div></div>Have a look at kernel/timer.c and kernel/hrtimer.c.<br>
There are many sched() calls in these files.This will invoke scheduler.<br>
><br></blockquote><div><br></div><div>kernel/timer.c and kernel/hrtimer.c are implementing the logic outside of timer interrupt context, ie, it is NOT executed in timer interrupt context, but in bottom half context. the real timer interrupt context is done in arch-specific branch: arch/x86/kernel/tsc.c, for example, and the entire tsc.c has no scheduling concept in it. the entire file tsc.c in fact is handling all the hardware-specific stuff - in the top-half context. </div>
<div><br></div><div>in linux kernel scheduling is done in two ways: voluntary and involuntary scheduling. involuntary scheduling means it is triggered by timer interrupt. but voluntary scheduling (which is only recently introduced into kernel for performance reasons) drastically improve the latency numbers. voluntary scheduling is NOT triggered by timer, but ANYONE who want to give up the CPU can call sched_cpu() to do a rescheduling.</div>
<div><br></div><div>hope i am not wrong.....</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888">><br>
> --<br>
> Regards,<br>
> Peter Teoh<br>
<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Peter Teoh