lainchan / Ω
(untitled)
The Phantom Phreak · 2018-12-09 02:08
Hello lainons, I think I could ask you something I've been trying to understand?
Recently in my computer science classes my teacher said something about Intel Hyperthreading and how it works, but it was a very superficial explanation.
I want to understand how it works on low level terms, but I can't find information about it anywhere. Could you help me out with this?
Appleman1234 · 2018-12-09 03:22
>>14577
In short hyperthreading allows a single core CPU to exclude multiple threads, in order to poorly emulate having multi cores.
This picture provides a partial demonstration
https://i.stack.imgur.com/rQlUc.png
See the following resources for more information.
Stackoverflow: https://superuser.com/questions/122536/what-is-hyper-threading-and-how-does-it-work
First attachment
Hyper-Threading Technology Architecture and
Microarchitecture from Intel
Second Attachment
The Impact of Hyper-Threading on Processor
Resource Utilization in Production Applications from NASA
Third attachment
Multi-Core Programming Increasing Performance through Software Multithreading by Shameem Ahkter & Jason Roberts
Technician · 2018-12-09 17:41
>>14578
Thanks a thousand lainon! That taught me a lot about the subject.
Hououin Kyouma · 2018-12-15 19:58
>>14578
Excuse me, lainon, but I've come across some doubts.
I understood that the Hyper-Threading tecnology doesn't in fact doubles de quantity of processors. Actually, it doubles the architetural state on each logical processor, and thus it appears as having double the logical processors.
But, about efficiency, is it more efficient to have 2 processors without Hyper-Threading or 1 processor with Hyper-threading?
I Suppose having 2 processors is better, but in terms of efficiency rate, how much % is having 2 processors without HT better than 1 processor with HT enabled?
Nobody important · 2018-12-15 21:10
>>14710
>But, about efficiency, is it more efficient to have 2 processors without Hyper-Threading or 1 processor with Hyper-threading?
It's more efficient to have one processor with hyper-threading, in most situations. Hyper-threading allows the processor to execute other code while it's waiting for memory lookups, rather than just wait. The only applications where you really need physical processors are memory-light, computation-intensive activities which are pretty rare in desktop-PC systems.
Jim Hilger · 2018-12-15 21:15
>>14712
>The only applications where you really need physical processors are memory-light, computation-intensive activities which are pretty rare in desktop-PC systems.
I feel like this is wrong.
I remember reading that the second logical processor needs to wait for the 1st logical processor to release a cpu resource before taking it and queues forever.
So in some CPU intensive tasks such as gaming or audio/video rendering the hyper threading technology does nothing at all.
Also I'm pretty sure I read somewhere that the hyper threading only helped processing time in like 5% in the better cases
SHODAN · 2018-12-15 22:51
>>14713
That's called a spinlock, it's a problem with the program not the CPU. If two threads are using the same memory region of course you won't get any performance boost, even with physical CPU cores.
Gaming is usually IO- and memory- intensive, so a good CPU will be spending most of its time doing nothing, hyper-threading or no.
And yes, performance boosts are usually marginal when you're running non-concurrent programs. The vast majority of programs do not use multithreading, and the vast majority of programs which do use multithreading use it incorrectly.
Dox · 2018-12-16 01:38
>>14712
I also feel like this is wrong.
I've done a little search and found this:
>Multi-core technology has all the advantages of Hyper-Threading technology and more. Unlike HT technology, which uses two virtual cores for every physical core to process tasks more efficiently, multi-core technology adds physical cores. As a single physical core is more powerful than a single virtual core, a dual-core processor is more powerful than a single-core processor with Hyper-Threading.
Maybe i didn't understand your point. What would be a memory-light, computation-intensive activitie?
Anonymous · 2018-12-16 02:31
>>14720
something that doesn't need a lot of working memory, and is doing *lots* of mathematical calculations per second. Something like prime number searches, protein folding(although idk enough about that to verify), differential equation solving, stuff like that.
I'm not saying hyperthreading is better, but it's also not really worse. Wrt relative "power" of a processor, it's not so easy to measure that any more. Modern CISC processors are *very* complex and they're optimized to work on certain things better than others. The days of more IPC => more speed are long gone.
Trinity · 2018-12-17 22:44
>>14578
What are these called "Processor execution resources"?
I found that arch state is just a bunch of registers of different kinds but i can't find anything relade to these execution resources. Can someone explain this to me?
Roy Batty · 2018-12-17 22:45
>>14762
In "Processor execution resources"I 'm talking about the figure 2
Roy Batty · 2018-12-18 01:18
>>14762
Think about a circuit that does division. It's got a bunch of gates and registers and soykaf and you feed it some numbers and some number of cycles later the answer pops out. So, with a normal in-order CPU everything has to wait until the answer comes out before continuing, but there are a number of things you can do to speed that up.
If you're doing a bunch of division you can start doing the next division before the first one completes, since parts of the division circuit are only used for certain parts of the division. This is pipelining.
If you're not going to need the result for a while you can do other things like addition or whatever on different parts of the chip. This is out-of-order execution.
If you have two programs running and one needs to do division and the other is doing something else, you can duplicate the registers and direct the output of the divider to thread A's registers and whatever other unit to B's registers. That's SMT aka hyperthreading.
You'll notice all these methods only apply in specific scenarios, which is why modern CPUs use all three, and also other tricks.
Case · 2018-12-18 01:29
>>14764
I don't get your point. You mean that all these methods are the so called "Processor execution resources"?
Hacker · 2018-12-18 02:08
>>14765
No, I described three different ways that resources can be used more efficiently. The resource in the example is the divider. You can imagine a modern processor will have many different units for doing different things like division, multiplication, square roots, floating math, address calculations, bit shifting, matrix manipulation, cache and TLB lookups, etc.
Tomohisa "Tom" Kanezaki · 2018-12-18 19:21
>>14762
>I found that arch state is just a bunch of registers
Yes each logical core has it's own copy of all the CPU registers and that's what they are calling the "arch state".
>What are these called "Processor execution resources"?
Next page
>Logical processors share nearly all other resources on the physical processor, such as caches, execution units, branch predictors, control logic, and buses.
>>14765
>I don't get your point
I think his point is more about pipelining in general. It's like when the guy at Subway puts your sandwich in the oven. He doesn't just stand there like a muppet waiting for it to finish he starts making the next guy's sandwich instead.
To address your question, the sandwiches are the "arch state" and the oven is the "processor execution resources" and the guys are the logical cores. Each guy can work on 1 sandwich at a time but only one of them can use the oven. So even though there is a bottle neck, it is still faster than having only 1 guy and much cheaper than buying 2 ovens.
Unidentified · 2019-02-28 22:43
>>14577
so with all of this in mind, would you rather a more modern i3 with a higher hertz or a multicore older i7 with more cores and threads but lower hertz