운영체제/Unix & Linux
process, thread 수 확인 및 변경
날았다 고양이
2023. 5. 15. 23:43
반응형
1. process의 thread count 확인
ps -o nlwp <pid> or
ps -o thcount <pid>
watch ps -o thcount <pid>
** nlwp == thcount 같은 의미
2. 프로세별 thread count 확인
> ps -eo nlwp,command
3. 전체 thread count
> ps -eLf | wc -l
or
> ps -eo nlwp | tail -n +2 | awk '{ num_threads += $1 } END { print num_threads }'
4. 사용자별 thread count 수
> ps h -Led -o user | sort | uniq -c | sort -n
5. 서버상의 max process(실제 thread 수)
5.1 확인
> cat /proc/sys/kernel/pid_max
5.2 수정
> vi /etc/sysctl.conf
kernel.pid_max = 32768
> sysctl -p
6. 사용자의 max process
6.1 확인
> ulimit -u
6.2 수정
> ulimit -u 20
OR
> vi /etc/security/limits.conf
user1 soft nproc 20
user1 hard nproc 20
반응형