Question: Consider the following program in c #include #include catalib.h> #include int main() pid t x = 0; int i; for (i=1;i 1 is a constant
Consider the following program in c #include #include catalib.h> #include int main() pid t x = 0; int i; for (i=1;i 1 is a constant defined in the beginning of the program through a #define statement Assume that all fork() calls complete successfully Note that "getpid(" and "getppid" are two system calls that return the process identifier of the calling process and the process identifier of the calling process's parent, respectively. 1) How many processes are created during the execution of this program (including the parent process)? Explain your answer to get credit. 1.) Give the process hierarchy tree for this program (see slide 2.15 for an example process hierarchy treo). [You can explain the hierarchy in writing as opposed to drawing, if it's easier. For example, you can say there are three processes: parent process A, a process B (child of A), another process C (child of Br" if you believe there are three processes with the given parent-child relationships] ill) How many lines of the output would be printed? Explain your answer to get credit. iv.) Now assume that the first process to enter the "for loop has the process identifier 1000 and it is spawned by a shell process which has the process identifier 900. Further, assume all the spawned processes thereafter in this program receive consecutive process identifiers (i.e., 1001, 1002, 1003, ...) iv.) Now assume that the first process to enter the "for" loop has the process identifier 1000 and it is spawned by a shell process w the process identifier 900. Further, assume all the spawned processes thereafter in this program receive consecutive process iden (1.e., 1001, 1002 1003, ...) Assuming a large N, what would be the first two lines and the last line of the output? Explain your answer to get credit. (you can refer to N in your answer). Consider the following program in c #include #include catalib.h> #include int main() pid t x = 0; int i; for (i=1;i 1 is a constant defined in the beginning of the program through a #define statement Assume that all fork() calls complete successfully Note that "getpid(" and "getppid" are two system calls that return the process identifier of the calling process and the process identifier of the calling process's parent, respectively. 1) How many processes are created during the execution of this program (including the parent process)? Explain your answer to get credit. 1.) Give the process hierarchy tree for this program (see slide 2.15 for an example process hierarchy treo). [You can explain the hierarchy in writing as opposed to drawing, if it's easier. For example, you can say there are three processes: parent process A, a process B (child of A), another process C (child of Br" if you believe there are three processes with the given parent-child relationships] ill) How many lines of the output would be printed? Explain your answer to get credit. iv.) Now assume that the first process to enter the "for loop has the process identifier 1000 and it is spawned by a shell process which has the process identifier 900. Further, assume all the spawned processes thereafter in this program receive consecutive process identifiers (i.e., 1001, 1002, 1003, ...) iv.) Now assume that the first process to enter the "for" loop has the process identifier 1000 and it is spawned by a shell process w the process identifier 900. Further, assume all the spawned processes thereafter in this program receive consecutive process iden (1.e., 1001, 1002 1003, ...) Assuming a large N, what would be the first two lines and the last line of the output? Explain your answer to get credit. (you can refer to N in your answer)