Jump to content


coding for dual core


7 replies to this topic

#1 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2335 posts

Posted 16 August 2007 - 08:36 AM

Ive got a new computer, its a dual core, does that mean it has
2 cpu's?
Do you need threads to take advantage of any more speed it has?

#2 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 697 posts

Posted 16 August 2007 - 09:04 AM

http://en.wikipedia....wiki/Multi-core

#3 dave_

    Senior Member

  • Members
  • PipPipPipPip
  • 584 posts

Posted 16 August 2007 - 09:05 AM

Yes and yes. But generally its not as simple as just adding threads, you need to be able to give those threads independent work to do.

#4 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1225 posts

Posted 16 August 2007 - 09:09 AM

rouncer said:

Ive got a new computer, its a dual core, does that mean it has 2 cpu's?
Yes, It has two CPU cores in one chip package.

Quote

Do you need threads to take advantage of any more speed it has?
Indeed, two threads can execute simultaneously. So without mulitple threads you're not taking advantage of its extra capacity (but other applications can still run in parallel).

Note also that it doesn't stop with dual-core. Quad-core recently got affordable and there are already plans for octa-core...

#5 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2335 posts

Posted 16 August 2007 - 10:39 AM

ok, thanks now i know for sure.

could someone give me a loose example of how (if its possible) you would
split work up to create a single octree to say insert a bunch of voxels
in.

#6 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1225 posts

Posted 16 August 2007 - 10:51 AM

rouncer said:

could someone give me a loose example of how (if its possible) you would split work up to create a single octree to say insert a bunch of voxels
in.
Split the scene into two halves (attempt to make them equal in size), and build an octree for each half on each of the cores. When they're both done you can attach the two half octrees into one.

#7 rouncer

    Senior Member

  • Members
  • PipPipPipPip
  • 2335 posts

Posted 17 August 2007 - 07:21 AM

Ah right thanks, i see, one more thing...
do threads automatically assign themselves a cpu or do you
have to declare what processor to use when you make the thread.

#8 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1225 posts

Posted 17 August 2007 - 07:49 AM

rouncer said:

do threads automatically assign themselves a cpu or do you
have to declare what processor to use when you make the thread.
It's the operating system's task to assign a thread to a CPU/core.

But you can control this to a large extent. In Windows, you can use SetThreadAffinity to restrict threads to certain CPU's/cores. Normally you shouldn't mess with this though. The OS generally knows best how to manage threads.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users