Question: In C please, Remarks are just instructions Write a program which generates arbitrary process trees from a given input file. Your program is based on

 In C please, Remarks are just instructions Write a program which

In C please, Remarks are just instructions

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 must decide 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? Scheme 1: Example of a process tree. Under one scenario, as an example, a process tree may be described as follows: A 2 B C B 1 D D 0 Remark 1: Ensure you do not generate more processes than what your system can handle. So, please justify in your report, what the size of the process tree you selected is and why Remark 2: Every tree node is defined by struct: tree_node, which contains the number of children (children_no), and the name of the node and pointer to the area where contiguous children no structs are placed, one for every child node. Remark 2 helps understand how to represent the remaining tree when stored in the memory of an internal process tree node. You should not pass part of the original file as file", but pass only the amount of information required stored as linked list or some other structure. Remark 3: Write a function that reads the tree from file, constructs its representation in memory and returns a pointer to the root: read tree file (const char *filename). Also write a function that runs the tree starting from root and prints its elements: print tree (struct tree_node root) Remark 4: You must build the process tree, not just a tree data structure. However, for every process tree node you are building you must pass on the information of the remaining sub-tree recursively. Also, you must print out the tree after creation using the process tree. For this, you will need some form of IPC for interaction across processes (go up or down the tree). You may choose to print in a recursive fashion. Question: What is the order of appearance of start and termination messages from processes and why? 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 must decide 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? Scheme 1: Example of a process tree. Under one scenario, as an example, a process tree may be described as follows: A 2 B C B 1 D D 0 Remark 1: Ensure you do not generate more processes than what your system can handle. So, please justify in your report, what the size of the process tree you selected is and why Remark 2: Every tree node is defined by struct: tree_node, which contains the number of children (children_no), and the name of the node and pointer to the area where contiguous children no structs are placed, one for every child node. Remark 2 helps understand how to represent the remaining tree when stored in the memory of an internal process tree node. You should not pass part of the original file as file", but pass only the amount of information required stored as linked list or some other structure. Remark 3: Write a function that reads the tree from file, constructs its representation in memory and returns a pointer to the root: read tree file (const char *filename). Also write a function that runs the tree starting from root and prints its elements: print tree (struct tree_node root) Remark 4: You must build the process tree, not just a tree data structure. However, for every process tree node you are building you must pass on the information of the remaining sub-tree recursively. Also, you must print out the tree after creation using the process tree. For this, you will need some form of IPC for interaction across processes (go up or down the tree). You may choose to print in a recursive fashion. Question: What is the order of appearance of start and termination messages from processes and why

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!