1

The cpu_relax() call can lower CPU power consumption or yield to a hyperthreaded twin processor.

2 Answers 2

5

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.

1
  • 1
    Got here late after the OP added the context, but this sounds right to me. +1
    – Robusto
    Nov 27, 2010 at 2:08
3

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.

3
  • The entire paragraph is this:
    – Liu
    Nov 27, 2010 at 1:44
  • 1
    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.
    – Liu
    Nov 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.