The cpu_relax() call can lower CPU power consumption or yield to a hyperthreaded twin processor.
2 Answers
Given the context:
Another situation where one might be tempted to use volatile is when the processor is busy-waiting on the value of a variable. The right way to perform a busy wait is: while (my_variable != what_i_want) cpu_relax(); The cpu_relax() call can lower CPU power consumption or yield to a hyperthreaded twin processor; it also happens to serve as a compiler barrier, so, once again, volatile is unnecessary. Of course, busy- waiting is generally an anti-social act to begin with.
In this context, I think it means that the 'yield to' is referring to the thread of control in a program moving from the current processor to another 'hyperthreaded twin processor', or to allowing another thread to take over the use of the CPU for the time being.
In this context, 'yield' is more a technical term than a simple English term. In a multithreaded processing environment, one thread can 'yield' the processor to other threads when it cannot do anything useful - while waiting for input or for some condition to become true. If the control does transfer to the other processor, the current processor may be able to reduce its power consumption dramatically. In the example code, the processor is waiting for a condition to become true - and is 'busy waiting' (another technical term), but is telling the system that if there is something else that can use the CPU, then it should be allowed to use it.
-
1Got here late after the OP added the context, but this sounds right to me. +1– RobustoNov 27, 2010 at 2:08
Yield means, among other things,
to relinquish possession of (something); to give (something) up
The sentence you cite appears to mean that "a hyperthreaded twin processor can override the cpu_relax() call" and force it to abandon its attempt to "lower CPU power consumption" ...
If there were more context to your quote (i.e., if you were to post the entire paragraph that contains the quote), it might help to be certain that this is indeed what is meant.
-
-
1Another situation where one might be tempted to use volatile is when the processor is busy-waiting on the value of a variable. The right way to perform a busy wait is: while (my_variable != what_i_want) cpu_relax(); The cpu_relax() call can lower CPU power consumption or yield to a hyperthreaded twin processor; it also happens to serve as a compiler barrier, so, once again, volatile is unnecessary. Of course, busy- waiting is generally an anti-social act to begin with.– LiuNov 27, 2010 at 1:45
-
1@Liu: please edit your question to include the extra material - as the asker, you should be able to do that. Nov 27, 2010 at 1:56