• Competitor rules

    Please remember that any mention of competitors, hinting at competitors or offering to provide details of competitors will result in an account suspension. The full rules can be found under the 'Terms and Rules' link in the bottom right corner of your screen. Just don't mention competitors in any way, shape or form and you'll be OK.

CPU Threads

Man of Honour
Joined
4 Jul 2008
Posts
26,468
Location
(''\(';.;')/'')
Okay chaps short thread probably, just wondering if someoen can explain what a "thread" is in CPU terms.

Basically, before the i7 pages were took down from OcUK, the specs said 4 Cores (8 Threads). Just wondering if someone could explain this to me ;)
 
In hardware terms a thread is just a stream of instructions. If a CPU has four physical cores that means it can normally process 4 streams of instructions at a time.

The i7 has a system where each of those 4 cores accepts two streams/threads at the same time. Instructions don't use all the various parts of a core at once, so if the second thread needs access to parts of the core that the first thread isn't using then both can be run at the same time. If both threads need access to the same hardware then the second one is paused until the first one is done with that bit of the chip.

Practically, with the i7 you get 4 real cores and 4 much slower 'mini-me' ones that don't do much work. How much of a benefit this is in the real world is debatable, there are not many workloads where the overhead of dealing with twice as many threads is lower than the work done by the 4 fake cores. I think it's mostly useful for impressing people by showing them 8 graphs on the task manager window :p
 
I'm wondering a bit how this is implemented, if you have one thread on one core that wants to use a lot of processing power will it be limited to 50% usage of one core or allowed to use 100% until another thread comes along at which point the core usage is dynamically shared by the two threads?

If a thread is limited to 50% core usage this is bad for single threaded apps and if it isn't then surely their is no advantage for multi-threaded apps to use more than 4 thread as they have to be distributed over the same cores?

Can't really see the point either way:confused:
 
I'm wondering a bit how this is implemented, if you have one thread on one core that wants to use a lot of processing power will it be limited to 50% usage of one core or allowed to use 100% until another thread comes along at which point the core usage is dynamically shared by the two threads?
Hyperthreading only makes sense when you understand that 'CPU use' graphs like the one in the task manager are very, very crude. It's just a count of idle and busy cycles over a small period of time (a second or so).

Using a simplified example with small numbers to make this easier on my poor brain ( ;) ) - if a CPU runs at 20MHz then it has 20,000,000 available cycles every second. If it spends 5,000,000 cycles processing instructions and the other 15,000,000 doing nothing then the CPU meter will show the processor as 25% busy. But CPU cores are complex devices and even though it is busy the instruction its working on may not use all the core's resources - resources that could be use for something useful.

To put this in human terms: I'm 'idle' when sitting doing nothing and 'busy' when drinking a cup of tea. But I still have one hand free, so I can scratch my nose at the same time as drinking tea. If I'm carrying a block of concrete then I don't have a spare hand and scratching my nose will have to wait.

That's what Hyperthreading is. A second thread that can use bits of the core not needed by the first thread. If both threads need access to the same part of the CPU then the second thread gets paused until the first one is done with that particular resource. There is also a timer that will eventually kick the first thread out of the way to prevent the second one from sitting too long as it may be latency-sensitive code like video or sound stuff.

So in an ideal situation Hyperthreading can magic extra performance from a CPU that claims to be 100% busy. In the worst case it can actually reduce performance due to management overhead. The original HT version on the Pentium 4 was a bit meh, but maybe the i7 one is better.
 
Ok i see what you are saying, i don't think i worded my original question very well.

I think what i was trying to ask is will the performance scale the same with the new i7 processors when you go from four threads to eight threads in the same way that going from 1-2 or 2-4 threads would?

I'm guessing from what has already been said is that it won't but their might be a slight gain.

An easy way to test i guess would be to run superpi while the cpu is idle and then run it again while loading the other seven threads with prime95 or use a multithreaded benchmark that goes up to eight threads.
 
Last edited:
DrBombcrater got this spot on here, what with the nose picking and all :)

The improvement you'll see from increasing the thread count beyond the number of actual cores depends on the workload being run. If you've got four cores and you are running four pieces of code which are amazingly optimised then you will see no kind of improvement by running any additional threads, as there are no idle gaps in processing time to fill.

However if you're running four threads which make unpredictable use of memory, are poorly coded, unoptimised etc, then an additional four threads will be easily be able to fill these idle gaps in CPU time. So in answer to your question, it really depends on how optimised superpi/prime95 etc are!
 
Last edited:
Back
Top Bottom