Re: [algogeeks] problem of fork()

2012-05-24 Thread Srikrishan Malik(gmail)
because the process which is executed from prompt has exited and the children are still alive and printing. On Thu, May 24, 2012 at 8:26 AM, Rajesh Kumar testalgori...@gmail.comwrote: #includestdio.h main() { fork(); fork(); fork(); printf(Hello Word\n); } output ---

Re: [algogeeks] problem of fork()

2012-05-24 Thread sumit mahamuni
its not about compilers ... its that new kernels kills all the child processes, if parent gets killed before.. so that is the reason you are gettin diff reasons On 5/24/12, himanshu kansal himanshukansal...@gmail.com wrote: i know that the program sholud have printed hello word 8 timesbt whn

Re: [algogeeks] problem of fork()

2012-05-23 Thread rajesh singarapu
main process have completed till the time all processes processes prints Hello World, to prevent it, use wait/wait4 family of fucntions. ~r On Thu, May 24, 2012 at 8:26 AM, Rajesh Kumar testalgori...@gmail.com wrote: #includestdio.h main() { fork(); fork(); fork(); printf(Hello Word\n);

Re: [algogeeks] problem of fork()

2012-05-23 Thread himanshu kansal
i know that the program sholud have printed hello word 8 timesbt whn i run it, i get diffrnt reslts everytime and on diffrnt compilers... please tell the reason On Thu, May 24, 2012 at 11:11 AM, rajesh singarapu rajesh0...@gmail.comwrote: main process have completed till the time