Thread: fork()

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    2

    Question fork()

    i have a problem about creating the fibonacci number by using fork() function...

    the parent will create its child and then the child will compute the first fibonacci numer then it will create a child and this will go like this until the wanted number reached meanwhile each parent process will wait its child until it executes its process..

    how can create a childs child?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    The first thing is to review the forum rules and learn not to cross-post the same question to multiple forums. I've deleted your other post BTW.
    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
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    A recursive function calling either fork() or wait() ought to do it.
    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.

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    2
    Quote Originally Posted by Salem
    The first thing is to review the forum rules and learn not to cross-post the same question to multiple forums. I've deleted your other post BTW.
    sorry i realised that either i will write the code with c or c++ and decided to write in c..never again........

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fork(), pause(), and storing PID's in a linked list
    By vital101 in forum C Programming
    Replies: 10
    Last Post: 09-28-2007, 02:16 AM
  2. Fork() not working.
    By BENCHMARKMAN in forum C++ Programming
    Replies: 3
    Last Post: 08-01-2007, 12:28 AM
  3. Fork - unpredictable?
    By fredkwok in forum Linux Programming
    Replies: 4
    Last Post: 03-26-2006, 02:49 PM
  4. fork(), exit() - few questions!
    By s3t3c in forum C Programming
    Replies: 10
    Last Post: 11-30-2004, 06:58 AM
  5. Daemon programming: allocated memory vs. fork()
    By twisgabak in forum Linux Programming
    Replies: 2
    Last Post: 09-25-2003, 02:53 PM