[erlang-questions] Teaching Erlang as part of a paper -- advice sought

Jim Larson jim@REDACTED
Mon Feb 15 04:01:31 CET 2010


In message <8C0499EA-478E-4995-814C-57B6E189FBD1@REDACTED> you write:
>Here there is a dispute between me and one of the other lecturers
>in the department, who will not be involved in this paper, at least
>not this year.  I want the students to start learning about
>concurrent programming in a language in which data races (at least
>data races not involving external resources) are simply impossible.
>He thinks they should (a) learn what a data race looks like the hard
>way early on and (b) learn not be be afraid of data races, because
>the low level locking code on x86-64 Linux apparently has a benign
>data race.

A data race can certainly be modeled in Erlang, even in a motivated
way, by implementing the equivalent of a mutable cell that responds
to a simple "get" and "set" protocol.  With more sophistication,
one could model subtle properties of multiprocessor cache memory,
e.g. by introducing an "optimization" to the above mutable cell in
a distributed Erlang instance by adding local cache processes.

This could give students a great understanding of concurrency that
will help them even when programming C++ or Java in the future -
the understanding that even simple memory accesses can be complicated,
but their behavior can be understood in terms of distributed events
and messages between them.

Jim


More information about the erlang-questions mailing list