C++CSP2: A Many-to-Many Threading Model for Multicore Architectures

The advent of mass-market multicore processors provides exciting new op- portunities for parallelism on the desktop. The original C++CSP - a library providing concurrency in C++ - used only user-threads, which would have prevented it taking advantage of this parallelism. This paper details the devel opment of C++CSP2, which has been built around a many-to-many threading model that mixes user-threads and kernel-threads, providing maximum flexibility in taking ad vantage of multicore and multi-processor machines. New and existing algorithms are described for dealing with the run-queue and implementing channels, barriers and mutexes. The latter two are benchmarked to motivate the choice of algorithm. Most of these algorithms are based on the use of atomic instructions, to gain maximal speed and efficiency. Other issues related to the new design and related to implementing concurrency in a language like C++ that has no direct support for it, are also described. The C++CSP2 library will be publicly released under the LGPL before CPA 2007.

[1]  Brian N. Bershad,et al.  Scheduler activations: effective kernel support for the user-level management of parallelism , 1991, TOCS.

[2]  Kevin J. Vella,et al.  Seamless parallel computing on heterogeneous networks of multiprocessor workstations , 1998 .

[3]  Johannes F. Broenink,et al.  Redesign of the C++ Communicating Threads Library for Embedded Control Systems , 2004 .

[4]  Sarah Clayton,et al.  CSP for .NET Based on JCSP , 2006, CPA.

[5]  Neil Brown,et al.  Rain: A New Concurrent Process-Oriented Programming Language , 2006, CPA.

[6]  Peter H. Welch,et al.  Prioritised Dynamic Communicating Processes: Part II , 2002 .

[7]  Wilson Ifill,et al.  Integrating and Extending JCSP , .

[8]  Hans Henrik Happe TCP Input Threading in High Performance Distributed Systems , 2006, CPA.

[9]  Peter H. Welch,et al.  An Introduction to the Kent C++CSP Library , 2003 .

[10]  Bernhard Herbert Carl Sputh,et al.  Software defined process networks , 2006 .

[11]  Ulrich Drepper,et al.  Futexes Are Tricky , 2004 .

[12]  Alex A. Lehmberg,et al.  An Introduction to CSP.NET , 2006, CPA.

[13]  Peter H. Welch,et al.  The Kent retargetable occam compiler , 1996 .

[14]  Neil C. C. Brown,et al.  C++CSP Networked , 2004 .

[15]  Butler W. Lampson,et al.  Experience with processes and monitors in Mesa , 1980, CACM.

[16]  C. A. R. Hoare,et al.  Communicating Sequential Processes (Reprint) , 1983, Commun. ACM.

[17]  Evangelos P. Markatos,et al.  First-class user-level threads , 1991, SOSP '91.

[18]  Johannes F. Broenink,et al.  Communicating threads for Java , 1999 .

[19]  Per Brinch Hansen,et al.  Operating System Principles , 1973 .

[20]  Jeremy M. R. Martin,et al.  Formal Analysis of Concurrent Java Systems , 2000 .

[21]  Michael L. Scott,et al.  Algorithms for scalable synchronization on shared-memory multiprocessors , 1991, TOCS.

[22]  Peter H. Welch,et al.  Java Threads in Light of occam/CSP (Tutorial) , 1997 .

[23]  C. A. R. Hoare,et al.  Monitors: an operating system structuring concept , 1974, CACM.