If main process is included then 20...

On Sun, Sep 5, 2010 at 12:01 AM, PremShankar Kumar <[email protected]> wrote:

> @albert:-
> Here you go:-
>
> #include <unistd.h>
> #include<iostream>
>
> using namespace std;
>
>
> int Fork(int i)
> {
> cout<<endl<<"Fork"<<i<<" executed."<<endl;
>  return fork();
> }
> int main()
> {
> Fork(1);
> Fork(2) && Fork (3) || Fork (4);
>  Fork (5);
> }
>
> Regards,
> Prem
>
>
>
> On Sat, Sep 4, 2010 at 11:41 PM, vikash jain <[email protected]>wrote:
>
>> yes ..19 is the correct answer.
>>
>>                                                                     p(f1)
>>                                                                    /  \
>>                                                                  p1   p
>>                                                                  (f2)
>> (f2)
>>                                                                 / \
>> / \
>>                                                                /   \
>> /   \
>>                                                              p2  p1  p11
>> p(f3)
>>                                                              (f4)  (f3)
>> (f4)    /\
>>                                                             /  \
>> /\      /\   /  \
>>                                                            /    \   /
>> \    /  \  /   \
>>                                                         p3   p2 p6 p1
>>                                                         f5    f5   f4  f5
>>                                                          and so on
>> if fork2 returns zero then fork3 is not executed.
>>
>> --
>> 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]<algogeeks%[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]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
The Power to Believe in yourself, will become the power to change Fate.

-- 
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