cr88192 wrote:
> request:
> general opinions with regards to sup****ting concurrency within a C
compiler.
>
> I am considering options in general, so if people feel like arguing for
or
> against existing options, like OpenMP, MPI, or even good old threads or
> mutexes, that is workable.
>
> as for c.s.c, note that this is not a standards proposal, but I mostly
just
> figure the people there may be able to provide good input (and, not
c.l.c,
> because this group is overloaded and less likely to provide meaningful
> input).
>
>
> full on syntax tweaking is acceptable, with the natural restriction that
any
> such extensions, by their existence, will not violate the compilers'
> conformance with the existing C standards (examples include general
> syntactic/semantic changes that would risk effecting the operation of
normal
> code).
>
> ideally, such extensions should not be too horribly ugly or awkward, or
> require fundamental changes as to how one imagines the task at hand
(aka:
> using it should not be overly counterintuitive or require something like
a
> circus act to make it work...).
>
> ideally, it should also refrain from adding too much complexity to the
> compiler internals (on this front, I am proposing that concurrency
> mechanisms be simple and explicit, though this should be more in terms
of
> compiler internals, and not simply in terms of syntax)
>
I propose Box programming. I wrote a paper about it here, although I
used a language called Tcl for the implementation:
http://www.xmission.com/~georgeps/do***entation/software/TFP5.pdf
Here's an example of several fictional boxes that form a process
network:
box sender {
/* startup code for sender */
} takes (struct boxobj *addr, struct boxobj *data) {
/* addr could be a NUL-terminated string with a size_t for length */
if (sendsomehow (addr, data)) {
out 0 (FAILURE);
} else {
out 0 (SUCCESS);
}
} out 1 /* this has 1 output ****t */
box input {
/* startup code for input */
FILE *fp = stdin;
} takes (void) {
out 0 (readinput(fp)); /* read an addr */
out 1 (readinput(fp)); /* read data */
} out 2
box logger {
FILE *fp = fopen ("log", "a");
if (NULL == fp) {
perror ("fopen");
exit (EXIT_FAILURE);
}
} takes (struct boxobj *msg) {
writeobj (fp, msg); /* write our log message */
} out 0
int main (int argc, char *argv[]) {
connect input 0 sender 0
connect input 1 sender 1
connect sender 0 logger 0
while (n processes are running) {
route ();
}
return EXIT_SUCCESS;
}
Ideally none of the processes in the network know about their
connections. Also, it should be possible to dynamically alter
connections in the router. Thus a disconnect keyword might be useful.
In practice I think parts can be implemented somewhat ****tably with
pipe() and CreatePipe() for the respective systems. The startup code is
another matter though. I'm not sure how to implement the startup code
for each box ****tably, unless the compiler outputs several executable
images. POSIX is somewhat easier...
I hope this helps.
George


|