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

RE: A CSP library "for dummies"?


We might have what you are looking for. We call it a pragmatic superset of
CSP and you program in C.
It was developed as a network-centric RTOS but is CSP at its core. We don't
have channels, but "hubs" and they act like guarded atomic actions. It is
preemptive but small as well. A Single Processor kernel has been reduced (in
C) to 1 KB, the MP version normally fits in less than 5 KB. This was a
"side-effect" from using formal modeling for its design.

I am not so in favor of cooperative scheduling as we target hard real-time.
But put all priorities to the same level and use the "yield" services and
you will have the same effect. And how do you distributed cooperative
The nice thing about CSP is that it controls complexity by breaking up the
state machine and keeping the pieces inside the tasks/processes.  

For those who want to play, there is a WIN32 version (Linux in the works)
available for free.

See www.altreonic.com and send us a mail. The research was done at

Eric Verhulst

-----Original Message-----
From: Mailing_List_Robot [mailto:sympa@xxxxxxxxxx] On Behalf Of Ruth
Sent: maandag 2 februari 2009 22:19
To: occam-com
Subject: 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!