[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A CSP library "for dummies"?


Is there a CSP-type threads library that is compilable using only a C compiler on Windows/MacOSX/Linux?

I'm trying to wean some folks at work off pthreads and suggested libc++csp, but it's C++ roots rule it out. I guess it could probably be ported, but that's not going to make it more appealing. I know of RB's libcsp, but have been slightly put off just because it seems very old now and wonder how "supported" it is.

Finally, in a mail to a developer here I wrote:

/"RIC: Finally, it is interesting to note that cooperative scheduling is *very* much more efficient than preemptive scheduling; the trick is to write the scheduling points into the code using the compiler, making it less likely that one thread starves others."/

/"AJCD: //Also, cooperative scheduling ultimately relies on state machines, which are hard to debug and maintain, and tend to rely more on heap allocation than stack allocation."/

Now, I don't think AJCD's point about state machines is quite valid in this context as I think he's thinking about big switch statements of bits of code and a loop, but he's an intelligent guy: any thoughts on a good reply?

Going back to my comment, are there any C compilers that have/can be "instrumented" to do the "inject-scheduling point" thing, with suitable library support. All I can think of is Handel-C, which is not appropriate.

Thanks, and Merry Christmas to you all!