Question: Write a C Program that writes all the odd numbers from 1 to 1 0 0 , 0 0 0 to the output file. Open
Write a C Program that writes all the odd numbers from to to the output file. Open the file, write the next value, and close the file. Measure how much elapsed time it takes to complete this processing. The process should open and close the file times. Yes, it is inefficient, but we are trying to force some IO usage.
Next have the program fork and create separate processes. Each process would process a range of to One process would process to another to etc. Each process performs the exact same tasks in the same way, as the first part of the problem, but write the output to separate files, one for each process. Next read the ten files to make one file with all the number.. Measure the elapsed time it takes for all processes to complete, and to create the output file.
The goal is to show that by breaking up the task across processes that do IO the total elapsed needed will be shorter. Make sure you choose elapsed time function in C to track time, versus CPU Clock time.
If your program is not finding a difference between the approaches or is taking too long, you can modify the up or down.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
