|
|
#2 (permalink) | |
|
Mountain Goat
Join Date: Oct 2009
Posts: 3
![]() |
Quote:
Here's the spawn hierarchy: P (original parent process) 4 ( child threads) (3 2 1 0) --> (no. of threads forked by each of the threads in the previous level) ( (2 1 0) ( 1 0) (0) ) (( (1 0) (0) ) ( (0) ) ) ((( (0) ))) Adding, we get 15 child processes. The way to read the above is each non-zero entry 'i' in one level expands to i entries in the next level. - Zorth. |
|
|
|
|
|
|
#4 (permalink) |
|
I JUST got here.
Join Date: Oct 2009
Posts: 8
![]() |
No endless forks, because the child does not start running from the beginning - it starts from just after the 'fork();' statement (just like the parent, which also continues executing any statement after the 'fork();')
Child is created with i=1. There is no statement after fork();, so the child continues the loop (i++), and creates a grandchild with i=2... |
|
|
|
Contact TestMagic TestMagic Forums Archive Privacy Statement
TestMagic Locations
Legal
Privacy
SEO by vBSEO 3.2.0
Copyright © 2009 TestMagic
Ad Management by RedTyger