Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment 1 A Child Needs its Space It is known that a child process runs in its own address space, while its parent process runs
Assignment 1 A Child Needs its Space It is known that a child process runs in its own address space, while its parent process runs in its own address space. We will use the Fibonacci algorithm to illustrate this Write a program the spawns a child process from the parent process. In the child process implement the recursive Fibonacci algorithm. As we know, the recursive Fibonacci algorithm has exponential order and hence takes a long time to complete (especially for larger numbers). Use the clock() function to compute the time it takes to run the program. Start the clock at the beginning of the program and end it at the end of the program, then compute the execution time. This may give a surprising result, especially for larger numbers as you wait for the program to execute. Then begin the clock inside (at the beginning) the child process and end it at the end of the child process. Compute the execution time of the child process and note it and the time of the parent process and note that. Try this with the C system wait() function (so the parent waits for the child to complete) and without the wait() function What do you think caused these results? Explain! How long did each process take to complete? Explain! You should make a table (and/or graph) of your results and then an obiective analysis Note, to obtain interesting results and use larger numbers, you may want to use the unsigned long long with format specifier %lu, or %lld for just long long Requirements 1.) HardCopy of program 2.) Results (comparative results) in the form of screen shots or a table of data 3.) Written explanation of how the program works and an explanation of results, explain the execution times for the parent and the child process. What is going on? 4.) If you have questions, you can meet with me (during my office hours or by appointment) to discuss the project. Assignment 1 A Child Needs its Space It is known that a child process runs in its own address space, while its parent process runs in its own address space. We will use the Fibonacci algorithm to illustrate this Write a program the spawns a child process from the parent process. In the child process implement the recursive Fibonacci algorithm. As we know, the recursive Fibonacci algorithm has exponential order and hence takes a long time to complete (especially for larger numbers). Use the clock() function to compute the time it takes to run the program. Start the clock at the beginning of the program and end it at the end of the program, then compute the execution time. This may give a surprising result, especially for larger numbers as you wait for the program to execute. Then begin the clock inside (at the beginning) the child process and end it at the end of the child process. Compute the execution time of the child process and note it and the time of the parent process and note that. Try this with the C system wait() function (so the parent waits for the child to complete) and without the wait() function What do you think caused these results? Explain! How long did each process take to complete? Explain! You should make a table (and/or graph) of your results and then an obiective analysis Note, to obtain interesting results and use larger numbers, you may want to use the unsigned long long with format specifier %lu, or %lld for just long long Requirements 1.) HardCopy of program 2.) Results (comparative results) in the form of screen shots or a table of data 3.) Written explanation of how the program works and an explanation of results, explain the execution times for the parent and the child process. What is going on? 4.) If you have questions, you can meet with me (during my office hours or by appointment) to discuss the project
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