Page 1 of 2

How can I make full use of my Quad-Core CPU?

Posted: Mon Dec 11, 2006 8:17 pm
by the_off_topic_guy
Hello!

I recently bought a Core 2 Extreme QX6700 and would like to know how can I make use of all 4 CPUs in my machine to make for example a small game.. What extra code do I need to use?

Posted: Mon Dec 11, 2006 8:53 pm
by dracflamloc
You need to figure out 4 subsystems of your game to split onto threads.

You could probably do,
Core 1: Game Loop/Sound
Core 2: AI or Physics
Core 3: Rendering
Core 4: Seamless background loading of levels, textures, etc.

Its tough to sync that kind of thing but have fun!

Honestly in small games you spend more CPU and memory access time syncing the threads than you gain in speed. You also need to be careful because I'm pretty sure they usually share the same cache, which can make optimization a bit tougher, since 4 intense threads can easily lead to pipeline flushing and cache thrashing more often than a single thread might.

Posted: Mon Dec 11, 2006 9:10 pm
by Trond
You can play WoW and Quake at the same time ... while rendering a 3ds max scene.

Posted: Mon Dec 11, 2006 9:16 pm
by Tranquil
Use as much as threads as possible. :) but this makes code even not more stable an readable.

Posted: Mon Dec 11, 2006 11:37 pm
by GeoTrail
The Core 2 Extreme QX6700 runs at 2.66GHz on a 1066MHz front-side bus, which isn't too impressive IMO, specially for that price. And it doesn't have 4 cpu's, it has 2 dies that contains 2 cores each, in total 4 cores ;)

Posted: Mon Dec 11, 2006 11:51 pm
by KarLKoX
You can learn here how to implement efficent threading algo, this is not the easiest task to code.

Posted: Tue Dec 12, 2006 1:34 am
by dracflamloc
Trond wrote:You can play WoW and Quake at the same time ... while rendering a 3ds max scene.
He better have 4 gfx cards too =)

Posted: Tue Dec 12, 2006 10:45 am
by Derek
He could put a REPEAT FOREVER loop into 3 threads and program his game in the other thread, then balance a kettle on his heatsink and boil some water to make a coffee. :)

Posted: Tue Dec 12, 2006 11:16 am
by the_off_topic_guy
dracflamloc wrote:
Trond wrote:You can play WoW and Quake at the same time ... while rendering a 3ds max scene.
He better have 4 gfx cards too =)
I have just 2 Graphic Cards (the other one is GeForce 7950 GX2 and the other one is 8800 GT, oh I love the SLi technology :P)...

Oh and don't ask for the price I spent for my PC... it was around 5000€.

Posted: Tue Dec 12, 2006 2:08 pm
by GeoTrail
Doesn't the graphics card have to be the same model? :arrow:

Posted: Tue Dec 12, 2006 2:41 pm
by kinglestat
I guess just use vista , read this forum with ie7 and play solitaire. Should use the cpus to the max ;) If you have any left over just use ms outlook to write an email with an attachment!!

cheers

KingLestat

Posted: Tue Dec 12, 2006 2:43 pm
by AND51
> Its tough to sync that kind of thing but have fun!
Beep! Have you ever heard the word 'Mutex'? :wink:

Posted: Tue Dec 12, 2006 3:10 pm
by dracflamloc
GeoTrail wrote:Doesn't the graphics card have to be the same model? :arrow:
If you're using SLI. But that won't help him play 4 games at once. He needs 4 independant cards with 4 displays to do that =)

Posted: Tue Dec 12, 2006 3:12 pm
by Derek
And probably 4 mice, 4 keyboards, 8 hands and 4 heads.

Posted: Tue Dec 12, 2006 3:25 pm
by dracflamloc
Well that would certainly help but I can't assume EVERYONE is as 1337 as I am ;)