DEV Community

Cover image for Cores, Threads, and Performance
Manoj Talagadadeevi
Manoj Talagadadeevi

Posted on

Cores, Threads, and Performance

We’re going to take a closer look at cores and threads so you can answer common questions about what they are and how they work

The Big Picture

Cores and threads are part of the central processing unit (CPU), which is often called the processor. The processor is the brain of the computer that directs and controls the computer’s operations.

Just like a human brain is composed of neurons, cells, and blood vessels, the computer's brain, or processor, is made up of these main parts:

  • Cores perform tasks necessary to run applications
  • Threads help the processor schedule tasks efficiently
  • Transistors act as switches that prevent or allow electrical currents to pass through
  • Gates turn transistors on and off

Research on human brains shows that higher IQ scores are associated not with simply having more neurons but rather with having neurons that are better connected and fire faster.1 As you'll see, the speed of a processor is likewise determined not simply by size but also by quality.

As a further analogy, consider whether you could light a room better with two lightbulbs or four candles.

Light Bulb vs Candle

Fewer light bulbs will do the job better. Simply having MORE candles doesn’t make them more effective. Quality matters too, and that’s also true of two key processor parts: cores and threads.

Light Bulb Yellow vs Candle

What Are Cores?

A processor core is a marvel of engineering!
It’s the physical hardware in a CPU that processes all the data or instructions necessary to run computer workloads—everything from opening an application to editing a video.

Are All Cores the Same?

Customers might mistakenly believe that all cores are the same, so be sure to clarify:

All cores are not created equal!

Performance Hybrid Architecture

Performance Hybrid Architecture integrates two different cores onto the same die. Rather than use one type of core, two separate cores -- Performance‑cores (P‑cores) and Efficient‑cores (E‑cores), have been created to handle different workloads.

P-cores operate at a higher frequency, are ideal for single-threaded workloads, and typically handle tasks in the foreground.

E-cores operate at a lower frequency, are ideal for multithreaded workloads, and are best suited for background tasks.

One should know that because different cores are designed differently, some are faster and more efficient than others.
How can one tell?
One way is to look at another part of the fact tag, which shows the frequency (measured in gigahertz, or GHz), or speed of the processor.

What is Frequency?

The higher a processor's frequency, or clock speed, the more instructions a core can run in a given period of time. A processor with a higher frequency can perform more calculations in less time, which translates into a faster overall experience for the customer.

If a customer wants to know how fast a computer is, let them know that the max frequency shown on fact tags is the key figure to look at—arguably more important than the number of cores or the number of threads!

What Are Threads?

A thread is a set of instructions that is passed to a core to be processed. Cores have a lot to do, so it’s important to have threads that effectively schedule what each core does and in what order. As soon as a core finishes one process, ideally it should have another one ready to go. Threads help make that possible, so cores can operate as quickly and efficiently as possible.

What Are Single-threaded Applications?

Single-threaded workloads are typically more demanding and only use 1-2 threads per task.
Tasks are accomplished in sequential order where one instruction is processed at a time. Before beginning a new task, the thread must see the previous task all the way through.
Gaming is a common single-threaded task, as it’s incredibly demanding on a user’s device.

What Are Multithreaded Applications?

Multithreaded workloads use 3 or more threads, enabling multiple tasks to be completed at the same time. Work is divided up into smaller pieces and distributed to the many threads available, so tasks can be executed in parallel with one another. Multithreading saves time and maximizes CPU efficiency by accomplishing numerous sets of instructions simultaneously.

Content Creation work like video transcoding or encoding are common multithreading applications, as those processes can be broken down into several smaller tasks.

What is Thread Director?

Core performance is optimized by the Thread Director, which automatically distributes tasks to whichever core is best suited for that workload. Through the power of AI, the Thread Director schedules tasks on the right core at the right time.

First, the Thread Director identifies the type of workload. Then, it assists the operating system by scheduling threads to run on either P-cores or E-cores. This technology ensures that P-cores and E-cores can run different applications simultaneously without slowing a user down.

How It All Works Together

Now that you know what cores, threads, and frequency are, let’s use an analogy to see how they all work together.

An experienced cashier represents a high-frequency core. He can check out groceries faster than the average employee.

A newly hired cashier represents a low-frequency core. She checks out groceries more slowly than the average employee.

Cashier-2

A cash register represents application threading. The cash register makes it possible for the cashiers to do their jobs, much like how single-threaded and multithreaded applications enable cores to process tasks.

Cash register

Example 1: Frequency & Single-threaded Applications

Single-threaded applications benefit from having a high-frequency core, which operates at a faster speed. An increase in speed helps expedite single-threaded workloads, as these sets of instructions are executed one at a time. With a higher-frequency core, threads can be processed quicker one after another.

Single-Thread

Example 2: Frequency & Multithreaded Applications

Multithreaded applications accomplish less demanding tasks at a lower frequency. Since they operate at a lower frequency, multithreaded workloads help maximize CPU efficiency. By handling smaller background tasks in parallel with one another, many threads and cores can be utilized simultaneously.

Multi-Thread

Are More Cores Always Better?

Many believe that more cores are always better.
As you’ve just seen, that’s not the case. What matters more is frequency, which we’ll show using two real-world examples: gaming and productivity.

Gaming performance

If more cores were always better, then gaming performance would keep getting better in systems with more cores. But that’s not what happens.

Summary

Now that you understand what cores and threads are and how they work, you can help anyone understand these important considerations when making a purchase:

More Cores and Threads

Single and Multi Threaded

Performance

Frequency

Top comments (0)