[K12OSN] Memory limit per user?
Calvin Dodge
caldodge at fpcc.net
Fri May 28 03:00:45 UTC 2004
Robert Arkiletian wrote:
> I know 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?
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.
#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
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
--
Calvin Dodge
Certified Linux Bigot (tm)
http://www.caldodge.fpcc.net
More information about the K12OSN
mailing list