I’m having a hard time understanding how could I integrate processes in my application. I’ve done the Elixir Guide and I hope someone can help me understand this:
Can I have a process that spawns other processes for him to do his work? This “master” process sends two values a, b and an atom :add to some process, that process makes the sum and sends it back to the “master” process? I’m looking at all sorts of tutorials but can’t find any example in this matter.
Sure, you could do that. Now, whether or not there is any actual advantage to doing that depends on other factors: do you have 2 or more cores such that a & b can actually run simultaneously, or do a or b or both reach a point where they are waiting on I/O such that the other one can run in the gap?
Elixir processes make it very easy (and practical) to spawn multiple processes to take advantage of those kinds of situations, so easy that you can do so when there might be a chance but you’re not sure that such a situation occurs. Elixir (Erlang, really) make it easy to deal with a HUGE number of different processes in those types of situations,