Erlang process 和 系统的 thread 比起来 context switch 哪个更高效?

作者 mike 所属板块 问答
不考虑需要开很多线程的情况,也不考虑内存占用。只考虑调度和上下文切换。 感觉上,Erlang 会更好,但还没找到相关的比较。。。
2 回复
  • hex 发表
    Erlang processes are not OS processes. They are implemented by the Erlang VM using a lightweight cooperative threading model (preemptive at the Erlang level, but under the control of a cooperatively scheduled runtime). This means that it is much cheaper to switch context, because they only switch at known, controlled points and therefore don't have to save the entire CPU state (normal, SSE and FPU registers, address space mapping, etc.).
  • mike 发表
    [@hex](/users/5) 多谢多谢