2 ms·
> I don't see the difference between spawning a thread for each connection in other languages and spawning a process for each connection in Erlang, That is a h
by rdtsc 11y ago
> I don't see the difference between spawning a thread for each connection in other languages and spawning a process for each connection in Erlang,
That is a huge difference. Otherwise by now, why would Erlang not just run pthread calls and just spawn a thread. Why bother doing all that work?
The reason is because Erlang processes do not share heap memory. That is one of the most important features of Erlang runtime. A crashing process can just crash on its own without leaving all the other 1999999 processes in an undetermined state.
- true_religion 11y agoIt also simplifies garbage collection. Rather than having to stop the world for garbage collection, it happens on a per-process basis. Additionally, if a process terminates before a garbage collection cycle is run the VM just reclaims all of its memory without any additional computation needed.