Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-21-2009, 11:24 PM
|
#1
|
Member
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 57
Rep:
|
only allowing a certain memory usage
Hi,
I was trying to only allow 6 mb of memory to be used by a certain user's programs.
The program I am most interested in limitting is one that runs in the background.
I set the info in the /etc/security/limits.conf to look like this:
<username> hard rss 6144
I also tried <username> hard memlock 6144
But nothing worked.
He was running about 11.4 percent of my 360 mb, which is much more than 6144 kb, but it didn't kill his task.
Any help on how to stop this and how to limit the programs in the future is appreciated.
-Michael.
|
|
|
11-22-2009, 04:31 AM
|
#2
|
Member
Registered: Nov 2009
Location: Kolkata, India
Distribution: Fedora 11
Posts: 136
Rep:
|
Try
$ulimit -m [maxsize]
I dont know exactly if that should fit your purpose.
|
|
|
11-22-2009, 04:32 AM
|
#3
|
Member
Registered: Nov 2009
Location: Kolkata, India
Distribution: Fedora 11
Posts: 136
Rep:
|
Try
$ulimit -m [maxsize]
I dont know exactly if that should fit your purpose.
|
|
|
11-22-2009, 02:28 PM
|
#4
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 11,069
|
As noted, the ulimit command is useful for imposing limits upon a program that you think might "run away." (Or for testing its operation when you plan to deploy to a shared-host which does impose process limits.)
Also useful is the quota facility.
But bear in mind: when a process "runs away" or is inefficiently designed, "it's never pretty what happens next, on any operating system..."
|
|
|
11-22-2009, 02:52 PM
|
#5
|
Member
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 57
Original Poster
Rep:
|
Hi,
I see what you mean.
However, is there any way to do this with pam?
Also, with ulimit, how do I set it on a per user basis.
And then, I have two users: user1 and user2 let's call them.
User1 has a program called moo.
User2 also has a program called moo.
If I set a memory limit of 6 mb on the user1's moo, will it also impose this limit on user2's moo? for this is not what I want.
Thanks,
-Michael.
|
|
|
11-27-2009, 01:58 PM
|
#6
|
Member
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 57
Original Poster
Rep:
|
Hi,
Does anyone know the answers to the questions asked in the post above?
If you do, then please tell me.
Help is appreciated.
-Michael.
|
|
|
11-27-2009, 04:56 PM
|
#7
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,316
|
cgroups is an in-kernel solution that is not well documented, and hardly worth the effort on small systems. It is based on the container model, but uses pid for selection. This can make it an administrative burden. I have used it to quarantine certain workloads to a subset of available CPUs, but there is also a memory controller. Recent Ubuntus seem to have the requisite kernel options enabled.
Documented in the kernel source tree at ../Documentation/cgroups - look here for an online copy.
|
|
|
All times are GMT -5. The time now is 05:55 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|