리눅스 CPU 개수 확인

  • 리눅스 CPU 개수 확인하기
  • 리눅스 CPU 코어 수 확인하기

1 개요

  • CPU core 수를 셀 수 있다.
  • 다만 인텔 하이퍼스레딩의 경우, OS(윈도우, 리눅스 등)에서 코어 수가 실제 코어 수의 2배로 인식된다.
  • 예를 들어 싱글코어는 코어 2개로, 듀얼코어는 4개로 인식된다.

2 CPU 정보

cat /proc/cpuinfo

3 물리 CPU 수

일부 리눅스에서는 나오지 않음. CentOS, Oracle Enterprise Linux에서는 나온다.

명령어
tail -n 20 /proc/cpuinfo | grep "physical id"
예시
[root@jmnote ~]# tail -n 20 /proc/cpuinfo | grep "physical id"
physical id     : 3

→ physical id는 0부터 시작하므로 0, 1, 2, 3. 물리 CPU는 4개.

예시 2
[root@jmnote ~]# tail -n 20 /proc/cpuinfo | grep "physical id" | awk '{print $4+1}'
4

4 물리 CPU 코어 수

grep -c "physical id" /proc/cpuinfo
[root@jmnote ~]# grep -c processor /proc/cpuinfo
64

→ 물리 코어수가 64.

5 가상 CPU 코어 수

grep -c processor /proc/cpuinfo
[root@jmnote ~]# grep -c processor /proc/cpuinfo
16

→ 가상 CPU 코어 수는 16. 물리적으로는 8 코어.

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}