system resource limit (ulimit)

Younghwan Cha·2023년 5월 30일
0

linux

목록 보기
4/24
post-thumbnail

Ulimit

Ulimit 란, User process resource limit 를 설정하는 command 이다.
system resource 관련 정보는 /etc/security/limits.conf 에서 확인 할 수 있다.

# /etc/security/limits.conf
#
# Each line describes a limit for a user in the form:
#
# <domain>        <type>  <item>  <value>
#
# Where:
# <domain> can be:
#        - a user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#        - NOTE: group and wildcard limits are not applied to root.
#          To apply a limit to the root user, <domain> must be
#          the literal username root.
#
# <type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
# <item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open file descriptors
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit (KB)
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#        - rtprio - max realtime priority
#        - chroot - change root to directory (Debian-specific)
#
# <domain>      <type>  <item>         <value>
#

# *               soft    core            0
# root            hard    core            100000

# End of file

type

soft: 새로운 프로그램을 생성하면 기본(default)으로 적용되는 한도
hard: 소프트한도에서 최대(Max)로 늘릴 수 있는 한도

item

nproc : User당 사용할 수 있는 프로세스 최대 개수

Ulimit 항목내용

ulimit -a 명령어를 통해서
해당 내용은 /proc/self/limits 경로에서 확인 할 수 있다.

-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)         0
-m: resident set size (kbytes)      unlimited
-u: processes                       127867
-n: file descriptors                1024
-l: locked-in-memory size (kbytes)  4101712
-v: address space (kbytes)          unlimited
-x: file locks                      unlimited
-i: pending signals                 127867
-q: bytes in POSIX msg queues       819200
-e: max nice                        0
-r: max rt priority                 0
-N 15:                              unlimited
core file size        : 코어파일의 최대크기
data seg size         : 프로세스의 데이터 세그먼트 최대크기
scheduling priority   : 쉘에서 생성되는 파일의 최대 크기
max memory size       : resident set size의 최대 크기(메모리 최대크기)
open files            : 한 프로세스에서 열 수 있는 open file descriptor의 최대 숫자(열수 있는 최대 파일 수)
pipe size             : 512-바이트 블럭의 파이프 크기
cpu time              : 총 누적된 CPU 시간(초)
max user processes    : 단일 유저가 사용가능한 프로세스의 최대 갯수
virtual memory        : 쉘에서 사용가능 한 가상 메모리의 최대 용량

Ulimit options

ulimit command option 들은 다음과 같다

-a : 모든 제한 사항을 보여줌.
-c : 최대 코어 파일 사이즈
-d : 프로세스 데이터 세그먼트의 최대 크기
-f : shell에 의해 만들어질 수 있는 파일의 최대 크기
-s : 최대 스택 크기
-p : 파이프 크기
-n : 오픈 파일의 최대수
-u : 오픈파일의 최대수
-v : 최대 가상메모리의 양
-S : soft 한도
-H : hard 한도

[ulimit] https://bangu4.tistory.com/138

profile
개발 기록

0개의 댓글