Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Communicating Sequential Processes ever used in large multi threaded C++ programs?

I'm currently writing a large multi threaded C++ program (> 50K LOC).

As such I've been motivated to read up alot on various techniques for handling multi-threaded code. One theory I've found to be quite cool is:

http://en.wikipedia.org/wiki/Communicating_sequential_processes

And it's invented by a slightly famous guy, who's made other non-trivial contributions to concurrent programming.

However, is CSP used in practice? Can anyone point to any large application written in a CSP style?

Thanks!

like image 285
anon Avatar asked Feb 07 '10 04:02

anon


People also ask

Does C allow multi threading?

C does not contain any built-in support for multithreaded applications. Instead, it relies entirely upon the operating system to provide this feature. This tutorial assumes that you are working on Linux OS and we are going to write multi-threaded C program using POSIX.

What does multi threaded mean in programming?

Multithreading is the ability of a program or an operating system to enable more than one user at a time without requiring multiple copies of the program running on the computer. Multithreading can also handle multiple requests from the same user.

Is C single threaded?

C is a language that runs on one thread by default, which means that the code will only run one instruction at a time.


1 Answers

Answering a very old question, yet it seems important that one

There is Go where CSPs are a fundamental part of the language. In the FAQ to Go, the authors write:

Concurrency and multi-threaded programming have a reputation for difficulty. We believe this is due partly to complex designs such as pthreads and partly to overemphasis on low-level details such as mutexes, condition variables, and memory barriers. Higher-level interfaces enable much simpler code, even if there are still mutexes and such under the covers.

One of the most successful models for providing high-level linguistic support for concurrency comes from Hoare's Communicating Sequential Processes, or CSP. Occam and Erlang are two well known languages that stem from CSP. Go's concurrency primitives derive from a different part of the family tree whose main contribution is the powerful notion of channels as first class objects. Experience with several earlier languages has shown that the CSP model fits well into a procedural language framework.

Projects implemented in Go are:

  • Docker
  • Google's download server
  • Many more
like image 197
Unapiedra Avatar answered Oct 11 '22 13:10

Unapiedra