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]
# 1
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.
chris0a at 2007-7-13 18:02:06 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 2

> 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.

dubwaia at 2007-7-13 18:02:06 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 3
It could be written, but not in one line, like my amazing "fork" loop!I feel we need a next generation language soon...
chris0a at 2007-7-13 18:02:06 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 4
Although I should point out that this has already been (unofficially) implemented in the "JCilk" project which could possibly merit a merge into the official Java implementation.
chris0a at 2007-7-13 18:02:06 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 5
> It could be written, but not in one line, like my> amazing "fork" loop!Yours? Amazing?> I feel we need a next generation language soon...There are Java based next-gen languages now/ See nice and scala.
dubwaia at 2007-7-13 18:02:06 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 6
Currently, these constructs are where they belong: research languages. There's still a long way to go before things like this should be put into a... uh what would you call it?... err, "pragmatically practical" (just made that up) language like Java.
RadcliffePikea at 2007-7-13 18:02:06 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 7
Yeah, that would be like making COBOL object-oriented. Well, okay, they did do that but it took them 40 years to get there.
DrClapa at 2007-7-13 18:02:06 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 8

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.

chris0a at 2007-7-13 18:02:06 > top of Java-index,Other Topics,Java Community Process (JCP) Program...
# 9

> 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.

dubwaia at 2007-7-13 18:02:06 > top of Java-index,Other Topics,Java Community Process (JCP) Program...