Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this question you are requested to expand the program of Problem 2 for the purpose of computing trees that represent numerical expressions. For example,
In this question you are requested to expand the program of Problem 2 for the purpose of computing trees that represent numerical expressions. For example, the tree of schema 2 represents the expression: 10 x (5+6) 5 6 Scheme 2: Process tree for numerical expression: 10 x (5+6) The provided input files and hence the process tree that are derived have the following limitations: 1) Every internal node has exactly two children and represents one of the two operands: 2) The name of every leaf node is an integer number The evaluation of the expression will be conducted in parallel, creating one process for every tree node. Every leaf process return to the parent process the numerical value that corresponds to it. Every non-leaf process receives the evaluation of the sub-expressions coming from its children processes, calculates the value corresponding to its own node and returns the value to its parent process. The root process returns the final result to the initial process of the program, which prints/displays it on the screen. Remark: You must use the IPC of Linux pipes for the communication between parent and children processes. Every process must monitor its children for their termination and print the corresponding diagnostic in order to detect programming errors in a timely manner. Intermediate printouts are always welcome, they also facilitate debugging. Question How many pipes per process do we need to use in this problem? Would it be possible for every parent process to use only one pipe for all the children processes? Or in general, can we use only one pipe for every numerical operand? 1. In this question you are requested to expand the program of Problem 2 for the purpose of computing trees that represent numerical expressions. For example, the tree of schema 2 represents the expression: 10 x (5+6) 5 6 Scheme 2: Process tree for numerical expression: 10 x (5+6) The provided input files and hence the process tree that are derived have the following limitations: 1) Every internal node has exactly two children and represents one of the two operands: 2) The name of every leaf node is an integer number The evaluation of the expression will be conducted in parallel, creating one process for every tree node. Every leaf process return to the parent process the numerical value that corresponds to it. Every non-leaf process receives the evaluation of the sub-expressions coming from its children processes, calculates the value corresponding to its own node and returns the value to its parent process. The root process returns the final result to the initial process of the program, which prints/displays it on the screen. Remark: You must use the IPC of Linux pipes for the communication between parent and children processes. Every process must monitor its children for their termination and print the corresponding diagnostic in order to detect programming errors in a timely manner. Intermediate printouts are always welcome, they also facilitate debugging. Question How many pipes per process do we need to use in this problem? Would it be possible for every parent process to use only one pipe for all the children processes? Or in general, can we use only one pipe for every numerical operand? 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started