3 ms·
native code can tell the schedulers how many reductions to take, but the schedulers are actually cooperative and not literally preemptive, so poorly written nat
by felixgallo 11y ago
native code can tell the schedulers how many reductions to take, but the schedulers are actually cooperative and not literally preemptive, so poorly written native code can lie, crash, consume a scheduler, etc.
- cpeterso 11y agoBy native code, I meant Erlang bytecode compiled using HiPE or an LLVM-based JIT like [1], not Erlang calling out to NIFs. I assume the generated code would need to insert preemption checks. [1] http://www.erlang-factory.com/upload/presentations/516/SF-JIT-Pres.pdf http://www.erlang-factory.com/upload/presentations/516/SF-JI...
- felixgallo 11y agoI believe the JIT work was experimental. Functions compiled with HiPE are still subject to the reduction laws and calling into a HiPE function still provides a preemption opportunity, so HiPE native functions are essentially indistinguishable from erlang functions.
- cpeterso 11y agoInteresting. Thanks!