Run the lscpu command on your Linux machine to see the difference between the physical and logical CPU (kernel). The output will look something like this:
Figure 01: Output of the lscpu command
The rest are not that important in regard to this matter, so I’ll skip them for now. At the moment we are only concentrating on a few key features. Beginning with
Important terms:
- Socket(s): The unique number of the actual socket on which the CPU resides. In the example above, a processor is connected to a single socket. A processor contains cores, threads, and other components.
- Core(s) per socket: This number indicates the number of physical cores (CPUs) that the hardware thread (logical CPU) is a part of. A processor in the above example has four cores.
- Threads per core: This figure shows how many logical CPUs there are for each core. Each thread that is part of a core functions as a logical CPU. Hardware Thread is another name for these threads. On each core, the Hardware Thread allows multiple threads to run concurrently, with each thread acting as an independent CPU instance. Each core in the above example has two threads.
- CPU(s): The total number of logical CPUs available on the board. The number of logical CPUs in the above scenario is 8.
- NUMA node (s):Β Non-uniform memory access node or NUMA node(s). A NUMA node is all there is.
This design represents 4 physical cores and 8 logical cores (CPUs), since each core has two threads. Please refer to the following image for a better understanding:
Figure 02: Processor
In this case, we can say that there are 1 Processor (1P) and 4 Cores (4C), each of which has 2 threads. The processor in question has 4 physical cores (4C), each of which houses 2 threads (or logical cores). So a total of 8 logical cores.
Now let’s run the command lscpu -e; the results will look like this:
Figure 03: Output of the lscpu -e command
The terms CPU, Node, Socket, and Core have already been explored above. Additional terms that have some meaning include:
- Data cache connected to the CPU, L1d.
- L1i: CPU-integrated instruction cache
- L2: The cache attached to the CPU
- L3: Cache attached to the CPU
Unlike lscpu -e, which displays the number of caches attached to each thread (logical CPU), the lscpu command displays the cache size. Please refer to the following illustration for a better understanding:
Figure 04: Processor