LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 12-23-2010, 12:29 PM   #1
Iyyaaz
LQ Newbie
 
Registered: Dec 2010
Posts: 4

Rep: Reputation: 0
Lightbulb Parent and child process


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

Last edited by Iyyaaz; 12-23-2010 at 02:20 PM.
 
Old 12-23-2010, 01:26 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
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?
 
Old 12-23-2010, 10:56 PM   #3
Deep Narayan Dubey
LQ Newbie
 
Registered: Dec 2010
Location: Allahabad, India
Posts: 11

Rep: Reputation: 8
Hi,
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.
 
Old 12-24-2010, 03:17 PM   #4
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 231Reputation: 231Reputation: 231
Deep Narayan Dubey,

You're right, this is the wrong forum. I will move it to Programming after moderation.


Iyyaaz,

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

Last edited by archtoad6; 01-16-2011 at 06:42 AM. Reason: typo
 
Old 01-02-2011, 12:20 PM   #5
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,539

Rep: Reputation: 149Reputation: 149
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending Signal from Child Process to Parent Process : Not getting desired output thelink123 Linux - General 4 10-26-2012 10:05 PM
Can a child process kill the parent process ? sree_ec Programming 8 11-20-2010 06:37 AM
child process usses same amount of ram as parent process socialjazz Programming 7 10-19-2006 06:48 PM
Bash Scripting - child process affecting parent process mthaddon Linux - General 1 05-02-2004 02:19 PM
about parent and child process winwar Solaris / OpenSolaris 3 07-23-2003 07:07 AM


All times are GMT -5. The time now is 10:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration