<div dir="ltr"><div><br></div>Hi Yedidyah<div>Loved the SIGSTOP/SIGKILL approach - simple but awsome.</div><div>I seems to be working.</div><div>Thanks for everyone's input.</div><div>Josh<br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 23, 2017 at 9:18 AM, Yedidyah Bar David <span dir="ltr"><<a href="mailto:didi@bardavid.org" target="_blank">didi@bardavid.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On Sat, Apr 22, 2017 at 12:51 PM, Josh Roden <<a href="mailto:joshroden@gmail.com">joshroden@gmail.com</a>> wrote:<br>
> Hi<br>
> I see some explanation about cgroups on Centos 6 here:<br>
> <a href="https://www.digitalocean.com/community/tutorials/how-to-limit-resources-using-cgroups-on-centos-6" rel="noreferrer" target="_blank">https://www.digitalocean.com/<wbr>community/tutorials/how-to-<wbr>limit-resources-using-cgroups-<wbr>on-centos-6</a><br>
> I will check about its implementation for Centos 6 and update my post.<br>
> Thanks for giving a direction.<br>
> Josh<br>
><br>
> On Fri, Apr 21, 2017 at 4:27 PM, guy keren <<a href="mailto:guy.choo.keren@gmail.com">guy.choo.keren@gmail.com</a>> wrote:<br>
>><br>
>><br>
>> how about using cgroups, putting each user's login shell in a cgroup that<br>
>> cannot use more then X% of the whole CPUs. this will affect all processes<br>
>> spawned under the user's shell.<br>
>><br>
>> --guy<br>
>><br>
>><br>
>> On 04/21/2017 03:07 PM, Josh Roden wrote:<br>
>>><br>
>>> Hi<br>
>>><br>
>>> server setup:<br>
>>> ------------------<br>
>>> Centos 6<br>
>>> 32GB RAM<br>
>>> 16 Cpu's<br>
>>> 70 students max<br>
>>><br>
>>> I am using /etc/security/limits.conf to prevent the students from<br>
>>> choking the whole<br>
>>> server but sometimes one student will write a very bad program that<br>
>>> somehow<br>
>>> runs itself again and again - so fast that "killall" and "pkill -9 -u"<br>
>>> can't stop/remove<br>
>>> the user fast enough before the student's program is run again and<br>
>>> again...<br>
>>><br>
>>> Here is my definition in limits:<br>
>>><br>
>>> @stud hard cpu 8<br>
>>> @stud hard nproc 256<br>
>>> @stud hard nofile 1024<br>
>>> @stud - maxlogins 6<br>
>>><br>
>>> I can't reduce cpu time below 8min because eclipse will be killed every<br>
>>> hour or so.<br>
>>> My problem seems to be that the student can run up to 256 processes that<br>
>>> each<br>
>>> uses 100% of a single CPU and we only have 16 CPU''s.<br>
>>><br>
>>> Thanks for any suggestions.<br>
>>> Josh<br>
<br>
</div></div>Also, to handle actual specific cases, you can:<br>
1. Send all processes SIGSTOP (or SIGTSTP)<br>
2. Then send them SIGKILL<br>
<br>
Why does this work?<br>
<br>
First, why doesn't simply sending all SIGKILL works?<br>
The kernel already limits the user to 256 procs. So when they try to create<br>
more, they fail. But when you kill some of them, the others will now succeed<br>
creating more.<br>
<br>
With above, you first suspend all procs, so that they won't manage to try to<br>
create new ones. Then, when you kill some of them, the others do not create<br>
new ones and eventually all are killed.<br>
<br>
Best,<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
>>><br>
>>><br>
>>> ______________________________<wbr>_________________<br>
>>> Linux-il mailing list<br>
>>> <a href="mailto:Linux-il@cs.huji.ac.il">Linux-il@cs.huji.ac.il</a><br>
>>> <a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" rel="noreferrer" target="_blank">http://mailman.cs.huji.ac.il/<wbr>mailman/listinfo/linux-il</a><br>
>>><br>
>><br>
>><br>
>> ______________________________<wbr>_________________<br>
>> Linux-il mailing list<br>
>> <a href="mailto:Linux-il@cs.huji.ac.il">Linux-il@cs.huji.ac.il</a><br>
>> <a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" rel="noreferrer" target="_blank">http://mailman.cs.huji.ac.il/<wbr>mailman/listinfo/linux-il</a><br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> Linux-il mailing list<br>
> <a href="mailto:Linux-il@cs.huji.ac.il">Linux-il@cs.huji.ac.il</a><br>
> <a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" rel="noreferrer" target="_blank">http://mailman.cs.huji.ac.il/<wbr>mailman/listinfo/linux-il</a><br>
><br>
</div></div></blockquote></div><br></div></div></div>