Kbase 20626: Explanation of AIX Hard and Soft Limits
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/7/2011 |
|
Status: Verified
GOAL:
How to use hard and soft limits to the number of user processes
GOAL:
What are the Soft and Hard limits on AIX
FACT(s) (Environment):
IBM AIX
FIX:
Hard limits are generally set by the system administrator as a maximum limitation on a user's processes. You can view your hard limits using:
ulimit -Ha
The soft limits are the values the kernel uses to directly limit a process's system resources. Soft limits can be changed by anyone, but they cannot exceed the value set for the hard limit. Only a member of the security group can make permanent changes to these limits. Any changes made by the user are lost upon logout. You can view your soft limits using:
ulimit -a
The following are the default soft limits that are used when a new user is added to the system. They are stored in the etc/security/limits file:
4.1-4.3
=================
fsize = 2097151
core = 2048
cpu = -1
data = 262144
rss = 65536
stack = 65536
NOTE: A negative value denotes "unlimited."
Most of the following information is from the setrlimit() and getrlimit() man pages.
- File size:
FSIZE = 2097151 (units in 512-byte blocks)
HARD_FSIZE = -1 (unlimited)
This value is a limit that the kernel enforces on a user
process. This means a user cannot write to a file that is
larger than the limit. The limit value can be lowered by the
user, but only root user can raise this value.
The largest number the limit can be set to is 4194303
512-byte blocks, or 2 GB. In AIX 4.2.1, the maximum file
size was increased to 64 GB. The number above still applies,
but the term "unlimited", a value of "-1", should be used in
cases where you want to create files larger than 2 GB in
size.
To change the soft limit using the chuser command, execute:
chuser fsize=<value> <username>
To change the hard limit using the chuser command, execute:
chuser hard_fsize=<value> <username>
To change your current soft limit use, execute:
ulimit -f <value>
- Core file size:
CORE = 2048 (units in 512-byte blocks)
HARD_CORE = -1
&nbs.p; This limit is enforced by the kernel and it does not allow a
user to create a core file larger than the set soft limit.
To change the soft limit using the chuser command, execute:
chuser core=<value> <username>
To change the hard limit using the chuser command, execute:
chuser hard_core=<value> <username>
To change your current soft limit use, execute:
ulimit -c <value>
- CPU time:
CPU = 3600 (units in seconds)
HARD_CPU = -1
This limit can be lowered by the user but only a root user
can raise the value. The limit is not enforced by the
kernel. It might be checked by the application code or user
code but the kernel does not enforce the value.
In other words, if a process passes its SOFT CPU time limit,
the kernel does (not) send a SIGXCPU signal to the offending
process. The kernel lets processes run as long as they are
able. Consequently, this value can be misleading.
To change the soft limit using the chuser command, execute:
chuser cpu=<value> <username>
To change the hard limit using the chuser command, execute:
chuser hard_cpu=<value> <username>
To change your current soft limit use, execute:
ulimit -t <value>
- Data segment:
DATA = 131072 (units in 512-byte blocks in
/etc/security/limits and kbytes in ulimit)
HARD_DATA = -1
This limit defines the maximum size, in bytes, of the data
segment for a process. It defines how far a program might
extend its break value. The limit is enforced by the kernel.
Data and stack are tied together. They exist in Segment 2
and together they can never be greater than approximately
256 Mb. This value is actually larger, but 256 Mb is a good
number to use.
. The user can raise their hard and soft data or stack values
with the ulimit command. The kernel does not let the MAXs
overlap. You might have to lower your STACK value to be able
to raise your DATA limit.
There is a possibility that users could kill themselves by
lowering their STACK limit below what they have already
allocated on the stack and then try to use it, (getting a
SIGSEGV).
To change the soft limit using the chuser command, execute:
chuser data=<value> <username>
To change the hard limit using the chuser command, execute:
chuser hard_data=<value> <username>
To change your current soft limit use, execute:
ulimit -d <value>
- Stack segment:
STACK = 8192 (units in 512-byte blocks in
/etc/security/limits and kbytes in ulimit)
HARD_STACK = -1
This limit defines the maximum size, in bytes, of the stack
segment for a process. It defines how far a program's stack
segment might be extended. A process can access its stack
only up to the soft limit.
To change the soft limit using the chuser command, execute:
chuser limit=<value> <username>
To change the hard limit using the chuser command, execute:
chuser hard_limit=<value> <username>
To change your current soft limit use, execute:
ulimit -s <value>
- Resident set size:
RSS = 65536 (units in 512-byte blocks in
/etc/security/limits and KB in ulimit)
HARD_RSS = -1
This limit defines the maximum size, in bytes, to which a
process's resident set size may grow. The limit is (not)
enforced by the kernel. The kernel does not check this value
for a process. It lets the process use as much memory as it
needs to run, and it does not kill a process if the process
&.nbsp; reaches its soft limit.
The kernel starts killing processes only if system-wide
paging space gets very low, and that's only after it has
sent a SIGDANGER signal (init catches this signal and sends
a warning message to the console).
The warning happens when the system has only about 2 MB
of free paging space, and soon after this it starts killing
the youngest process that uses virtual memory.
To change the soft limit using the chuser command, execute:
chuser rss=<value> <username>
To change the hard limit using the chuser command, execute:
chuser hard_rss=<value> <username>
To change your current soft limit use, execute:
ulimit -m <value>
- Number of open files:
NOFILES = 2000
HARD_NOFILES = -1
NOTE: In all versions prior to AIX 4.3.1, this number is
fixed at 2000.
This limit is enforced by the kernel, which means that a
single process cannot have more file descriptors at one time
than specified by this limit. The maximum value for this
limit is 32767.
To change the soft limit using the chuser command, execute:
chuser nofiles=<value> <username>
To change the hard limit using the chuser command, execute:
chuser hard_nofiles=<value> <username>
To change your current soft limit use, execute:
ulimit -n <value>..