Sunday, November 1, 2009

Parallelism at the language level - Part 1: Hello World

The major contribution of Ateji Parallel Extensions is to add parallelism at the language level.

What does this change? Today's mainstream programming languages have been designed with sequential processing in mind, they simply have no idea about what is parallelism. Consider how you'd run two tasks in parallel in Java:

  Thread otherThread = new Thread() {
    void run() {
    println("Hello"); // print Hello in the other thread
  println("World"); // print World in this thread
  otherThread.join(); // wait until code1 has terminated

Not to mention how unreadable and unmaintainable this code is, you'll notice that there is a fair amount of black magic involved here: just because you called a method whose name happens to be start(), the whole behaviour of your program has changed. But the compiler is not aware of this change, it thinks it is just calling an ordinary library method.

With Ateji Parallel Extensions, two tasks are run in parallel by composing them using the || operator :

  println("Hello"); || println("World");

How could it be simpler?

Not only is this much more concise and understandable, it also makes it easier for the developer to "think" parallel and to catch potential errors early.

And since the very idea of parallelism is present in the language, the compiler is able to understand the actual meaning of the code and to perform tricks such as high-level code optimization or better verification.

Read more on parallelism at the language level.

1 comment:

Anonymous said...

I found this site using [url=][/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!

Sorry for offtopic