OO vs. CO

Matthias Lang <>
Wed Mar 12 11:16:42 CET 2003

Jay Nelson writes:

 > entities.  erlang would make a great simulation language (even
 > to the level of doing something like a microprocessor emulator)
 > because you can model the time delays, feedback loops and
 > other interactions besides just the instances.

In simulation, Erlang's concurrency is a double-edged sword.

If you model each real-world concurrent item as an Erlang process and
simulate delays by letting processes sleep, Erlang takes care of
scheduling and everything looks clean and simple. 

The downside is that the simulator's execution time gets included in
the simulation. Sometimes that is desirable, often it isn't---having
the two runs of the same simulation return different results can be an
unpleasant "a-ha" experience. And if you scale time to get the
simulation to run faster than real-time you increase the relative
effect of the simulator's execution time.

It is possible to take measures to avoid this at the expense of simplicity.


More information about the erlang-questions mailing list