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 wrote:
> i know that the program sholud have printed "hello word" 8 timesbt whn
> i run it, i get diffrn
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 wrote:
> #include
> main()
> {
> fork();
> fork();
> fork();
> printf("Hello Word\n");
> }
>
> output ---
> rajeshkumar@rajeshkumar-laptop:~$
arey Dude before child process gets killed, your parent gets killed and it
returns to shell
On Thu, May 24, 2012 at 8:26 AM, Rajesh Kumar wrote:
> #include
> main()
> {
> fork();
> fork();
> fork();
> printf("Hello Word\n");
> }
>
> output ---
> rajeshkumar@rajeshkumar-laptop:~$ ./a.out
> Hello W
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 wrote:
> main process have completed till the time all processes proces
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 wrote:
> #include
> main()
> {
> fork();
> fork();
> fork();
> printf("Hello Word\n");
> }
>
> output ---
> r
#include
main()
{
fork();
fork();
fork();
printf("Hello Word\n");
}
output ---
rajeshkumar@rajeshkumar-laptop:~$ ./a.out
Hello Word
Hello Word
Hello Word
rajeshkumar@rajeshkumarr-laptop:~$ Hello Word
Hello Word
Hello Word
Hello Word
Hello Word
Why it is not printed continously?
--
You received