Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Process Questions in C (fork and critical region)

    First i want to run a process in the background and as i have read to do so i have to exit its father so it will run in the back

    i first wrote this code

    if (child_identity>0)

    but just as the child runs it runs the whole code again and makes an unwanted fork

    In the same way i have a problem understanding the critical sections solution of Peterson ,this is the code


    when you enter the critical region


    the process value entered in both functions is variable and based to the process that calls this function but the only number that is like this is tha number returned by fork that is 0 to the child and different to others ,still to produce such a value before all must be a fork and so all child processes will call a fork too and will ruin the code.Is there a solution.
    Last edited by fleshwound; 10-21-2010 at 02:00 AM.

  2. #2
    Just Joined!
    Join Date
    Dec 2009
    Maryland, USA

    Improve your thread title

    The language you're programming in is probably obvious to some once they open your topic, but it would be even better if you included that info in the thread title, perhaps even repeating the info in the problem description/question.

    Good luck!

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    This is a school exercise or homework problem?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts