ya got it thanx.....

On Sep 1, 12:46 pm, rahul vatsa <[email protected]> wrote:
> *Ln 2 :1st fork ret value +ve, (i.e parent), *
> As && is their before next fork, so nw 2nd fork will be calld,
>         if (ret >= 0), won't go for next fork, (as its a true for ||) => so
> 1 pr from here
>         else if (ret ==0), will go for next fork.  => so 2 prs from here
>
> so, total 3 process in case when 1st fork (in ln2) is nonzero.
>
>
>
>
>
>
>
> On Wed, Aug 31, 2011 at 2:41 PM, htross <[email protected]> wrote:
> > u r not considering what if the first fork returns non zero and the
> > second for returns a zero value then????
>
> > On Aug 31, 9:50 pm, rahul vatsa <[email protected]> wrote:
> > > int main()
> > > {
> > >    fork();
> > >    fork() && fork() || fork();
> > >    fork();
> > >    printf("forked\n");
> > >    return 0;
>
> > > }
>
> > > ln 1 : will create 2 prs
> > > ln 2 : will create 10 process for each existing pr
> > > ln 3 : will do fork for all 10 process, nd so now u ve 20 prs
>
> > > the main issue is @ln-2 in main( )
>
> > > Ln 2 :
>
> > > here for 1st fork, if its parent, its ret value in nonzero, so it will
> > > proceed for next fork, as that is for &&.  if ret value of this 2nd fork
> > is
> > > nonzero, it willn't try the 3rd fork (as its nt required, bcoz that comes
> > > after ||, nd the st is already a true st) --  > So for parent of 1st fork
> > in
> > > the st, total no of prs created is 3.
>
> > > if 1st fork returns 0, ie if it is child, it willn't attempt the next
> > > fork(bcoz thatz for operator && , and the st is already 0), bt it will do
> > > attempt the 3rd fork(bcoz that is for operator ||)  so total no processes
> > > created here is - 2
>
> > > Ln 3- this fork is called for all created processes.  2(Ln 1) * 5(ln 2) *
> > 2
> > > (ln 3) == 20 prs
>
> > > On Wed, Aug 31, 2011 at 12:29 PM, SANDEEP CHUGH <[email protected]
> > >wrote:
>
> > > > it will be 16 ..
>
> > > > On Wed, Aug 31, 2011 at 9:54 PM, abhishek <[email protected]
> > >wrote:
>
> > > >> i think it will be 16 (not sure )
>
> > > >> can anyone explain how it will be 20,
> > > >> On Aug 31, 9:02 pm, SANDEEP CHUGH <[email protected]> wrote:
> > > >> > i thinks it is 16 not 20
>
> > > >> > please check that
>
> > > >> > On Wed, Aug 31, 2011 at 9:18 PM, annarao kataru <
> > > >> [email protected]>wrote:
>
> > > >> > > @swathi ::  why  it is  20  times ??   ur answer  is  correct  but
> > > >> > > plz  explain the  process??????
>
> > > >> > > --
> > > >> > > 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.
>
> > --
> > 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