Understanding Physical and Logical CPUs

This is a sketch of what physical and logical cpus actually mean and how they differ.

First, the term CPU is used loosely on the Internet to refer to processors, Cores, or Hardware threads. But Cores are generally a more accurate name for CPU.

Let’s start with a few terms:

A Processor is a physical chip on a system socket that contains one or more CPUs to implement the Cores or Hardware Thread.

Core is an independent CPU instance that sits on top of a multi-core processor. The use of a core to extend the processor is called chip-level multiprocessing.

Hardware Threads are a CPU architecture that supports simultaneous execution of multiple threads on each core, with each Thread running as a separate CPU instance. This extension method is called multithreading.

Now that we know the required term, physical CPU means the actual physical core that is present on the Processor. Whether multithreading is enabled for the Core does not affect the number of physical cpus on the Processor. In short, physical cpus correspond to physical Cores that actually exist on the Processor. The single processor shown above has four physical cores.

Logical CPU refers to the ability of each core to do 2 or more tasks at the same time. This is achieved by enabling hyperthreading on the core. Each physical core can be divided into multiple logical cores by enabling hyperthreading. In the figure above, there are only four physical cores, but by enabling hyperthreading on each core, the system treats them as if they were eight logical cpus.

The figure above corresponds to the following details:

One Processor, four physical Cores, and eight logical Cores. In other words — 1P4C — each core has two threads.

You can check these details in the system using the following command: lSCPU

Here’s what I got from the output above [1P2C– 2 threads per core, 4 logical cpus].

CPU Socket (S): 1 -> 1 processor

Core(s) per socket: 2 –> 2 cores

Thread(s) per core: 2 —

CPU(s): 4 –> total 4 logical CPUs

4 Logical CPUs is arrived by –> 2 Cores X 2 Threaded

For clarity, here’s another example:

Here is the above output : [2P8C – with 2 threads per core, 16 Logical CPUs]

Sockets : 2 –> 2 processors

Cores per socket : 4 –> 4 Cores per processor (2X4=8Total cores)

Threads per core : 2 –> 2 Threaded

CPUs : 16 — > 16 Logical CPUs

16 Logical CPUs is arrived by — > 2 Processors X 4 Cores/processor X 2 Threads/core

I hope to help you!

In addition, there is a term in the Oracle world called “OCPU”. To put it simply, AN OCPU is an Oracle CPU. As mentioned in the Oracle documentation:

“An OCPU provides CPU capacity equivalent of one physical core of an Intel Xeon processor with hyper threading enabled. Each OCPU corresponds to two hardware execution threads, known as vCPUs.”