2 ms·
Robert Virding has a great talk on BEAM (the Erlang VM). He talks specifically about how BEAM handles concurrency. I think it would answer a lot of your questio
by perishabledave 11y ago
Robert Virding has a great talk on BEAM (the Erlang VM). He talks specifically about how BEAM handles concurrency. I think it would answer a lot of your questions.
A few of his points that would directly apply to your question:
1. BEAM processes are lightweight which means smaller memory footprint and cheaper context switching between processes.
2. As others have mentioned, garbage collection. Processes don't share memory, so data passed between processes are copied. Virding says that this is a tradeoff, but worth the benefits of keeping garbage collection simple and fast.
3. Since processes are VM processes and not OS processes, BEAM can count the number of function calls each process makes. If a process is long running and starving other processes, BEAM can put that process back on the run queue to give other processes necessary time.
These are the ones I can remember from off the top of my head. I recommend giving the talk a listen.
https://www.youtube.com/watch?v=_Pwlvy3zz9M&feature=youtu.be https://www.youtube.com/watch?v=_Pwlvy3zz9M&feature=youtu.be
- ssmoot 11y agoAkka doesn't spawn additional OS processes. It's thread based. (ForkJoinPool? Though maybe that's changed.)
- perishabledave 11y agoAh yea sorry, wasn't implying that it was only stating what BEAM did. I think Akka uses a thread pool so you'd be right.