Question: Program a recursive process tree in C You are asked to write a program which generates arbitrary process trees from a given input file. Your

Program a recursive process tree in C

Program a recursive process tree in C You are asked to write

You are asked to write a program which generates arbitrary process trees from a given input file. Your program is based on a recursive function which will be called for every tree node. If the tree node has children, the function will create them and will wait until they are terminated. If the tree node does not have children, the function will call sleep) with a predefined argument. The input file contains the description of a tree, node after node, starting from the root. For every node, you must specify its name, the number of children and the names of the children. You are responsible for figuring out how to represent the nodes and their names in your input file so that they can be uniquely mapped to the tree under consideration. For instance, how to distinguish between DFS vs. BFS nodes? Under one scenario, the process tree of scheme 1 may be described as follows: A 2 B C B 1 D D 0 There may be better and more efficient ways to build our input file though. Select the representation that is convenient and optimal for your program You are asked to write a program which generates arbitrary process trees from a given input file. Your program is based on a recursive function which will be called for every tree node. If the tree node has children, the function will create them and will wait until they are terminated. If the tree node does not have children, the function will call sleep) with a predefined argument. The input file contains the description of a tree, node after node, starting from the root. For every node, you must specify its name, the number of children and the names of the children. You are responsible for figuring out how to represent the nodes and their names in your input file so that they can be uniquely mapped to the tree under consideration. For instance, how to distinguish between DFS vs. BFS nodes? Under one scenario, the process tree of scheme 1 may be described as follows: A 2 B C B 1 D D 0 There may be better and more efficient ways to build our input file though. Select the representation that is convenient and optimal for your program

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!