<p dir="ltr">I mean how can we use the pid in the scenario of finding the process that is not used. </p>
<div class="gmail_quote">On 4 Jun 2015 16:00, "nick" <<a href="mailto:xerofoify@gmail.com">xerofoify@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 2015-06-04 08:52 AM, Mustafa Hussain wrote:<br>
> Ok, everything is clear except one thing what we will do exactly with (pid)<br>
> s?<br>
> On 4 Jun 2015 15:40, "nick" <<a href="mailto:xerofoify@gmail.com">xerofoify@gmail.com</a>> wrote:<br>
><br>
Its used in task struct to create a doubly linked list with init/systemd<br>
being the head or first process and the others linked in other of their<br>
hierarchy.<br>
Nick<br>
>><br>
>><br>
>> On 2015-06-04 08:34 AM, Mustafa Hussain wrote:<br>
>>> great, How can I check if this running task is used or not.. I mean by<br>
>> not<br>
>>> used that the task is running but not used by the user<br>
>>><br>
>>><br>
>> Here is the issue through in order to find out what tasks the user is<br>
>> running we<br>
>> need to known the exact pid(s) each time. This is next to impossible to do<br>
>> without<br>
>> writing a syscall and that’s a little beyond you if your asking about the<br>
>> scheduler.<br>
>> However, there may be a debugging feature in perf or other tool that does<br>
>> this, you<br>
>> can google to see if something wrote a tool or kernel module for this.<br>
>> Nick<br>
>>> On June 4, 2015 8:22:03 AM EDT, Mustafa Hussain <<br>
>> <a href="mailto:mustafa.hussain93@gmail.com">mustafa.hussain93@gmail.com</a>><br>
>>> wrote:<br>
>>>> So I was just thinking about if i did this i can close apps that is<br>
>>>> running<br>
>>>> and user don't use them..<br>
>>>> On 4 Jun 2015 14:59, "Nicholas Krause" <<a href="mailto:xerofoify@gmail.com">xerofoify@gmail.com</a>> wrote:<br>
>>>><br>
>>> That's not a idle task, that's a task in the<br>
>>> TASK_INTERRUPTIBLE or TASK_RUNNING phase.<br>
>>> Nick<br>
>>>>><br>
>>>>><br>
>>>>> On June 4, 2015 7:56:30 AM EDT, Mustafa Hussain <<br>
>>>>> <a href="mailto:mustafa.hussain93@gmail.com">mustafa.hussain93@gmail.com</a>> wrote:<br>
>>>>>> All i am trying to do is to detect idle task and remove it from the<br>
>>>>>> running<br>
>>>>>> queue or deactivate it.<br>
>>>>> There is no reason for that. The idle tasks are only ever scheduled<br>
>>>> when<br>
>>>>> there is no other processes able to<br>
>>>>> run. So trying to remove them is a<br>
>>>>> bad idea.<br>
>>>>> Nick<br>
>>>>>> Thank you for your patience :)<br>
>>>>>> On 4 Jun 2015 14:51, "Nicholas Krause" <<a href="mailto:xerofoify@gmail.com">xerofoify@gmail.com</a>> wrote:<br>
>>>>>><br>
>>>>>>><br>
>>>>>>><br>
>>>>>>> On June 4, 2015 3:35:25 AM EDT, Mustafa Hussain <<br>
>>>>>>> <a href="mailto:mustafa.hussain93@gmail.com">mustafa.hussain93@gmail.com</a>> wrote:<br>
>>>>>>>> System crashes, system can not start<br>
>>>>>>>><br>
>>>>>>> I was not thinking and this schedules the idle thread. What are<br>
>>>> you<br>
>>>>>> trying<br>
>>>>>>> to accomplish through.<br>
>>>>>>> Nick<br>
>>>>>>>><br>
>>>>>>>> On June 3, 2015 9:41:52 PM EDT, Mustafa Hussain<br>
>>>>>>>> <<a href="mailto:mustafa.hussain93@gmail.com">mustafa.hussain93@gmail.com</a>><br>
>>>>>>>> wrote:<br>
>>>>>>>>> i want to dequeue the idle task how can i do this ?<br>
>>>>>>>> Why there is no point. Clearly your asking questions in order to<br>
>>>>>> learn<br>
>>>>>>>> the<br>
>>>>>>>> scheduler.<br>
>>>>>>>> If your interested in learning it I can help but, you need to<br>
>>>>>> think<br>
>>>>>>>> about<br>
>>>>>>>> what you<br>
>>>>>>>> trying to accomplish first.<br>
>>>>>>>> Nick<br>
>>>>>>>><br>
>>>>>>>>> On Thu, Jun 4, 2015 at 3:40 AM, Mustafa Hussain<br>
>>>>>>>>> <<a href="mailto:mustafa.hussain93@gmail.com">mustafa.hussain93@gmail.com</a><br>
>>>>>>>>>> wrote:<br>
>>>>>>>>><br>
>>>>>>>>>> Hi nick,<br>
>>>>>>>>>> i applied your suggested edit and i got "bad: scheduling from<br>
>>>> the<br>
>>>>>>>>> idle<br>
>>>>>>>>>> thread!"<br>
>>>>>>>>>> how can i solve this ?<br>
>>>>>>>>>><br>
>>>>>>>>>> On Wed, Jun 3, 2015 at 12:29 AM, nick <<a href="mailto:xerofoify@gmail.com">xerofoify@gmail.com</a>><br>
>>>>>> wrote:<br>
>>>>>>>>>><br>
>>>>>>>>>>><br>
>>>>>>>>>>><br>
>>>>>>>>>>> On 2015-06-02 06:25 PM, <a href="mailto:Valdis.Kletnieks@vt.edu">Valdis.Kletnieks@vt.edu</a> wrote:<br>
>>>>>>>>>>>> On Tue, 02 Jun 2015 23:38:48 +0200, Mustafa Hussain said:<br>
>>>>>>>>>>>><br>
>>>>>>>>>>>>>> /*Check if the pointer pointing to the idle class is<br>
>>>> equal<br>
>>>>>> to<br>
>>>>>>>>> prev's<br>
>>>>>>>>>>>>>> sched_class*/<br>
>>>>>>>>>>>>>> if(prev->sched_class == idle)<br>
>>>>>>>>>>>>>> After this condition you can just:<br>
>>>>>>>>>>>>>> printk(KERN_INFO "Prev is equal to idle_sched_class,now<br>
>>>>>> running<br>
>>>>>>>>> the<br>
>>>>>>>>>>> idle<br>
>>>>>>>>>>>>>> sched_class\n");<br>
>>>>>>>>>>>><br>
>>>>>>>>>>>> Hopefully, you didn't take Nick's advice without thinking<br>
>>>>>> about<br>
>>>>>>>>> it....<br>
>>>>>>>>>>>><br>
>>>>>>>>>>>> As I type this, powertop tells me:<br>
>>>>>>>>>>>><br>
>>>>>>>>>>>> Summary: 821.8 wakeups/second, 0.0 GPU ops/seconds, 0.0<br>
>>>> VFS<br>
>>>>>>>>> ops/sec<br>
>>>>>>>>>>> and 18.8% CPU use<br>
>>>>>>>>>>>><br>
>>>>>>>>>>>> That printk is going to spam your dmesg pretty hard.<br>
>>>>>>>>>>>><br>
>>>>>>>>>>>> A better question is:<br>
>>>>>>>>>>>><br>
>>>>>>>>>>>> If prev is about to go idle, *what do you want to do*?<br>
>>>> (Hint:<br>
>>>>>>>>> newer<br>
>>>>>>>>>>>> kernels already do a bunch of stuff when a cpu/core goes<br>
>>>> idle,<br>
>>>>>>>> you<br>
>>>>>>>>>>>> probably want to make sure you're not working against<br>
>>>>>> something<br>
>>>>>>>>> here...)<br>
>>>>>>>>>>>><br>
>>>>>>>>>>> I didn't account for rate limiting the debug messages, forgot<br>
>>>>>> about<br>
>>>>>>>>> that<br>
>>>>>>>>>>> . :)<br>
>>>>>>>>>>> I do agree his question is not the best but he wanted a<br>
>>>> answer<br>
>>>>>> so I<br>
>>>>>>>>>>> decided<br>
>>>>>>>>>>> to just give him a answer that works for his learning.<br>
>>>>>>>>>>> Nick<br>
>>>>>>>>>>><br>
>>>>>>>>>><br>
>>>>>>>>>><br>
>>>>>>>><br>
>>>>>>>> --<br>
>>>>>>>> Sent from my Android device with K-9 Mail. Please excuse my<br>
>>>> brevity.<br>
>>>>>>><br>
>>>>>>> --<br>
>>>>>>> Sent from my Android device with K-9 Mail. Please excuse my<br>
>>>> brevity.<br>
>>>>>>><br>
>>>>><br>
>>>>> --<br>
>>>>> Sent from my Android device with K-9 Mail. Please excuse my brevity.<br>
>>>>><br>
>>><br>
>>> --<br>
>>> Sent from my Android device with K-9 Mail. Please excuse my brevity.<br>
>>><br>
>><br>
><br>
</blockquote></div>