3 votes 3 votes What is the output and how many child(what is the code of all other child .what they copied from parent give tree diagram) t1=0;t2=0; Fork(); Printf("hi"); t1=Fork(); Printf("hi"); t2=fork(); printf("hi); fork(); printf("hi); Operating System fork-system-call + – sourabh asked Dec 5, 2015 sourabh 919 views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply Tendua commented Dec 6, 2015 reply Follow Share i think here is the answer. https://gateoverflow.in/29701/fork#viewbutton 0 votes 0 votes mcjoshi commented Sep 13, 2016 reply Follow Share 15 child processed will be created and 30 times "Hi" will be printed. 0 votes 0 votes cse7 commented Nov 21, 2016 reply Follow Share @mcjoshi i have one doubt. If question asked tell the number of processes created then what we need to answer ? Number of processes(child and parent) or no. of child processes?? 1 votes 1 votes mcjoshi commented Dec 1, 2016 reply Follow Share @cse7 processes created means no. of new processes created as a result of executing code. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes 30 Hi and 15 Child processes will be createds. mandar aundhekar answered Dec 30, 2015 mandar aundhekar comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes 30 "Hi" 16 processes (15 child, 1 parent) tiger answered Sep 16, 2016 tiger comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes Answer is 64. stdout is buffered. So, 16 processes with 4 printfs each, produces 64 hi's. Note: I ran the code myself, it produced 64 hi's. Chiranjeevi Kanaka answered Jan 7, 2018 Chiranjeevi Kanaka comment Share Follow See all 0 reply Please log in or register to add a comment.