<br>Why do you want to spawn a new server each time?<br>How many instances can there be?<br><br>It takes only a few microseconds to spawn a process,<br>so if the update frequency is 1/50ms (20/sec), the <br>cost of spawning a process is insignificant.
<br><br>It is also possible to leave one process running for each<br>instance. This used to be quite inefficient from a memory<br>usage perspective, but nowadays, there's the nifty little<br>BIF hibernate(M, F, A), which will compress the process
<br>while it waits for the next message. This is mainly useful if<br>you expect relatively long idle periods for the process.<br><br>BR,<br>Ulf W<br><br><br><div><span class="gmail_quote">2007/5/20, Jason Dusek <<a href="mailto:jsnx@hellokitty.com">
jsnx@hellokitty.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I'm writing a distributed, finite differences heat diffusion
<br>simulation in Erlang. My idea about how to do it goes like this:<br>    a) break the big grid into many little grids<br>    b) assign the grids to individual servers, and connect each<br>       server to those servers with adjacent grids.
<br>    c) for each time step, have the servers evolve their state and<br>       then spawn a new server with the updated data<br>I have sample code which models (c) as updating an int every 50<br>milliseconds -- it's posted on pastie:
<br><br>    <a href="http://pastie.caboo.se/62924">http://pastie.caboo.se/62924</a><br><br>Although (c) is conceptually simple, I'm concerned it may be a source<br>of evil performance problems -- I have to spawn bazillions of servers,
<br>over and over and over again! Is there another way to do it? What are<br>some other approaches to distributed, finite differences computing in<br>Erlang?<br><br>I tried posting this on comp.lang.functional and they steered me
<br>toward shared memory concurrency and mutable state!<br><br>--<br>_jsn<br>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org
</a><br><a href="http://www.erlang.org/mailman/listinfo/erlang-questions">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br>