Questions about process state manipulation

Kshemendra KP kshemendra at suphalaam.com
Thu Sep 20 05:05:05 EDT 2012


On Thu, Sep 20, 2012 at 10:45 AM, Kshemendra KP <kshemendra at suphalaam.com>wrote:

>
> Hi Amit,
>
>        An executin  task can be is interrupted by interrupts Timer
> interrupt updates
> all the time related things in the sytem. One of the path where scheduler
> is invoked
> is Timer Softirq. Scheduler verifies whether the current executing tasks
> time slice
> is over, or any other task that has higher priority than this task is
> eligible to run.
> If any of them is true scheduler selects the other task to run.
>
>
>
> Regards
>
> Kshemendra
>
>
>
>
>
> On Thu, Sep 20, 2012 at 4:40 AM, Amit Gupta <gupta.v.amit at gmail.com>wrote:
>
>> Hi Srivatsa,
>>
>> (Thats an interesting pointer. I didnt know about cgroups freeze. Thanks.)
>>
>> 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.
>>
>> I'm trying to figure this out from looking at the code, but am sort of
>> getting lost.
>>
>> 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.
>>
>> Hope my question is clearer,
>>
>> Thanks for replies guys,
>> Amit
>>
>>
>>
>> On Wed, Sep 19, 2012 at 3:09 AM, Srivatsa Bhat <bhat.srivatsa at gmail.com>wrote:
>>
>>> Hi Amit
>>>
>>>  On Wed, Sep 19, 2012 at 4:49 AM, Amit Gupta <gupta.v.amit at gmail.com>wrote:
>>>
>>>>
>>>> Hi Kshemendra,
>>>>
>>>> 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).
>>>>
>>>> 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.
>>>>
>>>>
>>> If you simply want to stop a running process and resume it at your will,
>>> you don't need to write any kernel code at all. Simply use the cgroup
>>> freezer functionality from userspace. You can find more details in
>>> Documentation/cgroups/freezer-subsystem.txt in the kernel sources.
>>>
>>> Regards,
>>> Srivatsa S. Bhat
>>>
>>>
>>
>>
>> --
>> Amit Gupta
>>
>>
>
kernel/sched/core.c -> __schedule()   has the implemetnation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120920/7cfe584c/attachment-0001.html 


More information about the Kernelnewbies mailing list