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
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.
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.