Knowledge about Linux CPU and Linux CPU
What is the difference between hyper-threading and multithreading?
Hyper-threading is understood from the hardware layer, that is, a CPU component (which can be understood as a core) executes multiple commands at the same time, which means that multiple threads are executed at the same time.
Multithreading is a concept at the software level. For example, a CPU has only one core. Through thread scheduling, multiple programs or tasks can be run within a period of time, but only one thread can be executed at any time.
In Linux, how do I know the CPU details in detail? Of course, it is checked through cat/proc/cpuinfo. But for example, how many physical CPUs, cores, and threads are there?
After checking, my development machine is a physical CPU, 4-Core 8-thread, Intel (R) Core (TM) i7 CPU 860 @ 2.80 GHz www.2cto.com record, judgment process and knowledge. Judgment basis: 1. the cpu with the same core id is hyper-threading of the same core. 2. A cpu with the same physical id is a thread or cores encapsulated by the same cpu. English version: 1. physical id and core id are not necessarily consecutive but they are unique. any cpu with the same core id are hyperthreads in the same core.2.Any cpu with the same physical id are threads or cores in the same physical socket. echo "logical CPU number:" # number of logical CPUs cat/proc/cpuinfo | grep "processor" | wc-l echo "physical CPU number:" # number of physical CPUs: cat/proc/cpuinfo | grep "physical id" | sort | uniq | Wc-l echo "core number in a physical CPU:" # number of cores in each physical CPU: cat/proc/cpuinfo | grep "cpu cores" | uniq | awk-F: '{print $2}' # check the number of core IDs on each physical cpu, that is, the number of cores on each physical CPU cat/proc/cpuinfo | grep "core id" # Is it hyper-threading? # If two logical CPUs have the same core id, hyper-threading is enabled. # The number of logical CPUs (possibly core, threads, or both) in each physical CPU: the cat/proc/cpuinfo | grep "siblings"/proc/cpuinfo file contains the data section of each processor on the system. There are six entries in the/proc/cpuinfo description for multi-core and super-thread (HT) technical checks: processor, vendor id, physical id, siblings, core id and cpu cores. The processor entry contains the unique identifier of the logical processor. Physical id entries include the unique identifier of each physical encapsulation. The core id Entry stores the unique identifier of each kernel. The siblings entry lists the number of logical processors in the same physical encapsulation. The cpu cores entry contains the number of cores in the same physical encapsulation. If the processor is an Intel processor, the string in the vendor id entry is GenuineIntel. 1. All logical processors with the same physical id share the same physical outlet. Each physical id represents a unique physical encapsulation. 2. Siblings indicates the number of logical processors located on the physical encapsulation. They may or may not support hyper-threading (HT) technology. 3. Each core id represents a unique processor kernel. All logical processors with the same core id are located on the same processor kernel. 4. If more than one logical processor has the same core id and physical id, The system supports hyper-threading (HT) technology. 5. If two or more logical processors have the same physical id but the core id is different, it indicates that this is a multi-core processor. The cpu cores entry can also indicate whether multiple kernels are supported. Determine whether the CPU is 64-bit. Check the flags section in cpuinfo to check whether the lm ID exists. Are the processors 64-bit? A 64-bit processor will have lm ("long mode") in the flags section of cpuinfo. A 32-bit processor will not.