AIX上ulimit -a 輸出的含義
AIX 使用者使用的系統資源限制包括兩個概念 --- 硬限制(hard limits) 和軟式節流(soft limits)。
hard limits自AIX 4.1版本開始引入。hard limits 應由AIX系統管理員設定,只有security組的成員可以將此值增大,
使用者本身可以減小此限定值,但是其更改將隨著該使用者從系統退出而失效。使用下列命令可以查看hard limits的限定值:
ulimit -Ha
soft limits 是AIX核心使用的限制進程對系統資源的使用的上限值。此值可由任何人更改,但不能超出
hard limits值。這裡要注意的是只有security組的成員可使更改永久生效,普通使用者的更改在其退出系統
後將失效。使用以下命令可以查看soft limits的設定:
ulimit -a
在/etc/security/limits 將stack值設為了-1 為何用ulimit -a 看到的是 4194304?
出現這種問題的原因是在您的作業系統中設定了預設的stack的“硬限制”(hard limit)。要解決這個問題,您需要在/etc/security/limits中設定stack的新的硬限制(hard limit)為無限,然後再設定stack的限制。如:
default:
fsize = 2097151
core = 2097151
cpu = -1
data = 262144
rss = 65536
stack_hard = -1
stack = -1
nofiles = 2000
然後用受影響的使用者賬戶重新登入並運行ulimit -a命令,新的stack的限制應該成為無限:
#ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 131072
stack(kbytes) unlimited
memory(kbytes) 32768
coredump(blocks) 2097151
nofiles(descriptors) 2000
To view the current value specified for these shell limits, and to change them if necessary:
1.Enter the following command:
# smit chuser
很多問題也會由設定不當而引起,這些值可以通過ulimit -a來查看:
PEKAX528:/>ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) unlimited
stack(kbytes) 4194304
memory(kbytes) 32768
coredump(blocks) unlimited
nofiles(descriptors) 2000
但是這些都是什麼含義呢。下面這段文字看了就明白了。
PEKAX528:/>more /etc/security/limits
*
* Sizes are in multiples of 512 byte blocks, CPU time is in seconds
*
* fsize --- soft file size in blocks
* core --- soft core file size in blocks
* cpu --- soft per process CPU time limit in seconds
* data --- soft data segment size in blocks
* stack --- soft stack segment size in blocks
* rss --- soft real memory usage in blocks
* nofiles --- soft file descriptor limit
* fsize_hard --- hard file size in blocks
* core_hard --- hard core file size in blocks
* cpu_hard --- hard per process CPU time limit in seconds
* data_hard --- hard data segment size in blocks
* stack_hard --- hard stack segment size in blocks
* rss_hard --- hard real memory usage in blocks
* nofiles_hard --- hard file descriptor limit
*
* The following table contains the default hard values if the
* hard values are not explicitly defined:
*
* Attribute Value
* ========== ============
* fsize_hard set to fsize
* cpu_hard set to cpu
* core_hard -1
* data_hard -1
* stack_hard 8388608
* rss_hard -1
* nofiles_hard -1
*
* NOTE: A value of -1 implies "unlimited"
*
default:
fsize = 2097151
core = 2097151
cpu = -1
data = 262144
rss = 65536
stack = 65536
nofiles = 2000
root:
fsize = -1
data = -1
stack = -1
core = -1
daemon:
bin:
sys:
adm:
uucp:
guest:
nobody:
lpd:
db2inst1:
core = -1
rss = -1
fsize = -1
data = 491519
oracle:
fsize = -1
data = -1
stack = -1
core = -1
fsize_hard = -1
cpu_hard = -1
data_hard = -1
stack_hard = -1
core_hard = -1
core_hard = -1
rss = -1
nofiles = 4000
ulimit 命令
用途