본문 바로가기

시스템 소프트웨어 개발을 위한 Arm 아키텍처의 구조와 원리/4장: 어셈블리 명령어

[ARM] 'yield' 명령어

* yield는 nop와 같은 명령어로써, SMP 시스템의 ARM 버스가 yield이 실행된 CPU 코어에 낮은 우선 순위를 부여하도록 한다. 
yield는 프로세스가 특별히 할 일이 없을 때 실행된다.
 
ARM 문서 내용
 
A similar use might be in modifying the arbitration priority of the snoop bus in a multiprocessor (MP) system. Defining such an instruction permits binary
compatibility between SMT and SMP systems.
 
 
출처: DDI0406C_arm_architecture_reference_manual.pdf 
 
YIELD
YIELD is a hint instruction. Software with a multithreading capability can use a YIELD instruction to indicate to the
hardware that it is performing a task, for example a spin-lock, that could be swapped out to improve overall system
performance. Hardware can use this hint to suspend and resume multiple software threads if it supports the
capability.
For more information about the recommended use of this instruction see The Yield instruction on page A4-176.
 
 
A4.8.1 The Yield instruction
In a Symmetric Multi-Threading (SMT) design, a thread can use the YIELD instruction to give a hint to the processor
that it is running on. The YIELD hint indicates that whatever the thread is currently doing is of low importance, and
so could yield. For example, the thread might be sitting in a spin-lock. A similar use might be in modifying the
arbitration priority of the snoop bus in a multiprocessor (MP) system. Defining such an instruction permits binary
compatibility between SMT and SMP systems.
 
ARMv7 defines a YIELD instruction as a specific NOP (No Operation) hint instruction.
The YIELD instruction has no effect in a single-threaded system, but developers of such systems can use the
instruction to flag its intended use on migration to a multiprocessor or multithreading system. Operating systems
can use YIELD in places where a yield hint is wanted, knowing that it will be treated as a NOP if there is no
implementation benefit.