Parent and child process
I want to write a C language program which used signalling and the features are,
1. There is a parent process.
2. Then the parent process creates a child process.
3. Child process prints "1".
4. Child process stops.
5. Parent process then send a signal to child for printing next message.
6. Same child process again prints "2".
7. Child process stops.
8. Parent process then send a signal to child for printing next message.
9. Same child process prints "3".
10.Parent process then send a signal to child for printing next message.
11. Same child process prints "It's enough now!".
12. Then child process terminates.
Please help me regarding to problem statement.
The "problem statement" (= specification?) looks complete and do-able ("stops" might have to be "loops slowly"). Are you asking about how to implement it? If so, which language do you want?
First of all I think this not the right forum to ask this question.
Regarding your question, you can use binary semaphore and you can see the code for the producer consumer problem where parent process is a producer which produces the signal and child process is consumer which consumes the signal and prints the value.
Deep Narayan Dubey,
You're right, this is the wrong forum. I will move it to Programming after moderation.
Is this homework? If so, please say so up front.
While it is against LQ policy to ask us to do your homework for you:
Please make your next post an answer to this question. TIA.
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
However, please answer to archtoad6 question.
|All times are GMT -5. The time now is 02:39 AM.|