Execute the program using one processor

kuku_12

Honorable
Sep 21, 2012
1
0
10,510
Hello,
I'm new learner of c++ and I was asked to write a c++ program which prints numbers from 1 to 100 using one processor and using more than one processors. For multiple processors it's ok but to force it using only one it is hard, any help
 

randomizer

Distinguished
Surely your teacher didn't mean that you need to physically restrict the process to run on a single core? I know that some teachers hand out lots of assignments with little practical value, but that would be an utterly ridiculous requirement. Every modern operating system will, at its own discretion, balance the load across multiple cores. However, you will still be running a single thread unless you explicitly create more.

I'd be surprised if you could even notice the load being shared given that your program will run for all of 1 millisecond.



Or your worst nightmare. Hooray for badly-built legacy software.