[erlang-questions] Erlang beginner questions

H. Diedrich hd2010@REDACTED
Wed Apr 13 20:36:47 CEST 2011


Hi James,

"Let it crash" is the Erlang way of doing things, but it does NOT mean, 
let the VM crash, but Erlang processes.

The VM is the saint cow in this context that absolutely must not crash.
> Are you saying that a
> linked-in driver is stable as long as there are no bugs in the native
> library, ie if the native library has been tested, then it should be fine
> and run with no issues?
You mean library = driver I guess. Yes, when it is as stable as Erlang 
proper.
>   Or, if say my physics library gets a billion things
> all at once and decides to implode, so it crashes - does the whole computer
> running this process crash as well?
No but the Erlang VM, if it's linked-in. Which is something you could 
otherwise almost completely rely upon to keep running and keep 
restarting and redoing whatever the uncompleted tasks had been when an 
Erlang-process crashed (which, again, is a different level of crashing).
> Is there a better way to keep latency extremely low, sending and receiving
> millions of variables on the same machine many times per second?
It is. Not quite as fast as a function call but close.
>   I'm
> thinking of it like a box - the Physics box gets the current state &
> velocities, figures out the new state, and returns the state back to Erlang,
> which then takes things from there and delivers them to the appropriate
> parties.
>
> I understand and will be implementing things in Erlang at the start for
> testing purposes, however I want to make my physics system modular and use a
> library that can be installed both on the server and on the client, so what
> is ultimately used for the various math-intensive things will need to be
> written in a language like C++.  I've been planing on using Box2d and
> Bullet, which can both be implemented on iOS, Android, Mac & PC, as well as
> server-side.  Am I approaching this correctly?
>   
You have to figure out how many calls / messages are needed.

But in general it sounds very much like what you want is NOT a linked-in 
driver but a port to a separate Erlang VM, that resides on the same 
machine.

I think this is an example of how you'd want to do it:

http://gitorious.org/erlua/erlua/blobs/2fa39a954df8a6a5d7318dac7dc5728a830dab77/README

Just you wouldn't embed Lua but your physics.

Best,
Henning



More information about the erlang-questions mailing list