Question: How many processes does the following piece of code create? Why? int main() {fork(); fork(); fork(); return 0;} a) Write a C/C + + -

 How many processes does the following piece of code create? Why?

How many processes does the following piece of code create? Why? int main() {fork(); fork(); fork(); return 0;} a) Write a C/C + + - program that creates a chain of 10 processes and prints out their process ids and relationships. For example, process 1 is the parent of process 2, process 2 is the parent of process 3, process 3 is the parent of 4 and so on. Each child has to print out all her ancestors identified by the process ids. b) Write a C/C + + - program that creates a fan of 10 processes. That is, process 1 is the parent of prcocesses 2, 3, 4, 5, 6 and so on

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!