[erlang-questions] Re: Shared/Hybrid Heap
Morten Krogh
mk@REDACTED
Thu Oct 14 08:56:05 CEST 2010
On 10/14/10 3:21 AM, Richard O'Keefe wrote:
> On 13/10/2010, at 11:24 PM, Morten Krogh wrote:
>
>> I don't think it is possible to have the virtual machine solve this correctly in all cases. Only the programmer knows the future use of the data, except for very small programs, maybe.
>>
>> So this leads to the following proposal.
>>
>> Erlang processes should have internal threads.
>>
>> The programmer decides between spawning a process or a thread. Processes share almost nothing, threads almost everything.
>>
>>
>> I am not saying Erlang should go that way, but it seems to be the solution to this issue.
> There is a tacit assumption here that if thread T1 has data structures D1 and D2
> and it wants to share data structure D1 with thread T2, it wants to share D2 as
> well. This is not obviously the case.
>
>
Not as I see it. T2 doesn't need to even know about D2.
The program goes like
T1 is working with D1 and D2
...
_T2 = spawn_thread(init_function_t2, [D1]),
...
now T1 and T2 are executing in parallel. T2 doesn't even know D2.
Morten.
More information about the erlang-questions
mailing list