Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are asked to write a program which generates arbitrary process trees from a given input file. Your program is tree node has children, the

image text in transcribed

You are asked to write a program which generates arbitrary process trees from a given input file. Your program is 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 sleepO with a predefined argument. based on a recursive function which will be called for every tree node. If the 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 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. Remark 1: Another very important feature of your process tree is that now, based on your experience with Problem 0, you must 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 the 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 3: You are asked to write a function that reads the tree from the file, constructs its representation in memory and returns a pointer to the root: read_tree file (const char filename). You are also asked to write a function that runs the tree starting from root and prints its elements on the screen: print_tree (struct tree_node root) Question: What is the order of appearance of the start and termination messages from the processes and why? You are asked to write a program which generates arbitrary process trees from a given input file. Your program is 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 sleepO with a predefined argument. based on a recursive function which will be called for every tree node. If the 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 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. Remark 1: Another very important feature of your process tree is that now, based on your experience with Problem 0, you must 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 the 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 3: You are asked to write a function that reads the tree from the file, constructs its representation in memory and returns a pointer to the root: read_tree file (const char filename). You are also asked to write a function that runs the tree starting from root and prints its elements on the screen: print_tree (struct tree_node root) Question: What is the order of appearance of the start and termination messages from the processes and why

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions

Question

What is the purpose of the SEC s Reg D

Answered: 1 week ago