LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-06-2010, 08:46 AM   #1
reshmirrp
LQ Newbie
 
Registered: Apr 2010
Posts: 1

Rep: Reputation: 0
Ulimit memory limits


Hi,

Can anyone clarify me with ulimit output and memory limit?

ulimit -a output:
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) 1572864
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 137215
max locked memory (kbytes, -l) 2097152
max memory size (kbytes, -m) 1572864
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) 1572864
file locks (-x) unlimited

virtual memory includes all types of memory including stack, heap and memory mapped files.
data seg size is the amount of memory that a process can allocated to a heap.
what is the max memory size? is it rss(resident set size), amount of memory that can be swapped in to physical memory on bahalf of any process?

If a linux server is shared my many users, can a process have unlimited virtual memory, without affecting other users?
or will it lead to crash the whole system, if the process is using large amount od virtual memory?
How to set the limits for unlimited virtual memory with limited ram and swap space on disk?
 
Old 04-06-2010, 09:17 AM   #2
mweed
Member
 
Registered: Mar 2006
Posts: 33

Rep: Reputation: 17
see http://answers.google.com/answers/threadview?id=311442 for en explanation of each field.

Most distros leave the memory limits in ulimit to unlimited. Most of the time it is fine. An unlimited process has to actually allocate the memory for it to be used. ulimit is just like a quota.

If a process that is unlimited starts allocating all the memory it can it will affect the rest of the system. At first the system will start to slow down because data in RAM is moved into swap space on the disk. Once all the swap space is used one of two things will happen depending on how the kernel is configured. One option is that the OOM (ouf of memory) killer will start killing off processes. When it kills the offending process the system will recover to an extent, but may be unstable or only partially functional because some important processes may have been killed. The other option is for the system to reboot once all RAM and swap has been used. This may cause some loss of data on the disks.
 
Old 04-06-2010, 09:34 AM   #3
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,107

Rep: Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114
ulimit is too crude a control for any interesting system of guaranteed resources.

Even per process, it is a very crude control. Once you consider multiple processes per user, it is a hopelessly crude control. If you set max processes per user and max resources per process so low that the product of the two was a reasonable level of resource per user, you would be setting it so low that it would prohibit ordinary activities (because ordinary activities tend to have several tiny processes with few large ones).

Quote:
Originally Posted by reshmirrp View Post
If a linux server is shared my many users, can a process have unlimited virtual memory, without affecting other users?
It is pretty much impossible to allow any resource use by one process without "affecting" others.

Quote:
or will it lead to crash the whole system, if the process is using large amount od virtual memory?
But it also unlikely that one process using gigabytes of just virtual memory would have much impact on the rest of even a fairly small system.

Often most of the virtual memory use is either file mappings (low impact on the rest of the system) or various "copy on write" or "demand zero" mappings that have even lower impact (until actually referenced).

Quote:
How to set the limits for unlimited virtual memory with limited ram and swap space on disk?
Since you seem to have a 32 bit system, no process can use more than 3GB of virtual memory even if unlimited. I can't think of a decent reason to limit processes to less than that.

If ulimit were per user rather than per process, it might be nice to limit anonymous memory (heap and stack). But per process even that limit wouldn't be effective at keeping one user from consuming enough resources to make the whole system unstable.

I think there exist some better per user limiting tools, but I don't know any details. Fortunately I use Linux only in environments where users are either assumed to behave responsibly or are alone on a system and are the only victim of their own irresponsible actions.

Last edited by johnsfine; 04-06-2010 at 09:39 AM.
 
  


Reply

Tags
memory, ulimit


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ulimit and /etc/security/limits.conf chakkerz Linux - General 2 01-23-2011 01:42 AM
Not enough memory for Posix message queues... ulimit -q doesnt work ?? marconap Linux - Newbie 1 02-22-2008 05:26 AM
limits on memory resource bayram Linux - General 3 12-14-2006 11:32 AM
time and memory limits psmech Linux - General 2 02-15-2006 06:07 PM
Ulimit -l max locked memory question ablanchard Red Hat 3 01-20-2006 03:57 PM


All times are GMT -5. The time now is 04:34 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration