The relationship between the number of threads and the number of cpu

Cpu here is not the number refers to the total number of cpu system, nor does it mean cpu total number of cores, but rather refers to the total number of logic processing unit, i.e., hyper-cpu.

The total number of logic processing unit IO-intensive programs (e.g., interactive database data, file uploading and downloading, the data transmission network, etc.) the number of threads is 2 times.

Compute-intensive programs (such as data conversion, recursive, complex algorithms, encryption and decryption program) set the total number of threads to the number of logical processing unit .

The total number of logic processing unit acquires java Method:Runtime.getRuntime().availableProcessors()

 

Generally, we say that a computer how many physical cpu, the total number of cores, a total of how many threads.

 

Total number of physical CPU = CPU core * the number of pieces per physical CPU core;
the total number of logical CPU * = the number of physical particles per physical CPU core * hyperthreads the CPU;

 

windows to view the total number of logical cpu method:

1, the device manager -> Processor

4 FIG logical CPU number / logic processing unit / threads

2, Task Manager -> Performance

4 represents the slot number of four logical CPU / logic processing unit / threads

In general, the total number of cores = Total number of logical CPU / 2

 

linux see the total number of logical cpu method:

View CPU information (model) 
[root @ AAA ~] # CAT / proc / cpuinfo | grep name | Cut -f2 -d: | uniq -c 
     24-Intel (R) Xeon (R) E5-2630 CPU @ 2.30GHz 0 

# See physical number the CPU 
[the root the AAA @ ~] # CAT / proc / cpuinfo | grep "pHYSICAL ID" | Sort | the uniq | WC -l 
2 

# Check number core in each physical CPU (i.e. Audit) 
[the root ~ @AAA] CAT # / proc / cpuinfo | grep "CPU Cores" | the uniq 
CPU Cores:. 6 

# view the logical CPU number 
[root @ AAA ~] # cat / proc / cpuinfo | grep "processor" | wc -l 
twenty four

https://www.cnblogs.com/bugutian/p/6138880.html

 

Guess you like

Origin www.cnblogs.com/jetqiu/p/11234640.html