Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Languages Misc > Re: RFC: C and ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 20 Topic 1080 of 1217
Post > Topic >>

Re: RFC: C and concurrency (as CC extensions)

by George Peter Staplin <georgepsSPAMMENOT@[EMAIL PROTECTED] > Dec 9, 2007 at 10:09 AM

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
 




 20 Posts in Topic:
RFC: C and concurrency (as CC extensions)
"cr88192" <c  2007-12-09 16:46:12 
Re: RFC: C and concurrency (as CC extensions)
Robbert Haarman <comp.  2007-12-09 09:18:45 
Re: RFC: C and concurrency (as CC extensions)
"cr88192" <c  2007-12-09 20:29:19 
Re: RFC: C and concurrency (as CC extensions)
George Peter Staplin <  2007-12-09 10:09:33 
Re: RFC: C and concurrency (as CC extensions)
"cr88192" <c  2007-12-09 21:05:07 
Re: RFC: C and concurrency (as CC extensions)
"Douglas A. Gwyn&quo  2007-12-10 16:34:37 
Re: RFC: C and concurrency (as CC extensions)
"cr88192" <c  2007-12-11 18:32:08 
Re: RFC: C and concurrency (as CC extensions)
"cr88192" <c  2007-12-12 10:37:02 
Re: RFC: C and concurrency (as CC extensions)
"Douglas A. Gwyn&quo  2007-12-12 18:19:29 
Re: RFC: C and concurrency (as CC extensions)
"cr88192" <c  2007-12-15 07:48:35 
Re: RFC: C and concurrency (as CC extensions)
Roberto Waltman <usene  2007-12-12 15:00:49 
Re: RFC: C and concurrency (as CC extensions)
"cr88192" <c  2007-12-13 06:34:23 
Re: RFC: C and concurrency (as CC extensions)
Roberto Waltman <usene  2007-12-12 15:56:02 
Re: RFC: C and concurrency (as CC extensions)
"cr88192" <c  2007-12-13 17:09:04 
Re: RFC: C and concurrency (as CC extensions)
John Whorfin <_@[EMAIL  2007-12-13 22:47:44 
Re: RFC: C and concurrency (as CC extensions)
"cr88192" <c  2007-12-13 22:25:19 
Re: RFC: C and concurrency (as CC extensions)
ram@[EMAIL PROTECTED] (S  2007-12-18 18:59:03 
Re: RFC: C and concurrency (as CC extensions)
"cr88192" <c  2007-12-19 07:54:44 
Re: RFC: C and concurrency (as CC extensions)
Robbert Haarman <comp.  2007-12-19 06:04:59 
Re: RFC: C and concurrency (as CC extensions)
"cr88192" <c  2007-12-20 06:02:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 0:23:32 CDT 2008.