Back to Blog

What Are CPU Cores and Threads?

What Are CPU Cores and Threads?
Command of the Day
lscpu | grep -E "Thread|Core|Socket|CPU\(s\)"

What it does: Filters lscpu output to display exact hardware metrics for sockets, physical cores, and logical threads.

When provisioning a server, CPU hardware is specified in terms of Cores and Threads (e.g., 8 Cores / 16 Threads or 16 vCPUs). Understanding the hardware difference between physical cores and logical threads is essential for optimizing web servers, database clusters, and game servers.

In this guide, we break down what CPU cores and threads are, how Simultaneous Multithreading (SMT) works, and how CPU topology affects performance on RivinCloud.


1. Physical Cores vs Logical Threads

┌────────────────────────────────────────────────────────┐
│                   Physical CPU Die                     │
│  ┌──────────────────────────┐┌────────────────────────┐  │
│  │     Physical Core 1      ││     Physical Core 2    │  │
│  │  ┌──────────┐┌──────────┐││  ┌──────────┐┌──────────┐│  │
│  │  │ Thread 1 ││ Thread 2 │││  │ Thread 3 ││ Thread 4 ││  │
│  │  └──────────┘└──────────┘││  └──────────┘└──────────┘│  │
│  └──────────────────────────┘└────────────────────────┘  │
└────────────────────────────────────────────────────────┘

Physical Core

A physical core is an independent hardware execution unit inside the Central Processing Unit microchip. It contains its own Arithmetic Logic Unit (ALU), Floating Point Unit (FPU), registers, and L1/L2 cache structures. A physical core executes actual machine instructions.

Logical Thread (Hyper-Threading / SMT)

Simultaneous Multithreading (SMT)—known as Hyper-Threading on Intel processors—allows a single physical core to present itself as two logical threads to the operating system.

  • While Thread 1 waits for data to arrive from RAM memory (memory latency), Thread 2 can use the core's idle execution pipelines.
  • SMT does not double physical compute power; it typically boosts overall CPU throughput by 15% to 30% by filling execution bubbles.

2. vCPUs in Virtualization

In cloud VPS hosting, a vCPU (Virtual CPU) corresponds to one logical thread on the host node's physical CPU.

  • A 4-vCPU VPS receives execution time slices on 4 logical threads across the physical server node.
  • KVM hypervisors manage context switching so your vCPUs run isolated from other tenant workloads.

3. Workload Mapping: Single-Thread vs Multi-Thread

Different server applications utilize CPU cores and threads differently:

Workload Type Primary Requirement Best CPU Configuration Examples
Single-Thread Bound High Single-Core Clock Speed (GHz) Fewer Cores, Higher GHz Minecraft main tick loop, Node.js single-thread loop
Multi-Thread Parallel High Core & Thread Count Many Cores (16–64+ Cores) Nginx web server, Video rendering, Compilation
Mixed Database High L3 Cache & Moderate Cores Balanced High-GHz Multi-Core MySQL, MariaDB, PostgreSQL

Command of the Day: lscpu

Use lscpu combined with grep to extract core and thread metrics from your Linux terminal.

Syntax

lscpu | grep -E "Thread|Core|Socket|CPU\(s\)"

Practical Example

lscpu | grep -E "Thread|Core|Socket|CPU\(s\)"

Sample Output

CPU(s):                  16
Thread(s) per core:      2
Core(s) per socket:      8
Socket(s):               1

Explanation

  • CPU(s): 16: Total logical execution threads visible to Linux.
  • Core(s) per socket: 8: Number of real physical cores.
  • Thread(s) per core: 2: SMT / Hyper-Threading is active (8 physical cores × 2 threads = 16 logical CPUs).

Common Mistakes

  • Assuming 16 threads equals 16 physical cores: SMT threads share execution units within the core. Two threads on one core do not deliver the performance of two separate physical cores.
  • Neglecting single-thread ratings for game servers: Choosing a 64-thread low-frequency processor for game hosting can cause tick lag.

Troubleshooting

  • Checking active CPU thread usage: Run htop and press 1 to view individual utilization bars for every logical thread.

Best Practices

  • Match your application architecture to hardware: high GHz for single-threaded tasks, high core counts for parallel web daemons.
  • Verify SMT status when running latency-critical real-time applications.

Frequently Asked Questions

Can I disable SMT / Hyper-Threading on a dedicated server?

Yes. In BIOS/UEFI settings or kernel boot parameters (nosmt), SMT can be disabled if your workload suffers from cache contention.


Conclusion

Understanding physical CPU cores versus logical threads enables smart infrastructure sizing. Choose the optimal CPU configuration for your workloads on RivinCloud!