5

How is the receive message implemented internally in erlang runtime?

When the process is waiting for a message, the execution hang on the receive. The receive is done via blocking IO, or asynchronous IO ?

If former, then it means the OS thread is blocked and if there are many process hang on receiving, the performance is bad in reason of thread context switch and also may reach the operation system's thread limitation.

Mr.Wang from Next Door
  • 13,670
  • 12
  • 64
  • 97

1 Answers1

5

Erlang processes are not corresponded to OS threads or processes. They are implemented as internal structures of Erlang VM and they are scheduled by Erlang VM. The number of OS threads which are started by Erlang VM by default is equal to CPU number. When the Erlang process is waiting for a message no one OS process or thread is blocked.

Danil Onishchenko
  • 2,030
  • 11
  • 19