Question: Your program should perform an operating system API call to open a text file named Data.txt , write 1 , 0 0 0 , 0
Your program should perform an operating system API call to open a text file named Data.txt write random
numbers in the range to the file, and close the file. Next, the program creates three threads. Each thread should:
Perform an operating system API call to open the Data.txt file.
Create a file named DataThreadXtxt where X is the letter A B or C depending on which thread created the file.
Each thread copies the data from the Data.txt file to its DataThreadXtxt file.
While copying the data, calculate the average of the numbers in the Data.txt file to two places past the decimal
point eg and output the average just before the thread finishes. Make sure this works on files of any size.
Close the Data.txt file and the DataThreadXtxt files.
Compute each threads execution time and output it in milliseconds ms
The main thread should wait for the thread tasks to finish. The main thread should also compute the total wall
clock execution time ms of the program execution including all three thread tasks and output the result.
Be sure it is clear which thread is outputting which information in # # and # above
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
