Dummy operations handling of Intel processor

前端 未结 3 1476
庸人自扰
庸人自扰 2021-01-14 23:56

Admittedly, I have a bit silly question. Basically, I am wondering if there are some special mechanisms provided by Intel processors to efficiently execute a series of dummy

3条回答
  •  攒了一身酷
    2021-01-15 00:23

    Discarding them would be pretty bad idea: they are often used for busy-waiting. If you discard NOPs, you make your wait-loop much tighter than it should be and potentially introduce considerable communications overhead.

    If you feel that NOPs are inefficient, you could try HLT which saves some energy. Or you could even send the CPU into a sleep state. However, these only make sense if you want to "do nothing" for a considerable amount of time and they usually require suvervisor privileges.

提交回复
热议问题