multithreading - c++ thread for quadcore -


can tell me how can set thread run of core of cpu? make thread with: createthread(0, 0, thread, (lpvoid)1, 0, 0); run @ 25% speed of cpu, because takes 1 core calculates. how can set use 4 full speed?

a thread run on single core @ 1 time, though may switched between cores os. have application take advantage of more 1 core need more 1 thread.

you can use createthread start these threads, or wrapper around such boost::thread, or new c++11 std::thread. if have 4 threads (including first one) app can run on 4 cores @ once.

however, adding threads application not lightly. multithreading complex topic, , can hard right. there many more difficulties may encounter , sources of bugs in multithreaded applications in single-threaded ones. consequently, there many articles , books (including mine) on topic of multithreaded programming.

take slow, read extensively multithreaded programming, , @ whether best approach application, , how best make use of cores.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -