yield 用のシステムコールを呼び出すだけ.
ただし, ConvertYieldToSleep オプションが指定されている場合は, sleep 用のシステムコールを用いる. また, yield 用のシステムコールが使えない場合も sleep 用のシステムコールを用いる.
JVM_Yield() (= java.lang.Thread.yield())
-> ConvertYieldToSleep オプションの値に応じて, 2通りに分岐
* ConvertYieldToSleep オプションが指定されている場合:
-> os::sleep() (<= 引数の interruptible は false)
-> OS によって処理が異なる.
* Linux の場合
-> ParkEvent::park()
* Solaris の場合
以下のどちらかを呼び出す
-> thr_yield() (<= 指定されたスリープ時間が 0 以下の場合)
-> os_sleep() (<= それ以外の場合)
* Windows の場合
-> Sleep()
* ConvertYieldToSleep オプションが指定されていない場合:
-> os::yield()
-> OS によって処理が異なる.
* Linux の場合
-> sched_yield() (<= スレッドが SCHED_OTHER なんだが, この場合も sched_yield() でいいんだっけ?? 要確認 #TODO)
* Solaris の場合
-> os::sleep() (<= 引数の interruptible は false)
-> (上述)
* Windows の場合
-> os::NakedYield()
以下のどちらかを呼び出す.
-> SwitchToThread()
-> Sleep()
See: here for details
java.lang.Thread.yield() は JVM_Yield() で実装されている.
((cite: jdk/src/share/native/java/lang/Thread.c))
static JNINativeMethod methods[] = {
...
{"yield", "()V", (void *)&JVM_Yield},
See: here for details
See: here for details
See: here for details
(#Under Construction) See: here for details
See: here for details
(#Under Construction) See: here for details
See: here for details
See: here for details
See: here for details
(#Under Construction) See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.