Limiting processes
From K12LTSP Wiki
lifted from newsgroup:
edited from original for clarity
Problem space:
Disk quotas for each user can be implemented by having /home on a seperate partition. But is it possible to set a limit for the maximum memory each user can have? This would prevent any one user from exhausting the server ram and causing the class to a crawl as the swap comes into play. Today, someone in my class somehow got gimp to eat 1gig of ram (I saw it with "top") and the whole class really felt the lag as the active swap partition started growing. Also, what if a student writes a program that gets into an infinite loop of allocating dynamic memory. (it could happen)
Somebody must have thought of this problem before?
Answer:
I don't know about limiting memory per user, but you can limit it by process. Here's ulimit.sh, which I wrote after problems like the one you encountered.
<verbatim>
- limit CPU time to stop runaway Netscape/Mozilla
- limit data size due to runaway artsd (1 gigabyte====) ====
if $UID -ge 500 then
ulimit -t 300 ulimit -d 200000 ulimit -m 300000 ulimit -v 300000
fi
</verbatim> If you want to do the same, make your script executable, then put it in the /etc/profile.d directory.
If someone knows a better way to do this, my ears are open.
Calvin
