[asterisk-users] Hyperthreading and multicore

Matt Watson mwatson at becon.org
Tue Apr 29 09:35:38 CDT 2008


This is my understanding of hyper threading, which I believe to be accurate.

Basically, as some have mentioned previously, the OS 'sees' your single physical core processor as 2 logical processors, in generally, logical processors are treated exactly as if they were real processors, and in the case of many OS's. they probably don't understand the difference - Linux however does have specific SMT support for hyperthreaded cores.

Basically not all CPU instructions take the same amount of clock cycles to complete, some may take 3, some may take 7, etc.

Many of these clock cycles actually goto waste because the CPU is waiting for something, for example, an instruction that involves a fetch from memory, if this takes 7 clock cycles to complete, 4 of those cycles might go wasted while the CPU essentially just sits there and waits for the data to be fetched form RAM, L1 or L2, or L3 cache.

Hyperthreading essentially puts these wasted CPU cycles to use by allowing the CPU to execute a separate thread while it would otherwise be idle waiting.

To me Hyperthreading is an excellent technology... I;m all about efficiency and trying to maximize resource usage whenever possible... and that exactly what hyper threading does.

That all being said... Hyper threading should not be thought of as effectively doubling your CPU power... as previous posters have said, Hyper threading will result in single threaded applications actually running slower.. this is because you still have other background processes running which may run on the other logical processor which could steal CPU cycles away from your main application... since you essentially have 2 threads executing on the same physical core, there are going to be times when one thread has to wait extra clock cycles while the other thread is executing.  Remember its only those normally "wasted" clock cycles that you are going to gain a performance boost out of by making use of them... only 1 thread can actually be executing at any given time, so the CPU has to schedule these and try balance the threads equally so they each get an equal share of the physical core.

I can't say how Asterisk behaves or makes use of additional cores or if hyper threading is advantageous to Asterisk or not... I don't know enough about the low level parts of Asterisk enough to make an informed opinion about that.

I just thought I'd throw in my 2 cents about what hyper threading is and what it does.

--
Matt


-----Original Message-----
From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Rob Hillis
Sent: Tuesday, April 29, 2008 9:56 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Hyperthreading and multicore

Matt Florell wrote:
> Also, I have heard HT processors explained this way, on an HT
> processor it's like running 2 virtual processors at 70% of the specs
> of the processor with HT turned off. It's not really like that in all
> situations, but overall it has held pretty much true for me in most
> non-Asterisk situations. Asterisk didn't benefit much from having HT
> enabled on a P4 with HT capability.

That wouldn't surprise me - after all, HyperThreading works on the
principle of allowing two "threads" to use different dedicated processor
resources (such as floating point math processors and so on) at the same
time... however if two threads are trying to use the same processor
resource, one thread will be "suspended" until that resource becomes
available.

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users



More information about the asterisk-users mailing list