<br><br>
<div class="gmail_quote">On Thu, Sep 20, 2012 at 10:45 AM, Kshemendra KP <span dir="ltr"><<a href="mailto:kshemendra@suphalaam.com" target="_blank">kshemendra@suphalaam.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div> </div>
<div>Hi Amit,</div>
<div> </div>
<div> An executin task can be is interrupted by interrupts Timer interrupt updates</div>
<div>all the time related things in the sytem. One of the path where scheduler is invoked</div>
<div>is Timer Softirq. Scheduler verifies whether the current executing tasks time slice</div>
<div>is over, or any other task that has higher priority than this task is eligible to run.</div>
<div>If any of them is true scheduler selects the other task to run. </div>
<div> </div>
<div> </div>
<div><br>Regards</div><span class="HOEnZb"><font color="#888888">
<div> </div>
<div>Kshemendra</div></font></span>
<div class="HOEnZb">
<div class="h5">
<div> </div>
<div> </div>
<div> </div>
<div> <br><br></div>
<div class="gmail_quote">On Thu, Sep 20, 2012 at 4:40 AM, Amit Gupta <span dir="ltr"><<a href="mailto:gupta.v.amit@gmail.com" target="_blank">gupta.v.amit@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">Hi Srivatsa,
<div><br></div>
<div>(Thats an interesting pointer. I didnt know about cgroups freeze. Thanks.)</div>
<div><br></div>
<div>However, I'm trying to figure out how the kernel would go about doing it. i.e How the kernel, having a pointer to a task struct, goes about removing something from the runqueue. or bringing something from a TASK_INTERRUPTIBLE/STOPPED state back onto the runqueue. </div>
<div><br></div>
<div>I'm trying to figure this out from looking at the code, but am sort of getting lost.</div>
<div><br></div>
<div>I guess I can rephrase the question as, I dont really need to do it for any other purpose other than understanding how the kernel mechanisms will accomplish it. i.e Doing it from userspace using "kill" or cgroups freeze wont "uncover" this for me.</div>
<div><br></div>
<div>Hope my question is clearer,</div>
<div><br></div>
<div>Thanks for replies guys,</div>
<div>Amit</div>
<div><br></div>
<div>
<div>
<div><br><br>
<div class="gmail_quote">On Wed, Sep 19, 2012 at 3:09 AM, Srivatsa Bhat <span dir="ltr"><<a href="mailto:bhat.srivatsa@gmail.com" target="_blank">bhat.srivatsa@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">Hi Amit
<div><br>
<div class="gmail_quote">
<div>On Wed, Sep 19, 2012 at 4:49 AM, Amit Gupta <span dir="ltr"><<a href="mailto:gupta.v.amit@gmail.com" target="_blank">gupta.v.amit@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote"><br>Hi Kshemendra,
<div><br></div>
<div>I think I couldn't get my first question across clearly. My intent isn't to change do_fork()'s implementation. That wont work for precisely the reason you mentioned.(Infact everything after the init process would end up blocked). </div>
<div><br></div>
<div>My question was more to explore if an existing running process can be explicitly taken off the runqueue once we have a pointer to its task_struct.</div>
<div><br></div></blockquote>
<div><br></div></div>
<div>If you simply want to stop a running process and resume it at your will,</div>
<div>you don't need to write any kernel code at all. Simply use the cgroup</div>
<div>freezer functionality from userspace. You can find more details in</div>
<div>Documentation/cgroups/freezer-subsystem.txt in the kernel sources.</div>
<div><br></div>
<div>Regards,</div>
<div>Srivatsa S. Bhat</div>
<div><br></div></div></div></blockquote></div><br><br clear="all">
<div><br></div></div></div><span><font color="#888888">-- <br>Amit Gupta<br><br></font></span></div></blockquote></div><br></div></div></blockquote></div><br>kernel/sched/core.c -> __schedule() has the implemetnation