expected op is 9 .. since on each iteration parent process gets
cancelled out (its pid > 0 ) and child process alone prints hello ..
no chance of getting 10 or any other output .. correct me if m wrong !

On Sep 22, 8:31 am, siva viknesh <[email protected]> wrote:
> if anybody knows other good online compilers try to post ... codepad
> doesn't support fork
>
> On Sep 22, 8:29 am, siva viknesh <[email protected]> wrote:
>
>
>
>
>
>
>
> >http://ideone.com/l5ek4 .. in this it had shown 6
>
> >http://ideone.com/Lj56O .. here 10 !!!!
>
> > On Sep 22, 8:27 am, siva viknesh <[email protected]> wrote:
>
> > > somebody try to execute in linux and try to find the output...expected
> > > output is 9....but when first in ideone without \n in printf it showed
> > > 7 .. then with \n it showed 10... again with \n it showed 10 !!! ..
> > > whether its prob with compiler or fork's execution is differing i'm
> > > confused :(
>
> > > On Sep 22, 1:34 am, Rashmi Jain <[email protected]> wrote:
>
> > > > but in this output 10  times hello is printed..how..??
>
> > > > On Thu, Sep 22, 2011 at 1:52 AM, ravi maggon <[email protected]> 
> > > > wrote:
> > > > > This is the output I am getting
>
> > > > >    -
>
> > > > >    result: Success     time: 0s    memory: 1720 kB     returned 
> > > > > value: 0
> > > > >     input: no
> > > > >     output:
>
> > > > >    HelloHelloHelloHelloHelloHelloHelloHelloHelloHello
>
> > > > > On Thu, Sep 22, 2011 at 1:40 AM, teja bala 
> > > > > <[email protected]>wrote:
>
> > > > >> @ ravi but compile it onhttp://ideone.com/nkTVN it showing 45 hello 
> > > > >> plz
> > > > >> do look at it.......
>
> > > > >> On Thu, Sep 22, 2011 at 12:59 AM, Rashmi Jain 
> > > > >> <[email protected]>wrote:
>
> > > > >>> @ravi: thanks..!!
>
> > > > >>> On Thu, Sep 22, 2011 at 12:54 AM, ravi maggon 
> > > > >>> <[email protected]>wrote:
>
> > > > >>>> ohh sorry, I thought it was i<=9. Yes only 9 times Hello will be
> > > > >>>> printed.
>
> > > > >>>> On Thu, Sep 22, 2011 at 12:52 AM, Rashmi Jain 
> > > > >>>> <[email protected]
> > > > >>>> > wrote:
>
> > > > >>>>> @ravi
> > > > >>>>> can u plz explain how 10 processes are created..? shouldn't it be 
> > > > >>>>> 9..??
>
> > > > >>>>> On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon 
> > > > >>>>> <[email protected]>wrote:
>
> > > > >>>>>> Output Hello printed 10 times. Since form command spawns the 
> > > > >>>>>> process,
> > > > >>>>>> so for every call their are two process created and since if 
> > > > >>>>>> process gets
> > > > >>>>>> successfully created fork returns some positive no. which is the 
> > > > >>>>>> process id,
> > > > >>>>>> so it will break the loop and finally only the 10 child 
> > > > >>>>>> processes will be
> > > > >>>>>> left which will print Hello 10 times. I hope that I cleared your 
> > > > >>>>>> doubt.
>
> > > > >>>>>> On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya 
> > > > >>>>>> <[email protected]>wrote:
>
> > > > >>>>>>>http://ideone.com/nkTVN
>
> > > > >>>>>>> On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar <
> > > > >>>>>>> [email protected]> wrote:
>
> > > > >>>>>>>> "Hello" will be printed 45 times...
>
> > > > >>>>>>>> On Wed, Sep 21, 2011 at 7:57 PM, sush57 
> > > > >>>>>>>> <[email protected]>wrote:
>
> > > > >>>>>>>>> main()
> > > > >>>>>>>>> {
> > > > >>>>>>>>>        int tmp;
> > > > >>>>>>>>>        for(i=0;i<9;i++)
> > > > >>>>>>>>>        {
> > > > >>>>>>>>>                tmp=fork();
> > > > >>>>>>>>>                if(tmp>0)
> > > > >>>>>>>>>                        break;
> > > > >>>>>>>>>                printf("Hello");
> > > > >>>>>>>>>        }
> > > > >>>>>>>>> }
>
> > > > >>>>>>>>> what's the output and how does this work....
>
> > > > >>>>>>>>> can u give few other questions using fork...
>
> > > > >>>>>>>>> --
> > > > >>>>>>>>> You received this message because you are subscribed to the 
> > > > >>>>>>>>> Google
> > > > >>>>>>>>> Groups "Algorithm Geeks" group.
> > > > >>>>>>>>> To post to this group, send email to 
> > > > >>>>>>>>> [email protected].
> > > > >>>>>>>>> To unsubscribe from this group, send email to
> > > > >>>>>>>>> [email protected].
> > > > >>>>>>>>> For more options, visit this group at
> > > > >>>>>>>>>http://groups.google.com/group/algogeeks?hl=en.
>
> > > > >>>>>>>>  --
> > > > >>>>>>>> You received this message because you are subscribed to the 
> > > > >>>>>>>> Google
> > > > >>>>>>>> Groups "Algorithm Geeks" group.
> > > > >>>>>>>> To post to this group, send email to 
> > > > >>>>>>>> [email protected].
> > > > >>>>>>>> To unsubscribe from this group, send email to
> > > > >>>>>>>> [email protected].
> > > > >>>>>>>> For more options, visit this group at
> > > > >>>>>>>>http://groups.google.com/group/algogeeks?hl=en.
>
> > > > >>>>>>> --
> > > > >>>>>>> *Anil  Arya,
> > > > >>>>>>> Computer Science *
> > > > >>>>>>> *Motilal Nehru National Institute of Technology,Allahabad .
> > > > >>>>>>> *
>
> > > > >>>>>>>  --
> > > > >>>>>>> You received this message because you are subscribed to the 
> > > > >>>>>>> Google
> > > > >>>>>>> Groups "Algorithm Geeks" group.
> > > > >>>>>>> To post to this group, send email to [email protected].
> > > > >>>>>>> To unsubscribe from this group, send email to
> > > > >>>>>>> [email protected].
> > > > >>>>>>> For more options, visit this group at
> > > > >>>>>>>http://groups.google.com/group/algogeeks?hl=en.
>
> > > > >>>>>> --
> > > > >>>>>> Regards
> > > > >>>>>> Ravi Maggon
> > > > >>>>>> B.E. CSE, Final Year
> > > > >>>>>> Thapar University
>
> > > > >>>>>>www.algorithmguru.com
>
> > > > >>>>>> "*Failure is the opportunity to begin again more intelligently"*
>
> > > > >>>>>>  --
> > > > >>>>>> You received this message because you are subscribed to the 
> > > > >>>>>> Google
> > > > >>>>>> Groups "Algorithm Geeks" group.
> > > > >>>>>> To post to this group, send email to [email protected].
> > > > >>>>>> To unsubscribe from this group, send email to
> > > > >>>>>> [email protected].
> > > > >>>>>> For more options, visit this group at
> > > > >>>>>>http://groups.google.com/group/algogeeks?hl=en.
>
> > > > >>>>>  --
> > > > >>>>> You received this message because you are subscribed to the Google
> > > > >>>>> Groups "Algorithm Geeks" group.
> > > > >>>>> To post to this group, send email to [email protected].
> > > > >>>>> To unsubscribe from this group, send email to
> > > > >>>>> [email protected].
> > > > >>>>> For more options, visit this group at
> > > > >>>>>http://groups.google.com/group/algogeeks?hl=en.
>
> > > > >>>> --
> > > > >>>> Regards
> > > > >>>> Ravi Maggon
> > > > >>>> B.E. CSE, Final Year
> > > > >>>> Thapar University
>
> > > > >>>>www.algorithmguru.com
>
> > > > >>>> "*Failure is the opportunity to begin again more intelligently"*
>
> > > > >>>>  --
> > > > >>>> You received this message because you are subscribed to the Google
> > > > >>>> Groups "Algorithm Geeks" group.
> > > > >>>> To post to this group, send email to [email protected].
> > > > >>>> To unsubscribe from this group, send email to
> > > > >>>> [email protected].
> > > > >>>> For more options, visit this group at
> > > > >>>>http://groups.google.com/group/algogeeks?hl=en.
>
> > > > >>>  --
> > > > >>> You received this message because you are subscribed to the Google 
> > > > >>> Groups
> > > > >>> "Algorithm Geeks" group.
> > > > >>> To post to this group, send email to [email protected].
> > > > >>> To unsubscribe from this group, send email to
> > > > >>> [email protected].
> > > > >>> For more options, visit this group at
> > > > >>>http://groups.google.com/group/algogeeks?hl=en.
>
> > > > >>  --
> > > > >> You received this message because you are subscribed to the Google 
> > > > >> Groups
> > > > >> "Algorithm Geeks" group.
> > > > >> To post to this group, send email to [email protected].
> > > > >> To unsubscribe from this group, send email to
> > > > >> [email protected].
> > > > >> For more options, visit this group at
> > > > >>http://groups.google.com/group/algogeeks?hl=en.
>
> > > > > --
> > > > > Regards
> > > > > Ravi Maggon
> > > > > B.E. CSE, Final Year
> > > > > Thapar University
>
> > > > >www.algorithmguru.com
>
> > > > > "*Failure is the opportunity to begin again more intelligently"*
>
> > > > >  --
> > > > > You received this message because you are subscribed to the Google 
> > > > > Groups
> > > > > "Algorithm Geeks" group.
> > > > > To post to this group, send email to [email protected].
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected].
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/algogeeks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to