fork twice ???

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2008
Posts: 19
Reputation: kneiel is an unknown quantity at this point 
Solved Threads: 0
kneiel kneiel is offline Offline
Newbie Poster

fork twice ???

 
0
  #1
Aug 20th, 2008
how many processes will be created when i fork() twice .

Is this logic correct ?

the 1st fork will spawn child C1 which is a child of the parent process P.
the code segment of the parent P is inherited by C1.
the 2nd fork is called by both P and C1.
P gets another child C2 and C1 its first child C3.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: fork twice ???

 
0
  #2
Aug 21st, 2008
Your logic seems correct, so write a small program and try it.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC