1 votes 1 votes closed as a duplicate of: fork() system call #include <stdio.h> #include <unistd.h> int main() { fork(); fork() && fork() || fork(); fork(); printf("forked\n"); return 0; } //How this works specially the level 2 fork() // with && || Operating System operating-system process + – Nandkishor Nangre asked Mar 22, 2018 • closed Mar 23, 2018 by Arjun Nandkishor Nangre 915 views comment Share Follow See all 3 Comments See all 3 3 Comments reply gauravkc commented Mar 22, 2018 reply Follow Share There is a solution here https://careercup.com/question?id=13030673 This is how it will execute A: fork(); B:fork() && fork() || fork() C:fork(); A: fork() 2 processes (1 parent and 1 child) B: fork() && fork() || fork() 4(both fork) + 4(both fork) + 2(only child do this fork) = 10 since this is a single execution statement we need add them C: fork() 20 I didn't get though ' 2(only child do this fork) ' part 0 votes 0 votes Nandkishor Nangre commented Mar 23, 2018 reply Follow Share the website which u have mentioned is not working ..... thanks for the help 0 votes 0 votes Rakmo commented Dec 20, 2022 reply Follow Share 13 times forked get printed ??? Correct me if i m wrong ?? 0 votes 0 votes Please log in or register to add a comment.