-   Programming (
-   -   Parent and child process (

Iyyaaz 12-23-2010 12:29 PM

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.

Thank you.

catkin 12-23-2010 01:26 PM

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?

Deep Narayan Dubey 12-23-2010 10:56 PM

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.

archtoad6 12-24-2010 03:17 PM

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:

Do not expect LQ members to do your homework - you will learn much more by doing it yourself.
you may find many members will help you help yourself.

Please make your next post an answer to this question. TIA.

Mara 01-02-2011 12:20 PM

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 11:01 PM.