Answer the question
In order to leave comments, you need to log in
What is the most time consuming operation on the CPU?
You need to simulate some kind of blocking operation. I think some kind of calculation in the loop would be a good option. Question. What is better to count so that the CPU works longer?
Answer the question
In order to leave comments, you need to log in
Yes, anything, even an empty loop - the main thing is more iterations. And turn off the optimization options, otherwise the compiler can remove the cycle from the executable file.
a|1=a^a=a*a*a*a*a...=a+a+a+a+a...=a++;a++a;++a;a++;...
And then try to calculate 123546789|1
all these mathematical operations in loops are very well optimized by the hardware itself, even if you disable optimization in the compiler.
so the most expensive operation is unpredictable, a conditional branch from random data is great for this, the processor will not be able to accurately predict this conditional branch.
well, blocking operations are emulated simply by slips.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question