3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ハイパースレッディングとは?

Posted at

勉強前イメージ

CPUのなにか・・・・

調査

ハイパースレッディングとは?

Intel社がマイクロプロセッサーに搭載している
1つのプロセッサコアを擬似的に二つに見せかける技術で、
同時マルチスレッディング(SMT)技術の一つである。

そもそもプロセス・スレッドとは?

  • プロセス

実行中のプログラムのこと。
1つのプロセスには1つのメモリ空間が割り当てられている

  • スレッド

プロセス内で命令を実行する部分で、CPUコアを利用する単位
同時マルチスレッディング(SMT)ができるまでは1コアに1スレッドが立つのが普通でした。

SMTを利用すれば、
1コアに対して複数のスレッドを割り当てられることが出来ます。

様々な確認方法

こちらはlinuxでの確認方法。
多分他にもやり方あると思うけど、、、、

ハイパースレッディングが有効か確認したい

確認コマンドは以下。

dmidecode -t processor | grep -E '(Core Count|Thread Count)'

2コアですが、スレッドが4なのでハイパースレッディングが有効になっています。

[root@localhost ~]# dmidecode -t processor | grep -E '(Core Count|Thread Count)'
        Core Count: 2
        Thread Count: 4

CPUコア数を確認したい

  • 物理CPUの数
grep physical.id /proc/cpuinfo | sort -u | wc -l

結果は以下。
ここでは物理CPUは1つだけ。

[root@localhost ~]# grep physical.id /proc/cpuinfo | sort -u | wc -l
1
  • CPUごとのコア数
grep cpu.cores /proc/cpuinfo | sort -u

結果は以下。
マルチコアプロセッサーだと物理CPU1つにつき、何コアあるか見ることが出来ます。

[root@localhost ~]# grep cpu.cores /proc/cpuinfo | sort -u
cpu cores       : 2
  • 論理プロセッサーの数
grep processor /proc/cpuinfo | wc -l

結果は以下。
計算上、1つの物理CPUで・CPU1つにつき2コアなので、2ですが
ハイパースレッディングが有効になっているので2つのコアにつき2つスレッドがつくようになっています。

[root@localhost ~]# grep processor /proc/cpuinfo | wc -l
4

topを見てもCPUは4つになっている

top - 13:10:16 up 3 min,  1 user,  load average: 0.02, 0.04, 0.01
Tasks: 115 total,   1 running,  59 sleeping,   0 stopped,   0 zombie
%Cpu0  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu1  :  0.0 us,  0.0 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.3 st
%Cpu2  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu3  :  0.0 us,  0.3 sy,  0.0 ni, 99.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.3 st

勉強後イメージ

物理的なところは全く分からなかったけど、なんとなくわかった。。。。
実際に動くのは論理プロセッサーってこと?多分?
こういうの勉強するの、今までの知識が結びついて楽しいね

参考

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?