I want to do a multi-agent simulation containing about 10.000 agents (machine and product agents) using the Scala Actor framework.
As I understand, if there are lots of actors passing messages around, can it run out of stack due the recursion?
If so, how can I increase the stack sizes for the underlying worker threads?
The actor framework has been designed to handle this – in fact, it can handle this with only one thread, assuming you use the
loop-reactpattern as follows:On pp 590-593 of Programming in Scala this is discussed in more detail: basically the
reactmethod never returns normally (it terminates with an exception) and therefore its call stack does not need to be preserved. You can think of it as looping forever.