skaller <skaller@users.sourceforge.net> writes:
> On Tue, 2007-09-18 at 00:37 +0200, Zheng Li wrote:
>> For immutable value, it's not different from the traditional threads, at least
>> from the library users' point of view: if a variable is already inside the
>> scope of a threads (i.e. it's global and created before launching the thread),
>> there is no necessity to message passing it; if not, you should anyway do it
>> explicitly even with the traditional threads.
>
> Yes, however such a value can't be shared by parallel control paths
> (in ocaml) because the collector won't allow it. Of course
> you can *copy* it eg with fork() and run separate collectors.
Given that the copy-on-write strategy is widely adopted in the *nix family, I
hope it's not a big problem.
> Then the functional value is the same, but the object identity
> (machine address) may differ.
Yes. For immutable value, physical equivalence is not preserved across
*multiple* rounds of message passing. This is another slight semantic
difference I should document on the pitfall page. As mutable value, if shared
through STM, their inter-references are actually preserved.
--
Zheng Li
http://www.pps.jussieu.fr/~li