On Apr 11, 2005, at 7:56 AM, Glenn Parker wrote:

> flaig / sanctacaris.net wrote:
>
>> Apart from explicitly creating threads, it would be nice if
>> the Ruby system could be taught to automatically recognize
>> parallelizable code and optimally distribute it across a
>> multiprocessor system -- implicitly. That would be a big
>> advange for high-level programming in general! I do not know
>> the state of the art in this, I only remember that the
>> Atari/Inmos guys failed do do this in Occam, back in the 1980s.
>> Do you think there is a serious chance to get such a thing working?
>
> The only programming environment I'm familiar with where somebody 
> implemented automatic parallel optimization is Fortran (although I'm 
> sure there are others).  Fortran's branching and memory models are 
> constrained enough to allow for some clever analysis.  Loops where 
> each iteration has no impact on the next can be discovered and 
> converted into short-term fine-grained parallel execution.  In that 
> case, the original code has no concept of threading, it just runs 
> faster during the inner loops.
>
> None of that would carry over to a thread-aware language with a 
> dynamic type system.

For OO languages running on top of a Virtual Machine, Object semantics 
may give rise to automatic parallel optimization.

You could deploy an application with certain objects declared 
"immutable."  (Like it's base & application Classes.)  Then you could 
divide the image into independent partitions where the objects in each 
partition have nothing to do with each other except through these 
immutable objects.  If you can enforce that no one writes into a 
partition from outside of it (including the immutables), then you can 
safely give each one its own thread.  Something akin to a GC sweep 
could do this automatically.

--Peter

--
There's neither heaven nor hell, save what we grant ourselves.
There's neither fairness nor justice, save what we grant each other.