c++ - Program not using all of CPU? -


this question has answer here:

i wrote simple program in c++ like:

while(1){var+=1;var-=1;}  

and ran it, seems use 25% of cpu.

how can increase amount of cpu program use, 95%?

sounds you're running on 4-processor system. are using 100% of cpu on 1 core. use other cores, have write multi-thread version of application.

multi-threading complicated, there lots of tutorials out there; hit google. luck!


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -