LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 11-21-2009, 10:24 PM   #1
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 57

Rep: Reputation: 15
Question 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.
 
Old 11-22-2009, 03:31 AM   #2
imagine_me2
Member
 
Registered: Nov 2009
Location: Kolkata, India
Distribution: Fedora 11
Posts: 136

Rep: Reputation: 22
Try
$ulimit -m [maxsize]

I dont know exactly if that should fit your purpose.
 
Old 11-22-2009, 03:32 AM   #3
imagine_me2
Member
 
Registered: Nov 2009
Location: Kolkata, India
Distribution: Fedora 11
Posts: 136

Rep: Reputation: 22
Try
$ulimit -m [maxsize]

I dont know exactly if that should fit your purpose.
 
Old 11-22-2009, 01:28 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,204
Blog Entries: 4

Rep: Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742Reputation: 2742
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..."
 
Old 11-22-2009, 01:52 PM   #5
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 57

Original Poster
Rep: Reputation: 15
Question

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.
 
Old 11-27-2009, 12:58 PM   #6
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 57

Original Poster
Rep: Reputation: 15
Question

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.
 
Old 11-27-2009, 03:56 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,619

Rep: Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
X hangs after prolonged usage ... memory usage goes upto 195MB duryodhan Slackware 18 05-10-2007 06:16 PM
Memory Usage Spaw Usage Swappiness Issues joelunch Linux - Software 3 01-04-2006 06:16 PM
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 08:43 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 04:45 AM
Controlling CPU usage & memory usage Saravana babu Linux - Software 0 02-18-2004 05:55 AM


All times are GMT -5. The time now is 07:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration