An overview of Compositional C++ (CC++)
Guowei Huang and Aixiang Yao
- What is CC++ ? CC++ is a strict superset of the C++ language
in that way any valid C or C++ program that does not use a CC++ keyword
is also a valid CC++ program. It was designed to alleviate the
frustrations of parallel programming by extending the C++ by the
following six basic abstractions:
thread, sync variable, atomic function, processor object, global
pointer, transfer function.
- What does CC++ compiler do? And how to install a CC++ compiler? CC++
compiler is a translator, it translates CC++ code into C++ code with calls to
the threads library. Version 4.0 (beta release) of CC++ compiler is
available, but a successful installation requires a restricted
combination of host operating system, C++ compiler, and threads
packages.
- How does CC++ work ? Like any other parallel programming language,
CC++ provides the mechanism by which parallel threads of control are created.
- Six Basic abstractions implemented by the CC++ extensions
- Processor object is a collection of data and computation
that defines a single address space. (declared by keyword global)
- global pointer is a mechanism for linking together
processor objects.
- Thread is a mechanism for specifying concurrent execution.
Threads are created independently from processor objects, and more than
one thread can execute in a processor object. (created by using keywords
par, parfor and spawn)
- sync variable is used to synchronize thread executions.
(identified by keyword sync)
- Atomic function is a mechanism used to control the
interleaving of threads executing in the same processor object.
(identified by keyword atomic)
- Transfer function allow arbitrary data structures to be
transferred between processor objects as arguments to remote procedure
calls. (identified by the predefined type CCVoid)
- Key words of CC++ :
- par blocks enclose statements that are executed in
parallel.
The most basic mechanism for creating parallel threads of
control in CC++ is the parallel block. A parallel block
looks just like a compound statement in C or C++ with
the keyword par.
- parfor denotes a loop whose iterations are executed in
parallel.
- spawn statement creates a new thread of control executing
in parallel with the spawning thread.
- sync data items are used for synchronization.
Synchronization is achieved by making a consumer
requiring data (attempt to read data) from a channel block
until a producer makes data avaiable.
- atomic functions control the level of interleaving of actions
composed in parallel.
To achieve mutual exclusion, an object can be declared
atomic. This ensures that even if multiple
producers attempt to access (to write, or to append) the
same object concurrently, the actual operations
will occur in some sequential order.
- global is used to declare a processor object or to declare
a global pointer to objects in processor object.
To access a data structure or to perform computation (using
a remote procedure call, or RPC) in another processor object,
a global pointer must be used.
- proc_t can be used to construct a placement structure with a
specified processor name.
proc_t is an implementation-defined type that
specifies where to place a processor object and
where to find its definition.
- CCVoid is used to declare a transfer function.
data transfer functions describe how data is
transfered between address spaces (processor objects).
- Summary
CC++ provides basic mechanisms that can be used to
implement a variety of different parallel program structures. Despite
the simplicity and the small number of extensions, the conjunction of
these constructs, when combined with C++, results in an extremely rich
and powerful parallel programming notation. Also all of the
object-oriented features of C++ are preserved in CC++ . These features
(especially generic classes and inheritance mechanisms) promote the the
reuse of code, strucure.
- References
cs6404 class account
Sat May 4 10:50:28 EDT 1996