[erlang-questions] Add a new data structure to erlang VM.
Jesper Louis Andersen
Sat Jul 16 21:18:09 CEST 2016
On Fri, Jul 15, 2016 at 1:12 AM, Robert Virding <rvirding@REDACTED> wrote:
> The data in an ets table and a process dictionary is not mutable!
The memory in C is not mutable!
We can construct a C system by having each memory slot be a process
supporting two operations
get : Loc -> Value
set : Loc -> Value -> unit
Hence, we can implement the C language without ever mutating things.
Rather, we send messages to each memory location. I note that the
asynchronicity of the "set" operation is truer to reality than the usual
assumption: the cache is not immediately updated and requires coordination
/ memory-barriers to be safely updated. In other words, the modeling would
be truer to a real system than the usual implementation where store updates
are assumed to happen at once. Heck, the memory is not even linearizable in
the usual sense.
The other view is that this is a silly idea and of course ETS is a mutable
store. But I don't think so! In reality, what is going on here is that
mutability is all about process communication. And the communication is
effectful, not the storage contents!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions