0 votes 0 votes Consider the following code segments, the total number of processes (including the initial process) is ______. Sagar475 asked Jan 9, 2022 Sagar475 332 views answer comment Share Follow See 1 comment See all 1 1 comment reply Sagar475 commented Jan 9, 2022 reply Follow Share Okay I know i am commenting my own answer but found some usefull video hope it will work to all whom doubt is same as mine….Part1-https://www.youtube.com/watch?v=z9BiKwrp_wcPart2-https://www.youtube.com/watch?v=7hHh7R-NAog 0 votes 0 votes Please log in or register to add a comment.
3 votes 3 votes Total number of process including initial process is 5 Isha_99 answered Jan 9, 2022 Isha_99 comment Share Follow See all 3 Comments See all 3 3 Comments reply Sagar475 commented Jan 9, 2022 reply Follow Share can you tell me one more thing in if condition the fork will return 0 than how it’s greater than 0 . means how it’s executing the fork condition inside the if condition 0 votes 0 votes Isha_99 commented Jan 9, 2022 reply Follow Share @Sagar475 Inside if for parent process fork returns value greater than zero and for child it returns zero . Now coming to this particular question after first fork i.e Fork1, child1 goes into first if condition .For 2nd fork inside 2nd if block, it will become a parent process and create child2. 1 votes 1 votes amitraj123 commented Jan 9, 2022 reply Follow Share @Isha_99 Correct and simply, we can say that when child process execute fork(inside_child), then for this fork child behave like parent. 1 votes 1 votes Please log in or register to add a comment.