0

How many processes does the following piece of code create? Why?

int main()
{ 
 fork();
 fork();
 fork();
 return 0;
}

I was looking for assitance that said build a tree but i came up with 10 processes but I'm not sure if that is right, i created a tree

user3195820
  • 13
  • 1
  • 3
  • That;s *NOT* a duplicate of the marked question. That's to do with printf buffering and fork(). – Roddy Jan 14 '14 at 22:28

1 Answers1

1
main=P1
---- first fork
P1->P1.1
---- second fork
P1->P1.2
P1.1->P1.1.1
-----third fork
P1->P1.3
P1.1->P1.1.2
P1.2->P1.2.1
P1.1.1->P1.1.1.1

eight.

Chris J. Kiick
  • 1,487
  • 11
  • 14