plz help

This is a discussion on plz help within the Linux Programming forums, part of the Platform Specific Boards category; Create 5 processes from a common parent and ensure that the parent terminates after cleaning all the terminated children using ...

  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    1

    plz help

    Create 5 processes from a common parent and ensure that the parent
    terminates after cleaning all the terminated children using waitpid().
    The waitpid() must be called after all the children are created
    and the parent has completed its work real work,if any; in addition, you must
    compile 5 different program files to in children processes to generate their
    respective object files ; the parent process must use waitpid() to collect the
    termination status of children processes baed on the exit code information
    generated by children processes, link all the object files to
    generate the final, linked program/application. In addition, the generated
    binary executable must be loaded in a new process, if the linking is
    Successful !!!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    You know you can edit your posts instead of posting new messages every minute with a new edit.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    2,421
    what have you tried so far?

  4. #4
    Registered User
    Join Date
    May 2012
    Posts
    333
    Quote Originally Posted by pro_learner View Post
    Create 5 processes from a common parent and ensure that the parent
    terminates after cleaning all the terminated children using waitpid().
    Unix is silly. To spawn a child process it is necessary to fork, then create a child process. So you are are creating a copy of the entire parent process for a few microseconds, before it terminates to launch the child.
    I'm the author of MiniBasic: How to write a script interpreter and Basic Algorithms
    Visit my website for lots of associated C programming resources.
    http://www.malcolmmclean.site11.com/www

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    > So you are are creating a copy of the entire parent process for a few microseconds, before it terminates to launch the child.
    You'd be surprised how little actual copying takes place on modern Unix implementations.
    Code is never copied, and data/stack is only copied on write. Which if the next thing you do after fork() is exec(), is probably only the single page containing the current stack frame.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21