[erlang-questions] multi-threaded woes

Vlad Dumitrescu <>
Mon Sep 18 14:16:55 CEST 2006


On 9/18/06, Bob Cowdery <> wrote:
> Sorry if this is a bit long and more information than you needed to know but I wnated to explain why I am doing what I am doing.

No problem :-)

I don't have time right now to dig deeper, but the first impression is
that you should implement your middle-tier in Erlang, as it is there
you have paralellism and can harness the Erlang programming model.

> The UI then as far as I can see needs to be a C node and have separate client and server threads.

Yes, but those are only for handling the communications, right? And
each client talks only with the middle tier, right?

> The state machine is debatable but I really wanted to get it working as is as it will probably have some major re-engineering later.

So you have a working app, right?

If that is the case, the you should have the multithreading working
already. I think the simple way to implement a C-only proof of concept
is to go with regular sockets and Erlang-encoding of messages. C nodes
are really "handicapped" node, they lack a lot of the features of
Erlang nodes. Ei is just a communication layer, who lets a C program
masquerade as an Erlang node, but that's it.

If not, I think that it might be faster and easier to just do it in
Erlang from the start. You will have no advantage from implementing it
first in C.

the C implementation would possibly be an illustration of a paraphrase
of the classic Lisp quote: "any sufficiently advanced multithreaded
application contains a buggy implementation of an Erlang runtime"  :-)

Or maybe I misunderstood something ;-)
best regards,

More information about the erlang-questions mailing list