Article 5M6GR Multiple Fork() Calls

Multiple Fork() Calls

by
Victor43
from LinuxQuestions.org on (#5M6GR)
Hello, I found the following piece of code here I would like to learn what happens when this piece of code is executed ? I'm not certain but believe that a single parent is created having three child threads. Does this sound correct ?

Quote:
int main()
{
int status;
if(!fork()) execl("pp1",NULL);
if(!fork()) execl("pp2",NULL);
if(!fork()) execl("pp3",NULL);
wait(&status);
return status;
}
latest?d=yIl2AUoC8zA latest?i=art-LoYqprE:gt_2Dl8cVlQ:F7zBnMy latest?i=art-LoYqprE:gt_2Dl8cVlQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=art-LoYqprE:gt_2Dl8cVlQ:gIN9vFwart-LoYqprE
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments