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 5 of 20 Topic 1080 of 1217
Post > Topic >>

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

by "cr88192" <cr88192@[EMAIL PROTECTED] > Dec 9, 2007 at 09:05 PM

"George Peter Staplin" <georgepsSPAMMENOT@[EMAIL PROTECTED]
> wrote in message 
news:fjgest$46m$1@[EMAIL PROTECTED]
> cr88192 wrote:
>> request:
>> general opinions with regards to sup****ting concurrency within a C 
>> compiler.
>>

<snip>

>
> 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.
>


interesting idea, but likely to be a little alien in C land.

not like I can claim my idea is much less so:
foo!(2, 3);

(leading to a function call where, unless it is joined, one has almost no 
idea when it will actually happen...).

yeah...


actually, one idea I had considered was the possibility of "message pipes"

(I had these in a few of my previous languages). the problem with C being 
its inflexibility in some matters (otherwise, I would have to do something

"creative").

of course, sending structs over pipes would be easy, but the hope is not
to 
send structs, but actual tuples of some sort.


then again, one can implement message pipes (in a plain struct-passing 
manner) purely as a library facility, which may be worth consideration
(this 
would be, sort of like MPI, but representing a system of interconnected 
nodes and message pipes, rather than some flat list of well-defined
threads 
passing buffers around).

another simple, and interesting, idea, would be implementing something
along 
the lines of Linda, but I am not so sure how useful this would be...

these would be used in combination with more traditional approaches (aka: 
good old threads and mutexes...).


it seems the whole problem is even less clean-cut than I had originally 
thought...


> 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 23:39:25 CDT 2008.