Reputation: 89
I am so confused about multi-thread networking. Since a Socket is an OS Level structure, handling sockets at Erlang BEAM VM level has an equivalent at OS Level, and there are multi options to handle parallel connections by OS-Threads (select, poll, epoll,....) and that depends of the OS but what i can't understand and I searched a lot about without any answer is: If we have 4 Parallel Erlang processes listen to accept connection on one Socket, what is the equivalent at OS Level? 4 waiting Parallel OS-Threads? N Parallel OS-Thread?
Upvotes: 2
Views: 182
Reputation: 23701
It's a difficult correspondence to draw. Your suggestion 4 Parallel threads is probably the closest equivalent. Things get a bit harder to pin down because a kernel thread will likely take up more system resources than each process. Threads typically share memory space while there is memory protection between processes. So it depends on how far you want to take the simile, but basically there will be 4 separate lines of processing blocked on I/O.
Upvotes: 1