What is the output of the following fork system call?

#include <stdio.h>

#include <unistd.h>

int main()



   fork() && fork() || fork();




   return 0;



Image icon IMAG0048-min.jpg

Pritam Prasun pritam 10 Aug 2017 02:55 pm

Why don't you give it a try, I will help you to reach to the answer.

venkat saikumartadi 10 Aug 2017 03:28 pm

just check the image i uploaded sir 

venkat saikumartadi 10 Aug 2017 03:49 pm

i got the answer sir :) thanks for replying 


Pritam Prasun pritam 11 Aug 2017 11:22 am

Well Done!

That's how one should always approach to the problem. Remember, getting the solution is not our goal. Our aim should be to develop the problem-solving ability.

venkat saikumartadi 10 Aug 2017 03:28 pm

sir i have kept a link of the image i solved the problem on i am getting 22 processes including parent but the answer was given 20 including parent here we should use the shortcircuit rule for few of the processes i did it even then i donno why i am getting 2 more 

shivani shivani1234 15 Aug 2017 08:59 pm