1

I am studying an erlang based system, and trying to analyze the sequence of events that take place in the system. Is there a way to force erlang run-time or the elang vm to create a new kernel thread, each time "spawn" is called. This would make the system slower, but it would make the study a lot easier. I have tried the +S flag, and enabled smp already, but I suspect the system is still mapping multiple processes to one kernel thread, or erlang scheduler. Are there any inputs/configuration parameters I am missing?

4

1 回答 1

5

不,这不是 Erlang VM 的工作方式。BEAM 为每个核心生成线程并在那里运行调度程序。每个 Erlang 进程都可以在任何调度程序上运行,甚至可以从调度程序迁移到调度程序,从而使它们从一个线程迁移到另一个线程。默认情况下,这些调度程序甚至没有绑定到 CPU 内核,因此它们可以从内核迁移到内核。-sbt您可以使用switch绑定它们。您还可以将 Erlang 进程绑定到未记录且强烈不推荐的特定调度程序。您不能从 Erlang 生成线程,而是从 NIF 或端口生成线程,但是无论如何您都无法在该线程上运行 Erlang 进程。

于 2016-11-20T22:18:31.250 回答