Jump to content
  • Advertisement
Sign in to follow this  
theScore

question about a multithreaded program

This topic is 3720 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have two programs : -the first for which the threads are executed on one processor -the second for which the threads are executed on 4 processor the threads are all the same, a long but simple calculation. The question is why both programs run in 20 seconds because one optimized for a quad core ? [Edited by - theScore on July 14, 2008 9:58:52 AM]

Share this post


Link to post
Share on other sites
Advertisement
It's not necessary to manually bind threads to cores to take advantage of cores (in fact, it's even considered bad). When run on a quad core machine, windows will dispatch all threads to the available core so that's why both programs run in about the same time.

Share this post


Link to post
Share on other sites
What you want to try to see the difference is: (pseudocode)


// multithreaded version
ProfileStart();
BeginThread(func1);
BeginThread(func2);
BeginThread(func3);
func4(); // Or: BeginThread(func4);

WaitUntilDone();
ProfileEnd();

//single threaded version
ProfileStart();

func1();
func2();
func3();
func4();

ProfileEnd();

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!