[erlang-questions] Question about gen_tcp on multiple cores

Kaiduan Xie <>
Fri Aug 3 19:40:36 CEST 2012


Hi,

We all know in Erlang, writing TCP server is quite easy. For example,
call gen_tcp:accept from multiple Erlang processes, and for each TCP
connection an Erlang process is created to handle the send and receive
packets ...

However I would like to know more details about the underlying C
layer, here I assume kernel_poll is enabled on Linux, and thread means
the C thread instead of Erlang process. How Erlang utilizes multiple
cores for accepting connections/sending/receiving data?

1) How many threads are created for handling the network operation
such as accept, connect, send and receive?

2) Is epoll_wait() called from multiple threads with same epoll set?

I looked the inet_drv.c, unfortunately I can't figure out the answer from there.

Can someone with the knowledge provide the answer, or more clues?

Thanks for help,

/Kaiduan



More information about the erlang-questions mailing list