Title: Objectoriented approach to parallel programming on the 'NET platform
1Object-oriented approach toparallel programming
on the .NET platform
- Polyphonic C an extension of the C with new
asynchronous concurrency model - MC a distributed variant of the Polyphonic C
- Examples of programming in MC
- Implementation issues
- Results and problems
2Polyphonic C an extension of the C with new
asynchronous concurrency constructs
- Nick Benton, Luca Cardelli, Cedric Fournet
(Microsoft Research Laboratory, Cambridge) - "Modern Concurrency Abstractions for C" - to
appear in ACM Transactions on Programming
Languages and Systems - http//research.microsoft.com/nick/polyphony
3Some history
- p - calculus ( R. Milner, 1992 )
- Join-calculus ( C. Fournet, G,Gonthier, 1996 )
- Polyphonic C ( N.Benton, L.Cardelli, C.Fournet,
2002 ) - Polyphonic C C
- asynchronous methods chords
C
4Asynchronous model of Polyphonic C
- Asynchronous methods
- async Compute( int n )
- // method body
-
- Chords
- int Get() async c( int x )
- return ( x )
-
5MC a distributed variant of the Polyphonic C
- Movable methods
- movable Compute( int n )
- // method body
-
- Channels
- int Get() Channel c( int x )
- return ( x )
-
6MC a distributed variant of the Polyphonic C
- New modifiers for movable methods
- functional
- non-functional
- global
- Channel types
- movable Compute( int n,
- Channel( int ) c )
- movable Compute( int n,
- Channel( Channel( int ) ) c )
7Examples of programming in MCn - th Fibonacci
number
- class Fib
- public movable Compute( int n, Channel( int ) c
) - if ( n lt 2 ) c( 1 )
- else
- Fib f new Fib()
- Compute( n - 1, f.c1 )
- Compute( n - 2, f.c2 )
- c( f.Get2() )
-
-
- int Get2() Channel c1( int x )
- Channel c2( int y )
- return x y
-
-
8Examples of programming in MCn - th Fibonacci
number
- class ComputeFib
- public static void Main( string args )
- int n System.Convert.ToInt32( args 0 )
- ComputeFib cf new ComputeFib()
- Fib fib new Fib()
- fib.Compute( n, cf.c )
- Console.WriteLine( n "-th Fibonacci number
is - cf.Get() )
-
- public int Get() Channel c( int x )
- return x
-
-
9Examples of programming in MCEratosthenes sieve
- Bi-directional channels
- public class BDChannel
- public BDChannel()
-
- public void Send( params object o )
- public int Receive()
-
10Examples of programming in MCEratosthenes sieve
- movable Sieve( BDChannel cin, BDChannel cout )
- int head (int) cin.Receive()
- if ( head -1 )
- cout.Send( -1 )
- else
- cout.Send( head )
- BDChannel inter new BDChannel()
- Sieve( inter, cout )
- filter( head, cin, inter )
-
11Implementations issues
- MC - implementation Compiler
Runtime-system - Compiler
- translates a program from MC to C
- preparing it for execution under the
Runtime-system - Runtime-system
- ResourceManager
- - distributes movable methods over the nodes
- WorkNode
- - starts and controls execution of movable
methods - Communicator
- - transfers the channel messages to objects
located on given node
12ResultsFibonacci (granule 40)
Configuration All nodes Pentium III 600 MHz x
2, 512 Mb
13ResultsMandelbrot set
Configuration All nodes Pentium III 600 MHz x
2, 512 Mb
14ResultsLife game
Configuration All nodes Pentium III 600 MHz x
2, 512 Mb
Fragments 3 100 width 33 height 100 frames
15Zhukovsky problem
16Zhukovsky problem
17Problems
- Memory management in Windows
- Performance of C-programs vs C and
Fortran-programs - Serialization performance
- Generics for C
- Maximal number of threads