What is the role of the cores/threads in a CPU, and how do they differ?

345 viewsOtherTechnology

I’ve watched YouTube videos but I still don’t get their analogies. I just know for tasks like gaming it’s done through 1 thread only, that’s about it.

In: Technology

7 Answers

Anonymous 0 Comments

A cpu “core” is a physical part of your computer that executes instructions. A “brain” of sorts. When a computer program wants to, say, add two numbers, one of the cores actually does it.

If your computer has 16 cores, then that means that there are 16 individual physical “brains” that can all do completely independent things. One of them might add two numbers as part of one program while another multiplies two numbers as part of another. 

A “thread” in *software* is a “stream of execution”/sequence of instructions. A particular process may have one or many threads. If you’re running two different programs, that’s at least two threads – one for each program. If you have two cores, these two threads can be executed at the same time, one on each core. Note that it is the job of the operating system (windows, Linux, macos, whatever) to “schedule” these threads to run on particular cores. 

So far so good. But then why do cpus advertise threads if threads are software and cpus are hardware? And why is this number larger than the number of cores? 

Well, it turns out that a cpu can “pretend” that it has more cores than it does. It might have 8 physical cores, but advertise 16 “logical cores”. This means that the operating system acts as though there are more cores than there are, and might tell two threads to run on the same core on the same time. 

Why do this? If a core is a physical unit that is only capable of executing one instruction at a time, what is the point of telling it to do multiple things at once? 

Well, it turns out that cpu cores themselves have several components. It might have, say, circuitry for addition and circuitry for multiplication that is completely independent. 

So if the same core is told to work on two different threads, then there will (almost certainly) be times when the one thread wants to add while another wants to multiply. In this case, even the same core can do two things at once. 

To summarize: Cpu cores are physical processing units that can operate independently. More of these are good, because you can do more at once. But sometimes even a single core can do multiple things at once, so long as they can be done by different parts of the core. But operating systems, who decide what work is given to who to do, believe in cores, not parts of cores (as of the last time I read about this, dunno if this is changing). So a core will sometimes pretend to be multiple “logical cores” so the operating system will put multiple threads (streams of instructions) on the same core, to take advantage of the parallel capabilities within a core. This is sometimes advertised as “multiple threads”. 

The extent to which games can take advantage of any of this varies. Games have a lot of things that can’t be calculated until you calculate other things, which makes calculating things at the same time and so taking advantage of multiple cores harder. But not impossible, and it is my understanding that most games will take advantage of multiple cores to at least some extent. 

You are viewing 1 out of 7 answers, click here to view all answers.