Skip to main content
gamedev.net
🔒 Locked

question about a multithreaded program

Started by theScore 2 replies 600+ views
Original Post
theScore
theScore
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]
janta
janta
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.
theScore
theScore
ok thanks !
janta
janta
What you want to try to see the difference is: (pseudocode)

// multithreaded versionProfileStart();BeginThread(func1);BeginThread(func2);BeginThread(func3);func4(); // Or: BeginThread(func4);WaitUntilDone();ProfileEnd();//single threaded versionProfileStart();func1();func2();func3();func4();ProfileEnd();

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.