違いは何ですか-
newSingleThreadExecutor vs newFixedThreadPool(20)
オペレーティングシステムとプログラミングの観点から。
プログラムを使用してプログラムを実行しているときはいつでも、newSingleThreadExecutor
非常にうまく機能し、エンド ツー エンドのレイテンシ (95 パーセンタイル) が発生し5ms
ます。
しかし、使用してプログラムを実行し始めるとすぐに-
newFixedThreadPool(20)
プログラムのパフォーマンスが低下し、エンド ツー エンドのレイテンシが37ms
.
だから今、私はアーキテクチャの観点から、ここでスレッド数が何を意味するのかを理解しようとしていますか? また、選択すべき最適なスレッド数をどのように決定すればよいでしょうか?
さらに多くのスレッドを使用している場合、どうなりますか?
誰かが私にこれらの簡単なことを素人の言葉で説明できれば、それは私にとって非常に役に立ちます. 助けてくれてありがとう。
私のマシン構成仕様 - Linux マシンからプログラムを実行しています -
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz
stepping : 7
cpu MHz : 2599.999
cache size : 20480 KB
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat pln pts
bogomips : 5199.99
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz
stepping : 7
cpu MHz : 2599.999
cache size : 20480 KB
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm arat pln pts
bogomips : 5199.99
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: