![]() |
Introduction |
|
[ Эта же статья на русском ]
At present time, spread use of computer systems with cluster- and GRID-architectures posed a problem of developing high-level, powerful and flexible programming languages which allow one to create complex, but at the same time, robust applications that effectively use the possibilities of concurrent computations. The program interfaces and libraries, which we have now, such as MPI (Message Passing Interface), that are realized for C and Fortran languages, are very lowlevel and not suited for the modern object-oriented languages, such as C++, C# and Java. One of the recent seminal achievment in this area is introduction of an asynchronous parallel programming model within the Polyphonic C# programming language in the context of the Microsoft .NET platform [Benton et al. 2002].In turn, this model is based on the join-calculus [Fournet and Fessant 2002] - a process calculus with the high-level message handling mechanism adequately abstracting the low-level mechanism which exists in the current computer systems. The essence of the new model or, in other words, the key feature of the Polyphonic C# language is the use of so called "asynchronous" methods in addition to conventional synchronous methods of a class. Such asynchronous methods can be declared both autonomously, and in this case they are scheduled for execution in a different thread (either a new one or a working thread from some thread pool), and within a bundle ( or a chord, in terminology of Polyphonic C#) of other methods (synchronous and asynchronous). In the latter case, calling an asynchronous method, which was declared in the chord, corresponds to sending a message or posting an event. Such parallel programming style in Polyphonic C# as before is considered as a programming technique either for a single computer or for many machines interacting through the remote methods calls using .NET Remoting library. Specific features of the proposed MC# language consist in the transferring of asynchronous parallel programming model of Polyphonic C# to distributed case, where an autonomous asynchronous method can be scheduled for execution in a different machine.With that, the asynchronous methods which are declared by chords and are used to deliver values to synchronous methods, form a special syntactic class with the elements named "channels". Therefore, a parallel program writing in MC# language is reduced to label by the special movable keyword the methods which may be transferred for execution to the different processors and arranging their interactions by the channels. Earlier, an analogous approach in which a programmer has been partitioning all functions in the program into "movable" and "unmovable', used in the Tsystem [Abramov and Adamovich 1999].This system is intended for the dynamic scheduling of execution of parallel programs written in an extension of C. Though the channels in MC# are "one-directional" in their nature (same as in the join-calculus), nevertheless they are generalised naturally to "bidirectional" channels which may be used by movable methods both for sending and receiving messages. An implementation of the MC# language consists of a compiler for translating from the input language of a system to C#, and a runtime-system to execute a translated program. A compiler replaces the movable methods calls in the source program to queries to manager of computational resources that schedules the execution of parallel fragments of program in computer system. Having received a query, a manager selects the most suitable node of multiprocessor and copies an object, of which the movable method is scheduled for remote execution, to the selected node together with the arguments of this method. This copy is "dead" after the movable method has finished its work, and all changes that occurred to it are not transferred to the original object. Passing of bidirectional channels as arguments of methods is realised through the transferring the proxies for such channels.Thus, in MC# language, both the channels and the bidirectional channels are the local entities bounded to the place of their declaration. In particular, this means that the programmer is responsible for eRective arrangement of communication by the channels. As an initial stage of our work for the MC# language, we have written in it a series of parallel algorithms such as a computation of Fibonacci numbers, walking through the binary (balanced) tree, computation of primes by Eratosthenes sieve, calculation of Mandelbrot set, modeling the Conway's game "Life", etc. In all these cases, we got the easy readable and compact code for the corresponding problems due to the possibility to write parallel programs in MC# without taking care of their actual distribution over machines during execution. Similarly, there is no need for the manual programming in MC# of object (data) serialization in order to transfer these objects to remote processors ( in contrast to MPI, where a special code is needed for a given problem) - the runtime-system of MC# performs an object serialization/ deserialization automatically.
|
|