"Mathieu Bouchard" <matju / sympatico.ca> wrote in message news:Pine.LNX.3.96.1010523180630.8147D-100000 / relayer... > > On Mon, 21 May 2001, Patrick Logan wrote: > > Would that Ruby borrowed Communicating Sequential Processes > > from Erlang. http://www.erlang.org > > I don't know about you, but I don't want to be programming with > > monitors and shared variables anymore. Java chose Hoare's monitor > > mechanism even though Hoare himself abandoned them for CSPs in > > the late 1970s. > > I don't know much about Erlang but wouldn't it be much like each "thread" > gets its event-loop, and each event-loop object doubles as a mailbox that > receives data from other "threads", and let that be the sole method of > communication between threads? More or less. Yes, each "process" in Erlang is "shared nothing" with other processes. That allows location transparency... a process may be remote from the node of the sender. Each process can wait for a message at any point in its sequential flow of control, so there may be nested requests to receive messages, etc. Another feature is the use of pattern matching to indicate which messages to receive in which order. > If "threads" are further isolated by deep-copying everything that passes > through the mailboxes, then it becomes only one step away from processes > at the OS-level: the decision between threads and processes becomes almost > aesthetics (or performance tuning). Yes, location is performance tuning. And as I wrote above, it goes beyond a single node. The CSP mechanism in general is a simplification, and surprisingly effective and expressive. Erlang is used in essentially real time telecommunications products with dynamic loading and upgrading of code. -- Patrick Logan mailto:patrickdlogan / home.com