Parallelism and Threads
With the advent of multi-core CPUs with potentially hundreds or thousands of cores introduced over the next 10 years, I don't feel we currently have the software technology to take advantage of this hardware.
Whilst the Java thread model is quite reasonable for simple multi-threaded designs, it is impossible (or difficult) to use it for detailed processes where multi-core/multi-SPE processors could provide benefits. Such examples are divide and conquer algorithms or highly parallel graphics algorithms.
For example, we could have a "fork" loop which spawns a thread for each instance of the loop variables (int this case i=0..numPixels) if the contents of the loop are known to be mutually exclusive. Load-balancing and end-of-loop joining would be automatically performed.
fork(int i=0;i<numPixels;i++)
{
drawPixel(i);
}
We seriously require language extensions along the lines of "Clik" (or JCilk) and possibly more.
The question is... when is this going to happen?!!!>
[1038 byte] By [
chris0a] at [2007-10-2 16:50:30]

I should note - the suggested "fork" loop (or similar) would transparently take advantage of available cores so if, for example, you had 16 cores then only 16 instances of the internal code would be executed at one time. This is difficult to emulate in the current Thread model.
> I should note - the suggested "fork" loop (or
> similar) would transparently take advantage of
> available cores so if, for example, you had 16 cores
> then only 16 instances of the internal code would be
> executed at one time. This is difficult to emulate in
> the current Thread model.
Now that you mention this, I think it has merit but I doubt that it will be part of the Java language syntax. Perhaps one of the contenders for a 'next generation' langauge might benefit from some sort of syntax based thread handling.
But for Java, a class could be written (if it is not already) that implements functional-style methods with the kind of functionality you are proposing.
Yours? Amazing?
Have you ever seen a "fork loop" before? - "fork", yes - but not the amazing "fork loop"! Anyway, it doesn't matter...!
Thanks for pointing out Nice and Scala. I had a quick look at Nice and it looks like a vast improvement over Java - I think I'll have a play around with it. I was quite surprised, it even includes "Optional types" which I suggested should be added to Java in my other thread Syntax of new and null and with virtually the same syntax - nice.
Cheers.
> Yours? Amazing?
> Have you ever seen a "fork loop" before? - "fork",
> yes - but not the amazing "fork loop"! Anyway, it
> doesn't matter...!
I thought you said it came from that research paper. In any event it's a clever name but not terribly intuitive. I like it though.