tc39 / proposal-atomics-microwait

Micro waits in JS
http://tc39.es/proposal-atomics-microwait/
Other
47 stars 1 forks source link

Would it make sense to spec both CPU yield and an OS yield? #6

Open juj opened 7 months ago

juj commented 7 months ago

In an earlier conversation it was highlighted that the Atomics.microWait() primitive is a CPU level yield/pause instruction, not a OS-level "schedule out the remaining time slice of the thread" level instruction.

That gave a thought to discuss: would it be useful to incorporate both of these types of instructions into the spec?

I am not completely sure what the modern tuning tradeoffs and scenarios typically are with each, though with a search through Unity's several millions of lines codebase with the hierarchy of all the various third party projects as dependencies, I do see both types of yields being used in native code. (and I presume these have been tuned by various platform experts on desktop/Android/iOS over decades of development)