Thread: managing father and son processes

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    2

    managing father and son processes

    I would like the son process to communicate with the father because when the son dies, it seem that the variables modified by the son go lost, because the son creates a copy of all the variablesm I'd like isntead some of them to remain there

    if you have examples pleasepast some code

    we are new to c programming

    thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Yeah, which operating system and compiler are you using?

    Not to be picky, but this is deep stuff for newbies.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    2
    I know it's noobish but....
    linux, gcc

    thanks for your help

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    man 2 pipe

    Probably the easiest way is to create a pipe() before fork() and execl() the child process.
    The child can then write() to one end of the pipe, and the parent can read() from the other end.

    A board search for "pipe" will reveal some stuff
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    or you can use threads...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Father and Son Variables
    By khdani in forum Linux Programming
    Replies: 3
    Last Post: 11-28-2008, 06:42 PM
  2. Simple Processes Program
    By khdani in forum Linux Programming
    Replies: 9
    Last Post: 11-18-2008, 10:59 AM
  3. Religion
    By gnu-ehacks in forum A Brief History of Cprogramming.com
    Replies: 239
    Last Post: 01-26-2002, 10:44 AM
  4. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM