Simulation with Erlang
David W. Bauer Jr.
Wed Dec 13 01:03:12 CET 2000
You may want to try a scheme where each process receives messages in
timestamp order.. this would at least insure in order processing of
incoming messages from other processes. Something like a
timestamp-priority relationship on messages. How synchronized must the
~~~ ~~ ~~~~ _o
URL: http://www.david-bauer.com ~~~ ~~~~ ~~ _'|<,_
~~~~ ~~~ ~~~~ (*)/ (*)
On Tue, 12 Dec 2000, Vlad Dumitrescu wrote:
#It feels like it should be Friday, but the week is till young *sigh*
#As some of you might remember, I am considering to use Erlang in a robotics
#application. Since the hardware is way too expensive (unless I find a
#good-hearted sponsor!) I thought I'd try to simulate it with a program. So
#far so good.
#The problem I stumbled upon is how to handle simulation time. My thought was
#to have processes run free, and a supervisor one (the "world") to check on
#them and collisions and such. But that is a completely different paradigm
#than the one I used before (the "objects" are run in the "world" thread,
#under it's control) and I can't make it work.
#More precisely, the Erlang multitasking strategy gives no control over when
#to yield execution. An Erlang "timeslice" might include very different
#lengths of "simulation time".
#A solution I came up with is to have the world doing the synchronization by
#sending "tick" messages to each object. But that gives a lot of traffic! And
#it's not elegant at all.
#Can anyone give me some hints of whether it is possible to synchronize
#everything in a clean way, and if yes, how? Or at least some pointers for
#where to look further.
#thanks in advance,
#Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com
More information about the erlang-questions