CC++ is a general-purpose parallel programming language comprising all of C++ plus six new keywords. It is a strict superset of the C++ language in that any valid C or C++ program that does not use a CC++ keyword is also a valid CC++ program. The CC++ extensions implement six basic abstractions:
These abstractions provide the basic mechanisms required to specify concurrency, locality, communication, and mapping.
Program 5.3 illustrates many CC++ features. It is an implementation of the bridge construction algorithm developed in Example 1.1. The program creates two tasks, foundry and bridge, and connects them with a channel. The channel is used to communicate a stream of integer values 1..100 from foundry to bridge, followed by the value --1 to signal termination.
While the concepts of task and channel are not supported directly in CC++ , they can be implemented easily by using CC++ mechanisms. Hence, the main program creates two tasks by first using the new operator to create two processor objects and then using the par construct to create two threads, one per processor object. The two tasks engage in channel communication by invoking functions defined in a Channel class, which will be described in Section 5.11. A channel is declared in the main program and passed as an argument to foundry and bridge. These processes use access functions get_out_port and get_in_port to obtain pointers to out-port and in-port objects to which can be applied functions send and receive, respectively.
© Copyright 1995 by Ian Foster