Jon Harrop wrote:
>On Tuesday 08 January 2008 20:00:00 Brian Hurt wrote:
>
>
>>Actually, something that might be nice to see, now that the flat page
>>table has been replaced with a heap that can handle disjoint heap
>>spaces, is to allow multiple different Ocaml runtimes to be running in
>>seperate threads in the same process.
>>The heaps wouldn't be able to see each other, but they'd be able to
>>communicate via light weight (and strongly typed) message passing, and
>>you wouldn't have to dink around with sockets, pipes, MPI, or simiar
>>"heavy weight" solutions, so it'd be simpler, and possibly faster. This
>>is not unlike the Erlang model, in fact.
>>
>>
>
>This is exactly the kind of thing I'm interested in!
>
>
>
I take this back- I've just figured out it wouldn't work. Global
variables would be seen as the same in both threads. Basically, if you had
let foo = ref [ 1; 2; 3 ];;
then the memory location foo would be seen by code in both runtimes, but
the actual list elements would be in one thread and not the other. Worse
yet, it's mutable data, so now you've got the possibility of a list
going back and force between threads. Mass pandemonium breaks out.
This is a bad idea.
Brian