shared memory in Erlang
Wed Jan 31 10:21:28 CET 2001
> I do not really understand how database applications or network
> applications can be implemented in Erlang efficiently without some kind
> of form of shared memory. Only providing message passing does not seem
> to be a good choice for these kind of applications.
Logically, the Erlang processes have private memories. In the
implementation, there is some room to wiggle.
In the Erlang/OTP implementation, all processes (in a single node)
reside in the same address space (e.g., the same OS process). Some
structures, such as binaries and ets-tables, are on the other hand
normally shared by all processes. The Erlang emulator, compiler and
runtime system ensure that everything is done properly (no wild
writing to shared data, etc).
But Erlang/OTP is just one data point. Another data point: it is
possible to implement Erlang so that _no_ data are private (all
processes share data arbitrarily); Robert Virding wrote such an
implementation. The great problem then is memory management, which
ended up costly in that implementation, but that might be solvable.
(Erlang/OTP does not support sharing memory between nodes, however.
At least as far as I know :-)
Finally, what is your measure of efficiency? Our experience with a
highly scalable mail frontend is that Erlang is _very_ good at
handling large numbers of latency-insensitive concurrent sessions.
On the other hand, latency-critical stuff (like, say, packet switching
or digital signal processing) is probably better done in hardware, or
perhaps assembly/C. In that case, use Erlang's concept of linked-in
drivers to interface with this code.
Thomas Lindgren thomas+junk@REDACTED
More information about the erlang-questions