There is also http://libdill.org/ which has a different, better in my view, model and I have actually used in production.
I dont think libdill supports multiple CPUs, which is really hard to get right
Libcsp: a fast C concurrency library influenced by the CSP model
11–20 of 26 posts
Re: Libcsp: a fast C concurrency library influenced by the CSP model
#12The linked Wikipedia article[1] on CSP says > communicating sequential processes (CSP) is a formal language for describing patterns of interaction in concurrent systems The Libcsp project says it’s influenced by CSP. Does libcsp stick to this formal language? 1 - https://en.wikipedia.org/wiki/Communicating_sequential_proce...
Re: Libcsp: a fast C concurrency library influenced by the CSP model
#13Re: Libcsp: a fast C concurrency library influenced by the CSP model
#14I've had a very short introduction to pthreads in a CS class, but it was too succinct to get any practical benefit IMO. Knowing that a mutex can be used to limit access to a shared variable is easy enough to understand. How to structure software that runs concurrent tasks is still a mystery to me. Code I've written that uses threads appears to work but I'm not confident I haven't introduced a deadlock in there that's just waiting the worst possible timing to trigger. For instance, the pthreads manpage does a good job at listing the available functions. I have no idea when they should be used though.
If anyone can point me to learning resources around concurrency (books, presentations, talks, sample open source software that does good use of concurrency patterns, ... anything goes, really) I will be eternally grateful.
Re: Libcsp: a fast C concurrency library influenced by the CSP model
#15Earlier quoted context omitted.
I dont think libdill supports multiple CPUs, which is really hard to get right
Well it does not allow coroutines to migrate to different OS threads and handles to be shared across OS threads, but that does not mean it doesn't support multiple CPUs. It's more correct to say that it doesn't come with that support out of the box, but it certainly does allow for it and nudges you towards a specific direction (no shared mutable state).
My use case is certainly not the common one though, so others may have different experiences.
Re: Libcsp: a fast C concurrency library influenced by the CSP model
#16Does anyone have resources related to learning concurrency ? I've had a very short introduction to pthreads in a CS class, but it was too succinct to get any practical benefit IMO. Knowing that a mutex can be used to limit access to a shared variable is easy enough to understand. How to structure software that runs concurrent tasks is still a mystery to me. Code I've written that uses threads appears to work but I'm…
Re: Libcsp: a fast C concurrency library influenced by the CSP model
#17Does anyone have resources related to learning concurrency ? I've had a very short introduction to pthreads in a CS class, but it was too succinct to get any practical benefit IMO. Knowing that a mutex can be used to limit access to a shared variable is easy enough to understand. How to structure software that runs concurrent tasks is still a mystery to me. Code I've written that uses threads appears to work but I'm…
https://pragprog.com/book/pb7con/seven-concurrency-models-in...
Also because I have it, here’s a distributed systems meta-reading-list. It’s old and thus I’m sure there are some broken links, but it’s a deep rabbit hole if you’re interested in distributed systems, which is basically concurrency on steroids.
Re: Libcsp: a fast C concurrency library influenced by the CSP model
#18Earlier quoted context omitted.
You run multiple instances, one per CPU core.
there is a huge difference between running an instance per CPU and letting a smart scheduler orchestrate things for you.
Re: Libcsp: a fast C concurrency library influenced by the CSP model
#19Re: Libcsp: a fast C concurrency library influenced by the CSP model
#20Earlier quoted context omitted.
I suspect it stops being so nice when you want to do something equivalent to go's `select` statement. Though that's purely speculation, and if I'm wrong it should definitely go in the examples!
Your skepticism made me look through the library more carefully. I came across some limitations in comparison to what Go provides: 1. As you suggest, there's no equivalent to the `select` mechanism. To perform the equivalent, you must busy loop and call `csp_chan_try_pop`. 2. It appears you cannot nest coroutines. 3. The mutex implementation does not provide an RWMutex. 4. `csp_yield` seems somewhat necessary for pra…