3.4. Communicating Process Programming Models
The programming model we will focus on here was first described by Sir Anthony Hoare in 1978. Hoare later published his ideas in 1985 in a seminal book on the topic titled Communicating Sequential Processes. CSP, as described by Hoare, is both a programming model and a language for describing patterns of interactions between independently operating components called processes. Each of the processes in such a system may represent a traditional software program (which operates sequentially in terms of its internal behavior), but processes are limited to communicating with one another via well-defined channels.
Each program in a CSP application may be executing as its own hardware process, independent of all the others and acting much as a traditional von Neumann machine would operate. Rather than having a main controlling process that calls other processes as subroutines, the application as a whole is designed such that data moves through the system (and through various processes in the application) via buffered data channels. While each running process has access to local memory resources (for the purpose of performing computations and storing intermediate results), there is little or no communication between independent processes except via the data channels, which are sometimes called streams.
In an idealized CSP application, no time delay or other overhead is involved in the transfer of data (which is assumed to consist of a relatively small payload of values) between two nodes, regardless of their relative locations. In reality there may be significant bandwidth and latency considerations, particularly if the application is spread between processing elements of dramatically different types, such as FPGA hardware and embedded processors. A "pure" implementation of CSP would also not include any communication outside of the data channels/streams (such as when two processes access the same memory) because doing so would violate the notion of synchronizing the processes to the data.
An important characteristic of the CSP model is that local memory access is less expensive than access to remote (node-external) memory or to the data buffers that implement the data channels. When programming a CSP system, it is therefore important to access data locally whenever possible, as opposed to externally, to realize optimum performance. This parallel programming concept is called locality, and it is fundamental to understanding how to create high-performance parallel applications.
A machine model based on CSP is an ideal target for compiling coarse-grained parallel applications in C. The process components of a CSP application enclose manageable blocks of computation for which a compiler can generate hardware or software from relatively straightforward, standard C-language statements. At the system level, extensions to the C language (provided in the form of function libraries) can provide the needed inter-process communication channels to express a streams-oriented parallel programming model.
Is the resulting hybrid programming model (not quite software, not quite hardware) the right choice for all applications? Surely not, but for the types of applications that can most benefit from acceleration on FPGA-based, highly parallel platforms, it is more than adequate.