Introducing Axum – a new programming language for parallel development

[Warning – this is shamelessly taken from the documentation but I felt it deserved a wider viewing]

Yesterday I delivered a session on the new parallel capabilities of .NET 4.0 (see slides and links). I also managed to slip in a little section at the end on Axum and Concurrent Basic. These two programming languages are nothing to do with .NET 4.0 but are very interesting if you care about what the future beyond .NET 4.0 might bring for parallel development on Windows.

Axum is available for download today. It moves away from object orientation (there are no public methods or fields) and instead uses message passing on channels between agents as the fundamental idioms of the language.

For example, to implement a solution which adds numbers you could use the following pattern:

image_thumb[2]

The following is the code contained within a single file, separated out for clarity.

First the using statements. NB: Axum can access standard .NET classes and methods such as Console.WriteLine.

    1:  using System; 
    2:  using System.Concurrency; 
    3:  using Microsoft.Axum; 

Next, the implementation of the channel (Adder at line 1) and the agent (AdderAgent at line 8). The AdderAgent waits for two values to appear on the channel (Num1 and Num2 at line 12) and then returns the total on the same channel (as Sum at line 14):

    1:  channel Adder 
    2:  { 
    3:      input int Num1; 
    4:      input int Num2; 
    5:      output int Sum; 
    6:  } 
    7:   
    8:  agent AdderAgent : channel Adder 
    9:  { 
   10:      public AdderAgent() 
   11:      { 
   12:          int result = receive(PrimaryChannel::Num1) + 
   13:              receive(PrimaryChannel::Num2); 
   14:          PrimaryChannel::Sum <-- result; 
   15:      } 
   16:  } 

The consumer of AdderAgent creates an instance (line 5) and sends the values to be added to the channel as messages (lines 6 and 7) and then later checks for the answer (line 9). End result is the MainAgent can continue to run in parallel with the work of AdderAgent:

    1:  agent MainAgent : channel Microsoft.Axum.Application 
    2:  { 
    3:      public MainAgent() 
    4:      { 
    5:          var adder = AdderAgent.CreateInNewDomain(); 
    6:          adder::Num1 <-- 10; 
    7:          adder::Num2 <-- 20; 
    8:          // do something useful ... 
    9:          var sum = receive(adder::Sum); 
   10:   
   11:          Console.WriteLine(sum); 
   12:   
   13:          PrimaryChannel::ExitCode <-- 0; 
   14:      } 
   15:  }

There are lots more examples in the documentation (PDF to download)  but hopefully the above was enough to get you interested. Enjoy!