Advertisement

Child/Parent communication

Started by November 15, 2000 02:55 PM
1 comment, last by ao 23 years, 10 months ago
What is the best way for child to child / child to parent communication when I create them using fork()? From what I understand I cant just modify variables and look at them in the newly created processes because they get their own memory space. Should I look at setting/retrieving environment variables, or is there an easier way? ao
Play free Java games at: www.infinitepixels.com
Man, it''s funny. No matter how long or short you look for something that you can''t find, you always find out some helpful info right after you post for help.

Anyways, I found out I could use popen/pclose. If there is anything better than that, someone let me know.

ao
Play free Java games at: www.infinitepixels.com
Advertisement
Well, since you've already found popen and pclose I just want to make sure you've looked up pipe. Type 'man pipe' and you'll get this:
  PIPE(2)             Linux Programmer's Manual             PIPE(2)NAME       pipe - create pipeSYNOPSIS       #include <unistd.h>       int pipe(int filedes[2]);DESCRIPTION       pipe  creates  a  pair  of file descriptors, pointing to a       pipe inode, and places them in the  array  pointed  to  by       filedes.   filedes[0]  is  for  reading, filedes[1] is for       writing.RETURN VALUE       On success, zero is returned.  On error, -1  is  returned,       and errno is set appropriately.ERRORS       EMFILE  Too  many  file descriptors are in use by the pro­               cess.       ENFILE  The system file table is full.       EFAULT  filedes is not valid.CONFORMING TO       SVr4, SVID, AT&T, POSIX, X/OPEN, BSD 4.3SEE ALSO       read(2), write(2), fork(2), socketpair(2)Linux 0.99.11              23 July 1993                         1  


Depending on your needs, you might like to look up the Parallel Virtual Machines library (aka PVM).

Edited by - Graylien on November 15, 2000 8:41:02 PM
------When thirsty for life, drink whisky. When thirsty for water, add ice.

This topic is closed to new replies.

Advertisement