Jump to content

2x threads / 1x core is like 2x hands feeding 1x mouth.

It can increase performance by keeping the core busy with better scheduling. 

 

Moved to CPUs, Motherboards, and Memory.

If you ever need help with a build, read the following before posting: http://linustechtips.com/main/topic/3061-build-plan-thread-recommendations-please-read-before-posting/
Also, make sure to quote a post or tag a member when replying or else they won't get a notification that you replied to them.

Link to comment
https://linustechtips.com/topic/1588707-cores-and-threads/#findComment-16571092
Share on other sites

Link to post
Share on other sites

What you need to know about is hyperthreading. If you have a hyperthreaded core, it is split into two logical processors- threads. Lets say you have an i9 14900k for example. It has 8 performance cores which are hyperthreaded and 16 efficiency cores which are not hyperthreaded. If you look at it from a logical processor or thread perspective, you will find that it has 32 logical processors or threads. That's 8*2+16=32.

 

Long story short, hyperthreading allows a single core to do two separate tasks.

My PC Specs: (expand to view)

 

 

Main Gaming Machine

CPU:  Intel Core i7-14700K
CPU Cooler: Deepcool LT720
Motherboard: MSI PRO Z790-P WIFI
Memory: G.Skill Trident Z5 RGB 32 GB (2 x 16 GB) DDR5-6400

Storage 1: Samsung 990 Pro 2 TB

Storage 2: Crucial P3 Plus 4 TB
Video Card: EVGA XC3 ULTRA GAMING GeForce RTX 3080 10GB

Power Supply: Corsair RM850 850W
Case: Corsair 7000D Airflow
Case Fan 140mm: Noctua A14 PWM 82.5 CFM 140 mm (x7)
Monitor Main: MSI G274QPF-QD 27.0" 2560 x 1440 170 Hz
Monitor Vertical: Asus VA27EHE 27.0" 1920x1080 75 Hz

Link to comment
https://linustechtips.com/topic/1588707-cores-and-threads/#findComment-16571094
Share on other sites

Link to post
Share on other sites

2 hours ago, G.Paws said:

Im struggling with this is threads in a cpu like splitting a core into two like a dual core or what?

No, a thread is not the same as a core. If a thread was the same as a core, a CPU with 8 cores / 16 threads would simply be referred to as having 16 cores instead.

 

Each core is essentially a CPU in its own right. Outside of some shared resources, like cache, they work independent from one another. If you have a task that can be parallelized, going from one core to two cores should give you close to +100% performance.

 

A thread on the other hand turns a single core into two virtual cores, by providing two instruction queues for the same core. While that makes it look like two cores from an outside perspective, its the same worker behind both queues. In the best case this can provide roughly +30% better performance. This is known as Simultaneous Multi-Threading (SMT) or, in Intel marketing terms, "Hyperthreading".

 

To give you an analogy, maybe think of a core like a ticket booth, with a line of people in front waiting for "processing". As always, take analogies with a grain of salt.

 

If you double the number of booths (i.e. cores), that should double the number of people able to buy tickets at the same time. Of course how much of a "performance uplift" you get depends on how many people there are and whether you can split them across that many "cores" (e.g. a family of four goes to the same both, so you can't process them in parallel, in the same way some compute tasks can't be split, so more cores don't always make things move faster)

 

Meanwhile, enabling "SMT" means that each ticket booth gets two queues of people, instead of just one. It's still only one person accepting payment and handing out tickets, but there are now two lines of people to process (the cashier alternating between processing people from queue 1 and 2).

 

How does that improve performance? Imagine it a bit like this: while the person buying a ticket is busy searching their wallet or stowing the ticket they bought, the cashier in the booth can already start to take care of a customer waiting on the other line, instead of simply sitting idle. So it improves core utilization which, as I already said, can provide up to 30% better performance in some scenarios.

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
https://linustechtips.com/topic/1588707-cores-and-threads/#findComment-16571141
Share on other sites

Link to post
Share on other sites

Probably a better analogy would be each booth being able to either accept cash payments, or process a credit card, or validate a prepaid pass. The employee or employees in a booth can do 2 out of three of them simultaneously, so some cars could pass by paying with credit card while the employee is still counting coins for another person. 

 

Basically, in a very simplified way, a core is made out of specialized sections that are very good at some things ... a core may have let's say 6 units that only do additions and/or substractions , 2-4 units that only do multiplications and/or divisions, and 1-2 units that only work with floating point numbers. 

 

A specialized section of the core takes in a program and looks at the mathematical operations a program is going to make, and where possible, it splits the operations to the right units. 

 

So if your program does  total =  100 + 5 + 10 + 25  , the scheduler of the core can put 100+5 in the first addition unit, and 10 + 25 in the second addition unit and have them run in parallel, and once the results come in, another addition unit can add up the two results...  but in this case, only two of the six addition units were actively working and the other 4 were doing nothing.   

 

If your program does  something like total = (10 + 5 ) x 100 , the scheduler knows that the multiplication unit can only be used after the addition unit does its job so the multiplication unit will sit doing nothing. Or, it may recognize the formula can be rewritten as total =  10 x 100 + 5 x 100  and use two multiplication units if they're free and then add the two results together in an addition unit.

 

In both cases, the schedules sees that units do nothing and are smart enough to look ahead at what calculations the program may want to do in the future and have those calculations run ahead of time when possible to keep those units busy. 

 

For example, program may have something like  

 

if total  < 100 then  <put sum of these numbers in this variable >  else  < put sum of these other numbers in this variable > 

 

before the total is even calculated, the scheduler may use the unused addition units to calculate both branches at the same time in the free addition units , and when the total is determined, it simply throws out the result that's not needed. 

 

Even so, some units may sit unused, and then the scheduler can take a second program's mathematical calculations and let that program "borrow" units that are unused by the first program to do work.

 

The operating system assigns programs to cores and may move programs between cores depending how loaded cores are , so by making two threads (one fake core that borrows units from a real core when they're available), the processor appears to the operating system as having more cores.    

 

 

Link to comment
https://linustechtips.com/topic/1588707-cores-and-threads/#findComment-16571168
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×