Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python Create two programs, where one program reads the first half of the files, and another program reads the second half. Use the OS

Using Python

Create two programs, where one program reads the first half of the files, and another program reads the second half. Use the OS to launch both programs simultaneously.

Now, break up hugefile1.txt and hugefile2.txt into 10 files each, and run your process on all 10 sets in parallel. How do the run times compare to the original process?

Using Python create a program to produce a new file: totalfile.txt, by taking the numbers from each line of the two files and adding them. So, each line in file #3 is the sum of the corresponding line in hugefile1.txt and hugefile2.txt. For example, if the first 5 lines of your files look as follows: $ head -5 hugefile*txt ==> hugefile1.txt <== 4131 29929 6483 7659 25003 ==> hugefile1.txt <== 8866 19171 11029 4889 27069 then the first 5 lines of totalfile.txt look like this: $ head -5 totalfile.txt 12997 49100 17512 12548 52072 Because the files of such large sizes cannot be read into memory in their entirety at the same time, you need to use concurrency. Reading the files one line at a time will take a long time, so use what you have learned in this course to optimize this process. Be sure to record the amount of time it takes for each version of your program to complete this task.

hugefile1.txt and hugefile2.txt both contain 10000000 rows or lines which is why the head -5 is used as the example pulling the first 5 lines

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions

Question

What methods are used to design effective test cases?

Answered: 1 week ago